Posted by R.Lange on 03/19/05 22:46
David Robinson wrote:
> "Tex John" <john@logontexas.com> wrote in message
> news:qaF_d.2230$ot.1745@tornado.texas.rr.com...
>
>>$query = "INSERT INTO database SET ";
>>for ($x = 0; $x < count($test); $x++) {
>> $query .= "column = '".$test[$x]."'";
>> if($x < (count($test) + 1)) $query .= ", ";
>>}
>>$query .= "WHERE foo = 'bar'";
>>
>>You mean like that?
>>
>>John
>>
>
>
> Don't forget to add a space between columns:
>
> ....
> $query .= "column = '".$test[$x]." '";
> ...
This will put a space at the end of the string being inserted into the
database. I doubt that's the desired effect. From his setup, I'd say the
space would be better off in front of the WHERE keyword, like so:
$query .= " WHERE foo = 'bar'";
[Back to original message]
|