<?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);
?>
John_74
0
Newbie Poster
Recommended Answers
Jump to PostIt's $con first. So where you have $sql, $con etc, change it to $con, $sql
Jump to PostThe error literally told you what you needed to do.
Jump to PostHere 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", …
Jump to Post@Luzinete
Hi,
please, open a new thread with the error message and the code that generates that error.
Jump to PostPlease start a new discussion and post your code too.
All 19 Replies
John_74
0
Newbie Poster
John_74
0
Newbie Poster
John_74
0
Newbie Poster
matrixdevuk
71
6t9.me Founder
matrixdevuk
71
6t9.me Founder
John_74
0
Newbie Poster
veedeoo
474
Junior Poster
Featured Poster
matrixdevuk
71
6t9.me Founder
John_74
0
Newbie Poster
matrixdevuk
71
6t9.me Founder
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
Alexandre_1
0
Newbie Poster
sowmyark
0
Newbie Poster
sowmyark
0
Newbie Poster
Luzinete
0
Newbie Poster
cereal
1,524
Nearly a Senior Poster
Featured Poster
tolosa
0
Newbie Poster
tolosa
0
Newbie Poster
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
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.