i have the following code:
and the problem is when i have 2 entries with the same date, it puts the wrong one on top. It is supposed to be the new entry i put in is on top, Here is the code of the script i use to ADD the things into the database:
Code:
<? $get_name = mysql_query("SELECT * FROM `lastcredited` ORDER BY STR_TO_DATE(date, '%m/%d/%y') DESC"); while($namerow = mysql_fetch_array($get_name)) { $name1 = $namerow["name"]; $countr = $namerow["country"]; $id = $namerow["id"]; $date = $namerow["id"]; ?> <a href="offer<?=$id?>.php"><?=$name1?> (<?=$countr?>)</a><br><br> <? }?>
Code:
<?php $con = mysql_connect("localhost","xxxxxxxx","xxxxxxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("moneyeve_money4every1", $con); $sql="INSERT INTO lastcredited (id, name, date, country) VALUES ('$_POST[id]','$_POST[name]','$_POST[date]','$_POST[country]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Database updated with: <a href='offer$_POST[id].php'>$_POST[name]($_POST[country])$_POST[date] <br> <a href='addoffers.php'>add another</a>"; mysql_close($con) ?>
Comment