how are you getting the $tutor_id var?, in your script you are using "$action = 
$_GET["action"];" so you will need to define $tutor_id like $tutor_id = 
$_GET['tutor_id'], or just use $_GET['tutor_id'].

a form can only put variables in the POST array OR the GET array, and if your using 
hyperlinks to access this script then they will of course be GET vars. 

-----Original Message-----
Sent: 12 December 2003 09:38
Subject: [PHP-DB] Need help!!!


Anyone can help me with this script???I kept getting error saying i did not 
define the variable "$tutor_id" and whenever I define it as $tutor_id = $_POST
['tutor_id'], I got error saying there was an "Undefined index"!
What was exactly the problem??????
Need help desperately , greatly appreciate any suggestions/help/solutions 


$dsn = "mysql://root:[EMAIL PROTECTED]/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 
echo "Name : <input name=\"tutor_name\" type=\"text\" value=\"".$row 
echo "Contact No : <input type=\"text\" name=\"tutor_contact\" value=\"".$row 
echo "E-mail : <input type=\"text\" name=\"tutor_email\" value=\"".$row 
echo "Profile : <input type=\"text\" name=\"tutor_profile\" value=\"".$row 
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 (
To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to