patelp7 Posted March 9, 2007 Share Posted March 9, 2007 I want to list the subjects names which link to the whole bulletin, but am having trouble. while ($numofsubs = mysql_fetch_array($result)) { echo ('<td align=left><a href="viewspecificbull.php?id=' . $numofsubs['Subject'] . '"></a></td></br>'); } please help Link to comment https://forums.phpfreaks.com/topic/41992-solved-list-subjects-that-are-links/ Share on other sites More sharing options...
redarrow Posted March 9, 2007 Share Posted March 9, 2007 lets exsplain this properly ok . <?php //database connection $db=mysql_connect("localhost","username","password"); mysql_select_db("database_name",$db); //select statement example ok all book entry's lol. $query1="select * from books "; $result=mysql_query(query1); //while loop to get all the books while($record=myslq_fetch_assoc($result)){ // echo book information ok title price and a link to see that book information. echo" ".$record['book_title']," <br> ".$record['price']." <br> <a href='read_more.php?id=".$record['id']."'>More Info</a><br><br>"; } ?> Now where going to a page read_more.php to view the book information and use the id what is in the link to get the book full information. read_more.php <?php // database connection $db=mysql_connect("localhost","username","password"); mysql_select_db("database_name",$db); //select statement that gets the books from the id in the url. $query1="select * from books where id=".$_GET[ 'id']." "; $result=mysql_query($query1); //read that book we just selected. while($rec=myslq_fetch_assoc($result)){ // echo book information that was selected. echo" ".$rec['book_title']." <br> ".$rec['price']." <br> ".$rec['date_book_was_made']."<br>".$rec['book_description']." <br>"; } ?> now you can see the book that the user selected from a url in the url we use a varable what was the id of the book then we went to a page and looked at the book that was selected from the link. That it ok. Link to comment https://forums.phpfreaks.com/topic/41992-solved-list-subjects-that-are-links/#findComment-203605 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.