MySQL Forums
Forum List  »  PHP

Re: How to UPDATE?
Posted by: Jay Pipes
Date: June 22, 2005 08:21PM

Use mysql_error() to find out what's up with your connection:

if (!$con=mysql_connect("localhost","root","")) {echo mysql_error();}
else {
if (!mysql_select_db($db,$con)) {echo mysql_error();}
else {

$id_projek=$_POST['id_projek'];
$homepage=$_POST['homepage'];
$project_name=$_POST['project_name'];
$desc=$_POST['desc'];
$day=$_POST['day'];
$month=$_POST['month'];
$year=$_POST['year'];
$status=$_POST['status'];
$email=$_POST['email'];


$q= "UPDATE $table SET id_projek='$id_projek', homepage='$homepage', project_name ='$project_name',desc ='$desc', day ='$day',month='$month', year ='$year', status ='$status', email ='$email' WHERE id_projek='$id_projek' ";

if (! $rslt=mysql_query($q)) {echo mysql_error();}
else {
$numrow=mysql_affected_rows();

if ($numrow>0)
{
echo "<script>alert('..::UPDATE RECORD::..');<//script>";
include 'list_projek.php';
}
else
{
echo "<script>alert('..::!FAILED TO UPDATE!::..');</script>";
include 'list_projek.php';
}

Sorry about the formatting of the code blocks...kind of tough to do properly on the MySQL forums...
}
}

Jay Pipes
Community Relations Manager, North America, MySQL Inc.

Got Cluster? http://www.mysql.com/cluster
Personal: http://jpipes.com

Options: ReplyQuote


Subject
Written By
Posted
June 20, 2005 09:15PM
June 21, 2005 02:50AM
June 22, 2005 07:09PM
Re: How to UPDATE?
June 22, 2005 08:21PM
June 22, 2005 08:41PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.