doucie Posted December 29, 2006 Share Posted December 29, 2006 OK this is my (very basic I know) code for getting a record from the database via a link from the previous page. The query_number is passed through the URL OK. The URL looks like this - http://localhost/Query%20System/query_details.php?=query_number=6However, the table header displays OK but the result of the query does not. HELP!$result=mysql_query("SELECT * FROM query WHERE query_number='" . $_GET['query_number'] ."'");echo "<table width=\"100%\" border=\"1\" align=\"center\" bordercolor=\"#000099\" cellspacing=\"0\" cellpadding=\"5\" <tr><td>Query Number</td><td>Query Type</td><td>Status</td><td>Client</td><td>Client Ref</td><td>DebtRef</td><td>Date/Time Entered</td><td>User</td><td>Notes</td></tr> ";while ($row=mysql_fetch_array($result)){$query_number=$row['query_number'];$query_type=$row['query_type'];$query_status=$row['query_status'];$client=$row['client'];$client_ref=$row['client_ref'];$debt_ref=$row['debt_ref'];$query_date=$row['query_date'];$user=$row['user'];echo "<tr><td>$query_number</td>";echo "<td>$query_type</td>";echo "<td>$query_status</td>";echo "<td>$client</td>";echo "<td>$client_ref</td>";echo "<td>$debt_ref</td>";echo "<td>$query_date</td>";echo "<td>$user</td>";}echo "</table>";?> Link to comment https://forums.phpfreaks.com/topic/32203-problem-with-_get-in-query/ Share on other sites More sharing options...
kenrbnsn Posted December 29, 2006 Share Posted December 29, 2006 Replace this line:[code]<?php$result=mysql_query("SELECT * FROM query WHERE query_number='" . $_GET['query_number'] ."'");?>[/code]with[code]<?php$query = "SELECT * FROM query WHERE query_number='" . $_GET['query_number'] ."'";$result=mysql_query($query) or die("There was a problem with the query: $query<br>" . $mysql_error());?>[/code]If you are getting any errors mysql errors this will show them to you.The other option is that there might be no data returned from the query.Ken Link to comment https://forums.phpfreaks.com/topic/32203-problem-with-_get-in-query/#findComment-149475 Share on other sites More sharing options...
doucie Posted December 29, 2006 Author Share Posted December 29, 2006 Cheers for that. There were no errors. Any ideas why there would be nothing returned from the query? Link to comment https://forums.phpfreaks.com/topic/32203-problem-with-_get-in-query/#findComment-149505 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.