Need HELP with UPDATE & DELETE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all, 

Right now I'm trying to do a UPDATE and DELETE queries using the following 
code below: But i kept getting error 
"Undefined variable: tutor_id in /usr/local/apache/htdocs/tutor/edit.php on 
line .....
Didn't I defined my variable "$tutor_id"....I thought I have...
Anyone can help???
Thanks in advance =)

Below is a snip of my code :

-------------------------------------------------------------------------------
=======edit.php========
        
$dsn = "mysql://root:**********@localhost/tb1";
$db = DB::connect ($dsn);

   if (DB::isError ($db))
       die ($db->getMessage());

$action = $_GET["action"];

if($action == "delete")
{
$sql = mysql_query ("DELETE FROM tutor WHERE tutor_id='$tutor_id'");
}

if($action == "edit")
{
$sql = mysql_query ("SELECT * FROM tutor WHERE tutor_id 
='$tutor_id'");**************ERROR HERE!!*****************

$row = mysql_fetch_array($sql);

echo "<form name=\"edit_tutor\" method=\"post\" action=\"edit2.php\">";
echo "Tutor ID : ".$row['tutor_id']."<br>";
echo "<input type=\"hidden\" name=\"tutor_id\" value=\"".$row
['tutor_id']."\">";
echo "Name : <input name=\"tutor_name\" type=\"text\" value=\"".$row
['tutor_name']."\"><br>";
echo "Contact No : <input type=\"text\" name=\"tutor_contact\" value=\"".$row
['tutor_contact']."\"><br>";
echo "E-mail : <input type=\"text\" name=\"tutor_email\" value=\"".$row
['tutor_email']."\"><br>";
echo "Profile : <input type=\"text\" name=\"tutor_profile\" value=\"".$row
['tutor_profile']."\"><br>";
echo "<input type=\"submit\" name=\"Submit\" value=\"Update\">";
echo "</form>";

}
?>

$result = $db->query($sql);

if( DB::isError($result) ) {
    die ($result->getMessage());
}

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux