Alfraganus Posted April 12, 2016 Share Posted April 12, 2016 dear all, I am trying to make dynamic drop down menu but something is wront that I am geting following errors, can you have a look please: Warning: mysqli_query() expects parameter 1 to be mysqli, string given in C:\xampp\htdocs\as\inc\functions.php on line 14Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\xampp\htdocs\as\inc\functions.php on line 14 <?php $condb=mysqli_connect("localhost","root","","books") or trigger_error(mysqli_error()); function getLanguage() { global $database; global $condb; $sql="SELECT * FROM LANGUAGES ORDER BY NAME asc"; $rs=mysqli_query($sql,$condb) or die (mysqli_error()); ERROR LINE 14 $rows=mysqli_fetch_assoc($rs); $total_rows=mysqli_num_rows($rs); if ($total_rows>0) { echo "<select name =\"srch_language\" id=\"srch_language\"><br>"; echo "<option value =\"\">any language…</option>"; do { echo "<option value=\"".$rows['id']."\"> ".$rows['name']."</option><br>"; }while ($rows=mysqli_fetch_assoc($rs)); echo "</select>"; } mysqli_free_result($rs); } ?> Link to comment Share on other sites More sharing options...
justsomeguy Posted April 12, 2016 Share Posted April 12, 2016 According to the error messages, you have your parameters in the wrong order and you're missing a parameter on the second one. 1 Link to comment Share on other sites More sharing options...
Alfraganus Posted April 13, 2016 Author Share Posted April 13, 2016 any suggestions to re-order them correctly? Link to comment Share on other sites More sharing options...
Ingolme Posted April 13, 2016 Share Posted April 13, 2016 Just change the order of the parameters so that they match the order in the documentation: http://php.net/mysqli_query First you pass the connection object, second the query. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now