burge124 Posted March 6, 2008 Share Posted March 6, 2008 hi i cant get this query to work any suggestions? $result3 = mysql_query("SELECT * FROM userattampt WHERE chapterid = WHERE UserID = 1017 ORDER BY QuestionID"); Link to comment https://forums.phpfreaks.com/topic/94614-query-question/ Share on other sites More sharing options...
darkfreaks Posted March 6, 2008 Share Posted March 6, 2008 for one you did not define your chapter id its empty Link to comment https://forums.phpfreaks.com/topic/94614-query-question/#findComment-484470 Share on other sites More sharing options...
burge124 Posted March 6, 2008 Author Share Posted March 6, 2008 sorry its missing a 1 $result3 = mysql_query("SELECT * FROM userattampt WHERE chapterid = 1 WHERE UserID = 1017 ORDER BY QuestionID"); Link to comment https://forums.phpfreaks.com/topic/94614-query-question/#findComment-484471 Share on other sites More sharing options...
darkfreaks Posted March 6, 2008 Share Posted March 6, 2008 <?php $qid=$_GET['QuestionID']; $result3 = mysql_query("SELECT * FROM userattampt WHERE chapterid ='1' AND UserID ='1017' ORDER BY $qid"); ?> Link to comment https://forums.phpfreaks.com/topic/94614-query-question/#findComment-484473 Share on other sites More sharing options...
burge124 Posted March 6, 2008 Author Share Posted March 6, 2008 no that didnt solve it, do i need a join or a "." in the query? Link to comment https://forums.phpfreaks.com/topic/94614-query-question/#findComment-484475 Share on other sites More sharing options...
darkfreaks Posted March 6, 2008 Share Posted March 6, 2008 no you dont look at the code again Link to comment https://forums.phpfreaks.com/topic/94614-query-question/#findComment-484476 Share on other sites More sharing options...
burge124 Posted March 6, 2008 Author Share Posted March 6, 2008 the query was fine sorry something else not happening oops Link to comment https://forums.phpfreaks.com/topic/94614-query-question/#findComment-484480 Share on other sites More sharing options...
darkfreaks Posted March 6, 2008 Share Posted March 6, 2008 add: <?php mysql_query ("SELECT * FROM userattampt WHERE chapterid ='1' AND UserID ='1017' ORDER BY $qid") or die(mysql_error());?> Link to comment https://forums.phpfreaks.com/topic/94614-query-question/#findComment-484481 Share on other sites More sharing options...
burge124 Posted March 6, 2008 Author Share Posted March 6, 2008 thanks for your help, from that query posted earlier im asking it to output times, although it keep cuming up with undefined index time & timecount any suggestions? (questiontitle works fine with a similar query) echo "<td>" . $row['TimeCount'] . "</td>"; echo "<td>" . $row['QuestionTitle'] . "</td>"; echo "<td>" . $row['Time'] . "</td>"; Link to comment https://forums.phpfreaks.com/topic/94614-query-question/#findComment-484486 Share on other sites More sharing options...
darkfreaks Posted March 6, 2008 Share Posted March 6, 2008 dont know so what does it output ??? Link to comment https://forums.phpfreaks.com/topic/94614-query-question/#findComment-484489 Share on other sites More sharing options...
burge124 Posted March 6, 2008 Author Share Posted March 6, 2008 it should list from the results of the query in the table userattempt all of the times a user with the id 1017 answering question in chapter 1 but at the moment its causing undefined indexes Link to comment https://forums.phpfreaks.com/topic/94614-query-question/#findComment-484494 Share on other sites More sharing options...
darkfreaks Posted March 6, 2008 Share Posted March 6, 2008 try putting ini_set('error_reporting',E_ALL); in your code Link to comment https://forums.phpfreaks.com/topic/94614-query-question/#findComment-484497 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.