Inserting in wrong order

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
dmce
Forum Newbie
Posts: 1
Joined: Wed Nov 26, 2003 3:49 pm

Inserting in wrong order

Post 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
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post 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.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
Post Reply