Lambneck Posted April 21, 2008 Share Posted April 21, 2008 Hello, I have a php code that displays a list of links. when a link is chosen it is to display data from mysql database based on the "submission_id" specified by the link chosen. This data would then be displayed on a new "display.php" page. My question is how do i code the display.php page in order for it to recognize the submission_id being specified by the link chosen. the code of the initial page: $result = mysql_query("SELECT submission_id, col_4 FROM $table ORDER BY submission_date DESC"); if (!$result) { die("Query to show fields from table failed:".mysql_error()); } while($row = mysql_fetch_array($result)) { echo '<a href="Display.php?id='.$row['submission_id'].'">'.$row['col_4'].'</a>'; echo "<br />"; } mysql_free_result($result); Link to comment https://forums.phpfreaks.com/topic/102172-solved-recognize-pass/ Share on other sites More sharing options...
dezkit Posted April 21, 2008 Share Posted April 21, 2008 $result = mysql_query("SELECT submission_id, col_4 FROM $table ORDER BY submission_date DESC"); if (!$result) { die("Query to show fields from table failed:".mysql_error()); } while($row = mysql_fetch_array($result)) { echo "<a href="Display.php?id=\".$row['submission_id'].'\">'.$row['col_4'].'</a>"; echo "<br />"; } mysql_free_result($result); I didn't read what you wrote, but i found a mistake. `,=, Link to comment https://forums.phpfreaks.com/topic/102172-solved-recognize-pass/#findComment-522980 Share on other sites More sharing options...
Lambneck Posted April 21, 2008 Author Share Posted April 21, 2008 hello, I appreciate the attempted help, but I'd appreciate it a lot more if I could get an answer to the question originally asked instead of a wrong answer to an imagined question Link to comment https://forums.phpfreaks.com/topic/102172-solved-recognize-pass/#findComment-523074 Share on other sites More sharing options...
DarkWater Posted April 21, 2008 Share Posted April 21, 2008 Lol, Lambneck is right, your answer was wrong. And just do $_GET['submission_id'] on the next page to get the submission ID. =D Link to comment https://forums.phpfreaks.com/topic/102172-solved-recognize-pass/#findComment-523081 Share on other sites More sharing options...
Lambneck Posted April 21, 2008 Author Share Posted April 21, 2008 thanks, I'm working with the following code as of now, but something isn't right cause it doesn't display. $id = (int) $_GET['id']; // since the submission ID is named "id" in the query string! $sql = "SELECT * FROM $table WHERE submission_id=$id"; $result = mysql_query($sql) or die("Error ". mysql_error(). " with query ". $sql); if(mysql_num_rows($result) == 1){ $row = mysql_fetch_assoc($sql); //print out information }else{ echo 'That record ID does not exist!'; } ?> Link to comment https://forums.phpfreaks.com/topic/102172-solved-recognize-pass/#findComment-523264 Share on other sites More sharing options...
Lambneck Posted April 21, 2008 Author Share Posted April 21, 2008 ok it recognizes the pass; the submission id number is in the url but on the page none of the data is displayed. ??? anyone see anything wrong? $id = (int) $_GET['id']; // since the submission ID is named "id" in the query string! $sql = "SELECT * FROM $table WHERE submission_id=$id"; $result = mysql_query($sql) or die("Error ". mysql_error(). " with query ". $sql); if(mysql_num_rows($result) == 1){ $row = mysql_fetch_assoc($sql); //print out information }else{ echo 'That record ID does not exist!'; } ?> Link to comment https://forums.phpfreaks.com/topic/102172-solved-recognize-pass/#findComment-523295 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.