Warning: Wrong parameter count for array_fill()

$query = sprintf("INSERT INTO affleads VALUES ".implode(",", array_fill(0, $number, "('','%s',%s,'%s','MANUAL','MANUAL','','','Pending','',%s,%s,'%s','%s')",
			quote_smart($proid),
			quote_smart($pname),
			quote_smart($affid),
			quote_smart($affpayout),
			quote_smart($netpayout),
			quote_smart($datenow),
			quote_smart($timenow))));

Whats wrong with the above please?

Any help would be great, thank you guys!

array_fill() must have three parameters
What you have now is


$query = 
  sprintf(
      "INSERT INTO affleads VALUES " .
      implode(
          ","
        , array_fill(
[COLOR="Green"][B]              0                      <-- first parameter
            , $number                <-- second parameter
            , "('','%s',%s,'%s','MANUAL','MANUAL','','','Pending','',%s,%s,'%s','%s')"     <-- third parameter[/B][/COLOR]
            [COLOR="Red"][B], quote_smart($proid)    <-- fourth parameter
            , quote_smart($pname)    <-- ecc
            , quote_smart($affid)
            , quote_smart($affpayout)
            , quote_smart($netpayout)
            , quote_smart($datenow)
            , quote_smart($timenow)[/B][/COLOR]
          [B])  <-- closes array_fill[/B]
      )  <-- closes implode
  ) <-- closes sprintf
; 

Instead it should be


$query = 
  sprintf(
      "INSERT INTO affleads VALUES " .
      implode(
          ","
        , array_fill(
[COLOR="Green"][B]              0                      <-- first parameter
            , $number                <-- second parameter
            , "('','%s',%s,'%s','MANUAL','MANUAL','','','Pending','',%s,%s,'%s','%s')"     <-- third parameter[/B][/COLOR]
          [B])  <-- closes array_fill[/B]
        , quote_smart($proid)    
        , quote_smart($pname)    
        , quote_smart($affid)
        , quote_smart($affpayout)
        , quote_smart($netpayout)
        , quote_smart($datenow)
        , quote_smart($timenow)
      )  <-- closes implode
  ) <-- closes sprintf
; 

Which doesn’t make much sense anyway. What exactly are you trying to do?

Sorry guys, I’m little confussed, can you show me an example of where i’ve gone wrong.

You only have one parameter because you put the } to close array_fill( at the end of the sprintf instead of at the end of the first parameter.

There is no } in the query. Sorry I’m a little confused.

Any help would be great.

Thanks

For your reference:

// Quote variable to make safe
function quote_smart($value)
{
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// Quote if not a number or a numeric string
if (!is_numeric($value)) {
$value = “'” . mysql_real_escape_string($value) . “'”;
}
return $value;
} // end make safe

You don’t close the array_fill before listing the quote_smart values.

You only have one parameter because you put the ) to close array_fill( at the end of the sprintf instead of at the end of the first parameter.