$con = mysqli_connect("localhost","root","","register");
if (!$con)
  die(' connection error: ' . mysql_error());
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)
if (!mysqli_query($sql,$con))
  die('Error: ' . mysql_error());
echo "data successfully added";

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

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

Here are your problems.


$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

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

     $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)

     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>";

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

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


I will be very grateful.




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