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 Quote Link to comment 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); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.