blink359 Posted May 9, 2009 Share Posted May 9, 2009 In a table i have the collums ID and text the id is a number. i want to echo on my main page the latest 5 but induvidually so you will have Latest one next latest next latest etc If you can help that would be great Thanks Blink359 Link to comment https://forums.phpfreaks.com/topic/157505-echoing-info-by-id/ Share on other sites More sharing options...
gevans Posted May 9, 2009 Share Posted May 9, 2009 Have you attmepted this, used php/mysql before? Some code will help. If you haven't tried yet I recommend you do as no-one is going to write this for you. Though it is a very simple application, just looking at the mysql_query syntax on the php.net website will probably sort this out for you. Link to comment https://forums.phpfreaks.com/topic/157505-echoing-info-by-id/#findComment-830439 Share on other sites More sharing options...
phpSensei Posted May 9, 2009 Share Posted May 9, 2009 Have you attmepted this, used php/mysql before? Some code will help. If you haven't tried yet I recommend you do as no-one is going to write this for you. Though it is a very simple application, just looking at the mysql_query syntax on the php.net website will probably sort this out for you. What he said, except the part where no one will write it for you. I am feeling generous. here <?php $query = @mysql_query("SELECt * FROM `table` ORDER BY `id` DESC LIMIT 5"); if($query){ while($row=mysql_fetch_array($query)){ $row['text'] . '<br>'; } } ?> Link to comment https://forums.phpfreaks.com/topic/157505-echoing-info-by-id/#findComment-830446 Share on other sites More sharing options...
neogemima Posted May 9, 2009 Share Posted May 9, 2009 Check out a tutorial, like http://www.tizag.com/phpT/ Link to comment https://forums.phpfreaks.com/topic/157505-echoing-info-by-id/#findComment-830450 Share on other sites More sharing options...
gevans Posted May 9, 2009 Share Posted May 9, 2009 What he said, except the part where no one will write it for you. I am feeling generous. here <?php $query = @mysql_query("SELECt * FROM `table` ORDER BY `id` DESC LIMIT 5"); if($query){ while($row=mysql_fetch_array($query)){ $row['text'] . '<br>'; } } ?> I was wrong there are some people here that will write it for you, but I wouldn't supress errors using the @ symbol. @mysql_query("SELECt * FROM `table` ORDER BY `id` DESC LIMIT 5"); You want to know if there's an error! <?php $query = mysql_query("SELECT * FROM `table` ORDER BY `id` DESC LIMIT 5") or die("Error: ".mysql_error()); Link to comment https://forums.phpfreaks.com/topic/157505-echoing-info-by-id/#findComment-830456 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.