dadamssg Posted May 26, 2009 Share Posted May 26, 2009 i just made a table to store attendance of people for an event the table only is empty now and has three fields... 'eventid' int(11), 'username' varchar(20), 'choice' tinyint(1) so now that ive created the table im trying to write a query that checks to see if user has inputted a choice(yes or no) for an event. heres my code $cxn = mysqli_connect($host,$user,$passwd,$dbname) or die ("Couldn't connect"); $postid = $_GET["id"]; $username = $_SESSION['logname']; $comquery = "SELECT * FROM test WHERE eventid = $postid AND username = $username"; $together = mysqli_query ($cxn,$comquery) or die (mysqli_error($together)); i get this error Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in /home/inaggie1/public_html/showevent.php on line 42 i can NOT see what im doing wrong Quote Link to comment https://forums.phpfreaks.com/topic/159785-solved-problem-with-query/ Share on other sites More sharing options...
lonewolf217 Posted May 26, 2009 Share Posted May 26, 2009 not sure if its the root of the problem or not, but I do not think you need $together in the error statement. just use mysqli_error() and do you get the same error ? Quote Link to comment https://forums.phpfreaks.com/topic/159785-solved-problem-with-query/#findComment-842755 Share on other sites More sharing options...
dadamssg Posted May 27, 2009 Author Share Posted May 27, 2009 hmmm im not real sure what i did...i just retyped and renamed the variables and eventually it worked :-\ Quote Link to comment https://forums.phpfreaks.com/topic/159785-solved-problem-with-query/#findComment-842787 Share on other sites More sharing options...
corbin Posted May 27, 2009 Share Posted May 27, 2009 mysqli_error takes a link as an argument, not a query resource. (When ever a query fails, FALSE is returned.) So, $cxn should be used. Quote Link to comment https://forums.phpfreaks.com/topic/159785-solved-problem-with-query/#findComment-842792 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.