computermax2328 Posted October 4, 2012 Share Posted October 4, 2012 Take a look at this really quick. I am not getting anything out of this query. All I am doing is echoing description which is saved as a text in a phpmyadmin database. 'table' is coming from the URL. The variable $table is working in other queries. $table = $_GET['table']; $issues = "SELECT * FROM issues WHERE table='$table'"; $isquery = mysql_query($issues, $connection); while ($row = mysql_fetch_array($isquery)) { $desc = $row['description']; } Thanks, Quote Link to comment Share on other sites More sharing options...
Christian F. Posted October 4, 2012 Share Posted October 4, 2012 var_dump ($_GET); Also, you really need to validate input and escape your output. This script is wide open for any kind of attack, SQL and HTML (XSS) injection both. Quote Link to comment Share on other sites More sharing options...
Barand Posted October 4, 2012 Share Posted October 4, 2012 while ($row = mysql_fetch_array($isquery)) { $desc = $row['description']; } that doesn't echo anything! Quote Link to comment Share on other sites More sharing options...
computermax2328 Posted October 5, 2012 Author Share Posted October 5, 2012 I echo it somewhere else. echo $desc; Quote Link to comment Share on other sites More sharing options...
nodirtyrockstar Posted October 5, 2012 Share Posted October 5, 2012 (edited) Your variable ('$table') is in quotes. I don't know if that matters since I can't see the rest of your script. Also, have you tried plugging the query directly into MySQL? It helps to start with a good query, and then troubleshoot the PHP. Edited October 5, 2012 by nodirtyrockstar Quote Link to comment Share on other sites More sharing options...
Jessica Posted October 5, 2012 Share Posted October 5, 2012 You should always post your actual code, and the entire relevant part. Of course we're going to point out you don't echo it. If you're echo'ing it outside of the loop, that's probably a big part of the problem. Quote Link to comment Share on other sites More sharing options...
computermax2328 Posted October 5, 2012 Author Share Posted October 5, 2012 Echoing inside the loop did not work. I echo outside the loop all the time and it works fine. I did the var_dumb and it can back null. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 5, 2012 Share Posted October 5, 2012 If it won't echo inside the loop, and it won't echo outside the loop, what would that tell you? Maybe that the query isn't returning any results? Quote Link to comment Share on other sites More sharing options...
Christian F. Posted October 5, 2012 Share Posted October 5, 2012 ...I did the var_dumb and it can back null. That means you're not sending any data to the page in the URL, which causes PHP to query for data where table = ''. Quote Link to comment Share on other sites More sharing options...
White_Lily Posted October 5, 2012 Share Posted October 5, 2012 If the table is being found in the database try echoing the rows: $num = mysql_num_rows($issues); echo $num; If it echos nothing (not even a 0) then your query is probably the problem, if it echos '0' then its saying you have no entries, anything higher and the problem is elsewhere. Quote Link to comment Share on other sites More sharing options...
computermax2328 Posted October 5, 2012 Author Share Posted October 5, 2012 Alright, so I did some tests, var_dumb, num_rows and some !if statements, and I found that the query is what is incorrect. The $_GET variable is coming down, but the query is not working. It stops at the fetch_array. Quote Link to comment Share on other sites More sharing options...
Christian F. Posted October 5, 2012 Share Posted October 5, 2012 (edited) Then this is solved, or..? PS: It's "var_dump", not "b". Edited October 5, 2012 by Christian F. Quote Link to comment Share on other sites More sharing options...
computermax2328 Posted October 5, 2012 Author Share Posted October 5, 2012 Yeah that was a typo. I solved it. I will mark it so 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.