Page 1 of 1

getting null value from DB event though it's there

Posted: Thu Feb 03, 2011 1:28 pm
by someguyhere
The code below gives me the following error: Warning: mysqli_error() expects exactly 1 parameter, 0 given in /home/efarrell/public_html/wp-content/plugins/wp-members-pages/members_page.php on line 46

Code: Select all

		$mysqli = new mysqli("localhost", "db", "pw", "user");
			$query = "SELECT * FROM wp_network_members WHERE f_name = $member[0] AND l_name = $member[1]";
			$result = mysqli_query($mysqli, $query) or die(mysqli_error());
			$member_data = mysqli_fetch_row($result);
The value for $member is Array ( [0] => Liz [1] => Barlowe ) and there is a row in the DB with the correct first and last name in the correct fields.

Any idea what is wrong here?

Re: getting null value from DB event though it's there

Posted: Thu Feb 03, 2011 1:35 pm
by someguyhere
solved:

Code: Select all

			$query = "SELECT * FROM wp_network_members WHERE f_name = '$member[0]' AND l_name = '$member[1]'";

Re: getting null value from DB event though it's there

Posted: Fri Feb 04, 2011 3:00 am
by Darhazer
It have to be

Code: Select all

$result = mysqli_query($mysqli, $query) or die(mysqli_error($mysqli));
this will help you with the debugging next time :)