Jump to content

dynamic drop down


Alfraganus

Recommended Posts

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 14

Warning: 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...