how can i write a insert command inside a while loop ?
i did try like following code but its not working !!!
Code:while($result=mysql_fetch_array($sql))
{
mysql_query(INSERT INTO ......);
}
Printable View
how can i write a insert command inside a while loop ?
i did try like following code but its not working !!!
Code:while($result=mysql_fetch_array($sql))
{
mysql_query(INSERT INTO ......);
}
Is the problem with the loop or the actual query? What are you trying to do? Also the condition in the loop looks wrong.
You run the query to get the results. Then you loop through the results to get the rows. So you should probably have something like this:
PHP Code:$Query = "Some SELECT query here";
$ResultSet = mysql_query($Query);
while ($Row = mysql_fetch_array($ResultSet)) {
//do stuff here
}
thanks a lot for this tips. it was helpfull