•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,189 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,731 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 605 | Replies: 5 | Solved
![]() |
•
•
Join Date: Nov 2007
Posts: 181
Reputation:
Rep Power: 1
Solved Threads: 5
hi
i want to know whether my coding is correct because data is not getting inserted in my sql table,but it is displaying the "data inserted" message<html>
<head></head>
<body>
<?php
$uname1= $_POST['uname1'];
$cname=$_POST['cname'];
$caddr=$_POST['caddr'];
$mid=$_POST['mid'];
$skills=$_POST['skills'];
$degree=$_POST['degree'];
$indtype=$_POST['indtype'];
$desc=$_POST['desc'];
$req=$_POST['req'];
$yoe=$_POST['yoe'];
$sal2=$_POST['sal2'];
$search=$_POST['search'];
$hostname = "localhost";
$username = "uname";
$password = "godcares";
$dbid = "splendor_samp";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");
if (isset($_REQUEST["Submit"]))
{
mysql_query("INSERT INTO postreq(uname,cname,caddr,mailid,skills,degree,indtype,desc,req,yoe,sal,searchdate)VALUES('$uname1','$cname','$caddr','$mid','$skills','$degree','$indtype','$desc','$req','$yoe','$sal2','$search')");
echo "data inserted";
}
else
{
echo "ERROR: ".mysql_error();
}
mysql_close($link);
?>
</body>
</html>
i want to know whether my coding is correct because data is not getting inserted in my sql table,but it is displaying the "data inserted" message<html>
<head></head>
<body>
<?php
$uname1= $_POST['uname1'];
$cname=$_POST['cname'];
$caddr=$_POST['caddr'];
$mid=$_POST['mid'];
$skills=$_POST['skills'];
$degree=$_POST['degree'];
$indtype=$_POST['indtype'];
$desc=$_POST['desc'];
$req=$_POST['req'];
$yoe=$_POST['yoe'];
$sal2=$_POST['sal2'];
$search=$_POST['search'];
$hostname = "localhost";
$username = "uname";
$password = "godcares";
$dbid = "splendor_samp";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");
if (isset($_REQUEST["Submit"]))
{
mysql_query("INSERT INTO postreq(uname,cname,caddr,mailid,skills,degree,indtype,desc,req,yoe,sal,searchdate)VALUES('$uname1','$cname','$caddr','$mid','$skills','$degree','$indtype','$desc','$req','$yoe','$sal2','$search')");
echo "data inserted";
}
else
{
echo "ERROR: ".mysql_error();
}
mysql_close($link);
?>
</body>
</html>
•
•
Join Date: Aug 2007
Location: Cavite,Philippines
Posts: 503
Reputation:
Rep Power: 3
Solved Threads: 67
try changing this one:
with this one:
if (isset($_REQUEST["Submit"])) with this one:
if ($_POST('Submit'))
"death is the cure of all diseases..."
http://ryantetek.wordpress.com
http://ryantetek.wordpress.com
•
•
Join Date: Aug 2007
Location: Cavite,Philippines
Posts: 503
Reputation:
Rep Power: 3
Solved Threads: 67
Have you tried running your query in MySql?I think the problem there is the query itself,e.g. wrong fields,wrong field type,etc.for example your searchdate is supposed to be a date therefore you must enter a date.Try to check on this one.
"death is the cure of all diseases..."
http://ryantetek.wordpress.com
http://ryantetek.wordpress.com
•
•
Join Date: Aug 2007
Location: Cavite,Philippines
Posts: 503
Reputation:
Rep Power: 3
Solved Threads: 67
ok,please mark your thread as solved!
"death is the cure of all diseases..."
http://ryantetek.wordpress.com
http://ryantetek.wordpress.com
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Similar Threads
- Inserting date in format DD-MM-YYYY in MySQL (MySQL)
- mock credit card with mysql & filewriter INSERT into mysql (Java)
- php and mysql insert...where making me tear my hairs out!!! help!!! (PHP)
- insert csv file into mysql through php (PHP)
- insert values to mysql database (JSP)
- Help With Messages in Mysql Stop Overwriting (MySQL)
- Blon insert in MySQL using ODBC in C# win Application (C#)
- need help with iptable and mySQL server (Linux Servers and Apache)
- Desperate! mysql and phpmyadmin (MySQL)
Other Threads in the PHP Forum
- Previous Thread: infinite loop
- Next Thread: php and pdf?


Linear Mode