Hello Everyone,
I am facing a strange problem. When i placed a MySQL query in a loop, the output of my loop is different from the order in which queries are executed.
My code:
for($u=0; $u<$rows1; $u++)
{
$query="INSERT INTO links VALUES(\"$name\",\"$lname[$u]\",\"$lurl[$u]\")";
/echo($query."<br>");/
$result=mysql_query($query);
}
Execution Order:
INSERT INTO links VALUES("hildk","CNEL","www.cnel.ufl.edu")
INSERT INTO links VALUES("hildk","Home page","www.cnel.ufl.edu/~hildk/kenny.html")
INSERT INTO links VALUES("hildk","Smathers Library","www.uflib.ufl.edu/")
INSERT INTO links VALUES("hildk","Mirriam-Webster Online","www.m-w.com/")
INSERT INTO links VALUES("hildk","Bible Gateway","bible.gospelcom.net")
Database Values:
Mirriam-Webster Online--www.m-w.com/
Bible Gateway--bible.gospelcom.net
Smathers Library--www.uflib.ufl.edu/
CNEL--www.cnel.ufl.edu
Home page--www.cnel.ufl.edu/~hildk/kenny.html
My Problem:
Every person has some favorite links. When he wants to modify links, he gets a page which shows his previous links. But the database values are out of order in which i stored(command is executed). This keeps happening if i try to change the order. I am unable to store values in the order i want.
I would appreciate if any one can help me.
Thanks,
Sasidhar.