# mysqli\_error() expects exactly 1 parameter

**URL:** <https://www.phphelp.com/t/mysqli-error-expects-exactly-1-parameter/10916>\
**Category:** General PHP Help\
**Created:** [February 20, 2008, 12:19am UTC](https://www.phphelp.com/t/mysqli-error-expects-exactly-1-parameter/10916 "2008-02-20T00:19:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chaking](https://www.phphelp.com/letter_avatar_proxy/v4/letter/c/dfb087/32.png) [@chaking](https://www.phphelp.com/u/chaking)\
**Post date:** [February 20, 2008, 12:19am UTC](https://www.phphelp.com/t/mysqli-error-expects-exactly-1-parameter/10916/1 "2008-02-20T00:19:45Z")

</div>

Hey guys - very new to writing php, but trying…

Here’s the code I got:

```auto
<?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!

---

<div class="post-metadata">

**Author:** ![Zyppora](https://www.phphelp.com/letter_avatar_proxy/v4/letter/z/76d3ee/32.png) [@Zyppora](https://www.phphelp.com/u/Zyppora)\
**Post date:** [February 20, 2008, 10:34am UTC](https://www.phphelp.com/t/mysqli-error-expects-exactly-1-parameter/10916/2 "2008-02-20T10:34:05Z")

</div>

mysqli\_error() wants a parameter, namely the MySQLi connection handle.
