steve24 Posted May 23, 2010 Share Posted May 23, 2010 Hi im new to php however i have made a site where i have lots of animals on so instead of having a different html page for each animal i decided to put a form on there and add animals using a form and some php. I have done this and it adds and lists them in links. To list them in links i have done <?php include ("connect.php"); $query ="SELECT * FROM weblog ORDER BY entrydate DESC LIMIT 10"; $result= mysql_query($query, $connection); while ($a_row = mysql_fetch_assoc($result)) { print "<p><a href='".$a_row['entrytitle'] ."'>".$a_row['entrytitle'] ."</a></p>"; } ?> So far when i click a link its page was not found, id like to know how i can click it so it gets the data from that spacific animal from the database. any help would be great Link to comment https://forums.phpfreaks.com/topic/202663-article-help/ Share on other sites More sharing options...
marcus Posted May 23, 2010 Share Posted May 23, 2010 You could have something like: animals.php?animal=XX <?php $animal = mysql_real_escape_string($_GET['animal']); $sql = "SELECT * FROM `table` WHERE `animal`='".$animal."'"; $res = mysql_query($sql) or die(mysql_error()); // check if animal exists $row = mysql_fetch_assoc($res); ?> Link to comment https://forums.phpfreaks.com/topic/202663-article-help/#findComment-1062287 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.