خرید بک لینک

Vote count: 0

I want to generate an "insert into" SQL by a loop.

$orderrecord='INSERT into counter SET';

for ($rank=0; $rank<10; $rank++)
  { if (array_search($names[$rank],$POST['v'])!==FALSE) 
    { $orderrecord.=" $names[$rank]=1, "; } ;}

The problem is, there will always be 1 extra comma that render the SQL syntax invalid. "INSERT into counter SET A=1, B=1, C=1," or "INSERT into counter SET ,A=1, B=1, C=1". How to tackle this?

asked 51 secs ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 29 تير 1395 ساعت: 5:45

صفحه بندی