-
php with mysql
i use php to insert data into my sql tables - using phpmyAdmin stuff
but i have a big problem. when i insert stuff into the table, the new record should appear at the end of the table, instead everything is in some sort of order in the table
i want all the newest records to appear at the end of the table
why does it not insert at the end of the table
whats the problem?
-
Re: php with mysql
When you query your table just sort it yourself, eg
Code:
SELECT * FROM your_table ORDER BY date DESC
-
Re: php with mysql
thanks for the reply mate, but there is no 'date' field :S
i get:
Query error
Unknown column 'date' in 'order clause'
$query = "SELECT * FROM `table` ORDER BY date desc";
$result = mysql_query($query) or die("Query error<br/>" . mysql_error());
$total_rows = mysql_num_rows($result);
-
Re: php with mysql
sorry misread data with date in your first post. Just order it by your primary key in your table.
-
Re: php with mysql
Make sure you have an index (id) column with auto_increment set and then use last_insert_id() for that field's value whenever you add a new record.