Solarpitch Posted December 17, 2006 Share Posted December 17, 2006 Hey Guys,Here's my code..[code] $sql = "SELECT COUNT(*) as Num FROM adds2 WHERE class = 'Drivers' AND 'validation' = 1)"; $res = mysqli_query($mysql_connect, $sql) or die (mysqli_error()); $r=mysqli_fetch_assoc($res); $tot = $r['Num'];[/code]and here's my error..[code]Warning: mysqli_error() expects exactly 1 parameter, 0 given in c:\webs\golftrader\retrieve_database.php on line 86[/code]I'd love some help to try and spot the problem, cant figure it out and its something simple . . I know it! Quote Link to comment https://forums.phpfreaks.com/topic/30977-help-needed-with-a-mysqli_error-expecting-a-parameter/ Share on other sites More sharing options...
wildteen88 Posted December 17, 2006 Share Posted December 17, 2006 mysqli_error requirest the link identifierThe identifier is the variable that holds the connection when you connected to mysql.I am guessing $mysql_connect is the variable that holds the identifier. SO use this instread:[code=php:0]$res = mysqli_query($mysql_connect, $sql) or die (mysqli_error($mysql_connect));[/code] Quote Link to comment https://forums.phpfreaks.com/topic/30977-help-needed-with-a-mysqli_error-expecting-a-parameter/#findComment-142949 Share on other sites More sharing options...
paul2463 Posted December 17, 2006 Share Posted December 17, 2006 not knowing a lot about mysqli I had a look around and the error sounds to me that it does not recognise anything you have put into the mysqli_query() function.looking at your code:-in line one - you have a closing brace at the end without a corresponding opening one - that could explain why it does not recognise that line in line two - you pass $mysql_connect to the function, does this exist as the connection statement in your code?? such as[code]<?php$connection = mysql_connect('localhost', 'paul', 'password');?>[/code]then pass it to your function such as[code]<?php$res = mysqli_query($connection, $sql) or die (mysqli_error());?>[/code]Paul Quote Link to comment https://forums.phpfreaks.com/topic/30977-help-needed-with-a-mysqli_error-expecting-a-parameter/#findComment-142951 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.