Page 1 of 1

Inserting in wrong order

Posted: Wed Nov 26, 2003 3:49 pm
by dmce

Code: Select all

<HTML>
<BODY>
<form action="datain.php" method="post">
Enter your name: <input type="text" name="manufacturer">
h: <input type="text" name="model">
<input type="submit" name="SUBMIT" value="Submit">
</form>
</HTML>

Code: Select all

<HTML>
<?php
$db = mysql_connect("localhost", "dmce", "mac128");
mysql_select_db("robertsons",$db);
$sql = "INSERT INTO products (manufacturer, model) VALUES ('$_POST&#1111;manufacturer]','$_POST&#1111;model]')";
$result = mysql_query($sql);
echo $_POST&#1111;'manufacturer'];
echo $_POST&#1111;'model']; 
?>
</HTML>
Basically i had 3 manual entries in this database. id 1 to 3. i had been experimenting with the above and am now at id 31. fine, using the above i added info to the database. i then added more info, id=32 and it put it above id=31

looks like this in database:

1 tos 21s23
2 tos 21n21
3 tos 21v33
33 tos 32z33
32 tos 28z33
31 tos 24z33

any ideas as to why its appearing in the wrong order

Posted: Wed Nov 26, 2003 3:56 pm
by microthick
This always happens to me. But, really, does it matter the order in the database?

When selecting the data, just order by id and it'll look fine when you need to use it.

Posted: Thu Nov 27, 2003 2:12 am
by twigletmac
As microthick said, it really doesn't matter what order the records are in the table. You can reorder them before display so don't worry about it.

Mac