hi,
i'm pretty new to the PHP...
I have a form which takes user's name and then, run a query to see if their names exist in the database. but i keep getting the following error when i try to run it:
Fatal error: Call to undefined function mysqli_num_row() in /var/www/wedding/rsvp.php on line 13
the web server is running on UNIX. I dont' know what more information is needed....
the code is:
<?php
$mysqli = mysqli_connect("localhost", "user", "password", "database");
/* check connection */
if (!$mysqli) {
die ('could not connect: ' . mysql_error());
}
else {
printf("name to find is " .$_POST["name"]."<br />");
$namesearch_sql="SELECT * FROM tbl_guests WHERE guest_name = '".$_POST['name']."'";
$namesearch_res=mysqli_query($mysqli, $namesearch_sql) or die(mysqli_error($mysqli));
if (mysqli_num_row($namesearch_res) < 1) {
printf("no name");
}
else {
while ($new = mysqli_fetch_array($namesearch_res)) {
$newname=$new['guest_name'];
printf("name: ".$newname);
}
}
/* close connection */
mysqli_close($mysqli);
}
?>
i'm pretty new to the PHP...
I have a form which takes user's name and then, run a query to see if their names exist in the database. but i keep getting the following error when i try to run it:
Fatal error: Call to undefined function mysqli_num_row() in /var/www/wedding/rsvp.php on line 13
the web server is running on UNIX. I dont' know what more information is needed....
the code is:
<?php
$mysqli = mysqli_connect("localhost", "user", "password", "database");
/* check connection */
if (!$mysqli) {
die ('could not connect: ' . mysql_error());
}
else {
printf("name to find is " .$_POST["name"]."<br />");
$namesearch_sql="SELECT * FROM tbl_guests WHERE guest_name = '".$_POST['name']."'";
$namesearch_res=mysqli_query($mysqli, $namesearch_sql) or die(mysqli_error($mysqli));
if (mysqli_num_row($namesearch_res) < 1) {
printf("no name");
}
else {
while ($new = mysqli_fetch_array($namesearch_res)) {
$newname=$new['guest_name'];
printf("name: ".$newname);
}
}
/* close connection */
mysqli_close($mysqli);
}
?>