我是一个新手 php 程序员。我有这个 actionfrm.php,当它运行时我得到这个消息:
UPDATE personal
SET membername='test this',
sponsorid='102',
dateofjoining='2012-07-23',
address='13432 main',
city='pomona',
state='CA',
country='USA',
mobileno='8187321592',
countrycode='1',
dateofbirth='1988/05/03',
emailid='tlhkapil@gmail.com'
WHERE membername='test this'
update query succeeded
但是,它没有写入数据库。我把这段代码放入 phpmyadmin 并得到了这个消息:0 行受到影响。
这是代码:
<?php include('dbconnect.php'); ?>
<?php
$membername=$_POST['membername'];
if(isset($_POST['username']) and $_POST['username']!=""){
$sponsorid=$_SESSION['memberid_for_sp'];
}else{
$sponsorid=0;
}
$dateofjoining=date("Y-m-d");;
$address=$_POST['address'];
$city=$_POST['city'];
$state=$_POST['state'];
$country=$_POST['country'];
$mobileno=$_POST['mobileno'];
$countrycode=$_POST['countrycode'];
$dateofbirth=$_POST['dateofbirth'];
$emailid=$_POST['emailid'];
$myid=$_SESSION['memberid'];
$query = "UPDATE personal SET membername='$membername',
sponsorid='$sponsorid',
dateofjoining='$dateofjoining',
address='$address',
city='$city',
state='$state',
country='$country',
mobileno='$mobileno',
countrycode='$countrycode',
dateofbirth='$dateofbirth', emailid='$emailid' WHERE membername='$membername'";
echo $query;
$checkresult = mysql_query($query);
if ($checkresult) echo 'update query succeeded';
else echo 'update query failed';
mysql_close();
//return $frmdetail.php;
?>
请帮忙,我真的需要纠正这个......我对此感到头疼。