<?php
$con = mysqli_connect("localhost","root","","register");
if (!$con)
  {
  die(' connection error: ' . mysql_error());
  }
  $name=$_POST['name'];
  $fname=$_POST['fname'];
  $dob=$_POST['dob'];
  $address=$_POST['address'];
  $ph_no=$_POST['ph_no'];
  $email=$_POST['email'];
  $zip=$_POST['zip'];
  $phd_marks=$_POST['phd_marks'];
  $ph_out=$_POST['ph_out'];
  $ph_study=$_POST['ph_study'];
  $ms_marks=$_POST['ms_marks'];
  $ms_out=$_POST['ms_out'];
  $ms_study=$_POST['ms_study'];
  $ma_marks=$_POST['ma_marks'];
  $ma_out=$_POST['ma_out'];
  $ma_study=$_POST['ma_study'];
  $ba_marks=$_POST['ba_marks'];
  $ba_out=$_POST['ba_out'];
  $ba_study=$_POST['ba_study'];
  $fa_marks=$_POST['fa_marks'];
  $fa_out=$_POST['fa_out'];
  $fa_study=$_POST['fa_study'];
  $matric=$_POST['matric'];
  $matric_out=$_POST['matric_out'];
  $matric_study=$_POST['matric_study'];
  $exp=$_POST['exp'];
  $experience=$_POST['experience'];
mysqli_select_db("register", $con);
$sql="INSERT INTO cv (name, fname, dob, address, ph_no, email, zip, , phd_marks, ph_out, ph_study, ms_marks, ms_out, ms_study, ma_marks, ma_out, ma_study, ba_marks, ba_out, ba_study, fa_marks, fa_out, fa_study, matric, matric_out, matric_study,exp, experience)
VALUES
('$name','$fname','$dob','$address','$ph_no','$email','$zip','$phd_marks','$ph_out','$ph_study','$ms_marks','$ms_out','$ms_study','$ma_marks','$ma_out','$ma_study','$ba_marks','$ba_out','$ba_study','$fa_marks','$fa_out','$fa_study','$matric','$matric_out','$matric_study','$exp','$experience')";
if (!mysqli_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "data successfully added";
mysql_close($con);
?>

Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in C:\wamp\www\new\cvinsert.php on line 34
Warning: mysqli_query() expects parameter 1 to be mysqli, string given in C:\wamp\www\new\cvinsert.php on line 38
Error:

these are the error comming in my code

please will anybody help me

It's $con first. So where you have $sql, $con etc, change it to $con, $sql

The error literally told you what you needed to do.

have changed but it just came
Error:

Here are your problems.

connection

$con = mysqli_connect("localhost","root","","register");

Second, the mysqli_select_db...

mysqli_select_db("register", $con);

If you want to use the mysqli_select_db, then connection syntax should be like this.

$con = mysqli_connect("localhost","root","");

then we can use

mysqli_select_db("register", $con);

In mysqli , the error reporting should be written like this. Waring! this is for the development environment only..

 $con = mysqli_connect("localhost","root","");

    if (mysqli_connect_errno()){

      echo "Failed to connect to MySQL: " . mysqli_connect_error();

   }

    ## add the rest below

you need to use prepared statements and bind parameters.

@veedeoo — The errors he has indicated to me that he needs $con, "register"

ok thanks everybody, the problem solved

John — mark it as solved.

Apart from your error, you are mixing mysql and mysqli functions. Don't do that.

 <?php 
     if(isset($_POST['submit']))
     {
     $val="INSERT INTO business(company_name,email,website,phone,line_of_business,key_customers,job_title,com_purchase,buying_decision,where_looking_for,often_purchase,how_long_buying_decision,typical_budget,features_while_purchasing,benefits_while_purchase,problems_motivates_purchase,neads_while_purchasing,fildate,filtime)
VALUES
('".addslashes($_POST['company_name'])."','".addslashes($_POST['email'])."','".addslashes($_POST['website'])."','".addslashes($_POST['phone'])."','".addslashes($_POST['line_of_business'])."','".addslashes($_POST['key_customers'])."','".addslashes($_POST['job_title'])."','".addslashes($_POST['com_purchase'])."','".addslashes($_POST['buying_decision'])."','".addslashes($_POST['where_looking_for'])."','".addslashes($_POST['often_purchase'])."','".addslashes($_POST['how_long_buying_decision'])."','".addslashes($_POST['typical_budget'])."','".addslashes($_POST['features_while_purchasing'])."','".addslashes($_POST['benefits_while_purchase'])."','".addslashes($_POST['problems_motivates_purchase'])."','".addslashes($_POST['neads_while_purchasing'])."',now(),now())"; 

     if (!mysqli_query($db,$val))
  {
  die('Error: ' . mysqli_error($db,$val));
  }
echo "<blink style='font-size:18px; color:#00aeef; text-decoration:blink;'> Thank you for filling the form. Our team will contact you within 24 hours of time<br><br></blink>";
    exit(); 
    } 
     ?>

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home/benefits/public_html/business.php on line 135

Warning: mysqli_error() expects exactly 1 parameter, 2 given in /home/benefits/public_html/business.php on line 137
Error:

Good Morning,

I've wasted a lot of time on the subject, but the time is short for delivery of a college job.
It may be that I do not know how to use the correct terms to get help.
I need this urgent help. Help me please.

I have the client registry, with some fields, but I need to get information from the profession table and save in the clients table. Making a select in the combobox where it is showing the professions.

I have the connection file.php working perfectly. And also the file form-client.php and form-process.php
If you need, I can send to identify the error.
Because I can not make the select of the field proffession (tb_profession) inside the form-client.

Tb_client (cli_id, cli_name, cli_phone, pro.session_id)

Tb_profession (pro_profession, pro_profession)

Mysql database

Att,

I will be very grateful.

Luzinete

@Luzinete

Hi,

please, open a new thread with the error message and the code that generates that error.

Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in C:\xampp\htdocs\a\IBSCIMS\db.php on line 11

Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in C:\xampp\htdocs\a\IBSCIMS\db.php on line 11

Please start a new discussion and post your code too.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.