Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP MySQL Sorting Problem

Status
Not open for further replies.

Nematoth

Programmer
Mar 29, 2002
48
MY
I have a problem with MySQL in that when I perform the following:

$sqlquery3 = "select sub_no,sub_name from proj_sub where project_number='$project_number' ORDER BY sub_no;";

$result3 = mysql_query($sqlquery3);

while($row3 = mysql_fetch_array($result3))
{

$sqlquery4 = "INSERT INTO sub_image_issue
VALUES(
'',
'$issue',
'$row3[sub_no]',
'$project_number',
''
);";

$results4 = mysql_query($sqlquery4);
}

The second query 'sqlquery4' inputs data into the table 'sub_image_issue' in a bizarre order and not in the order specified in the query '$sqlquery3'

Any ideas why this might be happening?
Thomas Shearer
Multimedia Developer
 
If sub_no is a string field of any type, then they will be ordered character by character, ie:

1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 20 etc etc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top