Hey guys - very new to writing php, but trying…
Here’s the code I got:
<?php
$bldg_current = $_GET['bldg'];
$cxn = mysqli_connect($host, $user, $passwd, $dbname) or die(mysqli_error());
$facilitycode = "SELECT * FROM 'facilities' WHERE 'facility_code' = '$bldg_current'";
$result_facilitycode = mysqli_query($cxn, $facilitycode) or die(mysqli_error());
$array_facilitycode = mysqli_fetch_assoc($result_facilitycode);
if ( empty($array_facilitycode) )
{
die("nothing found in the database");
}
else {
extract($array_facilitycode);
}
?>
[ul]I pass the variable through the url and use _GET to grab it and put it in the variable $bldg_current.
Then I use the value from $bldg_current to grab the row that has the value of $bldg_current in the “facility_code” column of the table “facilities”.
I run the query and pass the value to $result_facilitycode.
Then I put the result into an array and finally extract it so that I may use the column names as the actual variables.[/ul]
Well I get this error: Warning: mysqli_error() expects exactly 1 parameter, 0 given
And it references this line: $result_facilitycode = mysqli_query($cxn, $facilitycode) or die(mysqli_error());
Any help would be appreciated - thanks!