Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Warning: mysqli_error() expects exactly 1 parameter, 0 given

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Warning: mysqli_error() expects exactly 1 parameter, 0 given

Postby Sunny » Mon Oct 28, 2013 11:52 pm

Hi

Below code gives me this message "Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\xampp\htdocs\Projects\process.php on line 20" . It is not saving record

<?php
require'db_con.php';

$fname = trim($_POST['fname']); // trim remove white space
$email = trim($_POST['email']);
$password = trim($_POST['password']);
$phone = trim($_POST['phone']);
$birth = $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day'];
$gender = $_POST['gender'];

$sql="INSERT INTO `registeration` (`fname`, `email`, `password`, `phone', `dob`, `gender') VALUES ('$fname','$email','$password',$phone,'$dob','$gender');";
$retval = mysqli_query( $conn ,$sql);
mysqli_close($conn);
?>

Database Connection File is
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$db = 'test';
$conn = mysqli_connect($dbhost, $dbuser, $dbpass,$db);
if(! $conn )
{
die('Could not connect: ' . mysqli_error());
}
?>


Thanks
Sunny
New php-forum User
New php-forum User
 
Posts: 23
Joined: Wed Nov 30, 2011 6:51 am

Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron