Jump to content

MySQL UPDATE problem ???


plodos

Recommended Posts

.sql

CREATE TABLE department (
   dept_id INT NOT NULL,
   dept_name TEXT,
   PRIMARY KEY (dept_id)
);

DROP TABLE IF EXISTS proficiency;

CREATE TABLE proficiency (
   p_id INT NOT NULL, 
   p_name TEXT NOT NULL,
   PRIMARY KEY (p_id)
);

DROP TABLE IF EXISTS doctor;

CREATE TABLE doctor (
   d_id INT NOT NULL PRIMARY KEY,
   d_name varchar(50) NOT NULL,
   d_surname VARCHAR(50) NOT NULL,
   d_add TEXT NOT NULL,
   SSN INT(4) NOT NULL, 
   d_tel INT(4) NOT NULL,
   d_bdate DATETIME NOT NULL,  # 2003-03-31 11:22:12
   p_id INT NOT NULL,          
   dept_id INT NOT NULL,
   password VARCHAR(50) NOT NULL,
   FOREIGN KEY (dept_id) REFERENCES department (dept_id),
   FOREIGN KEY (p_id) REFERENCES proficiency (p_id)    
);

 

I want to update the doctor information, like proficiency or password

trick point is multiple querys :)

this is my query...whats wrong...

$_u ="UPDATE doctor dr, proficiency p, department d 
					SET  dr.d_id = '$id',
					     dr.d_name='$_d_name', 
					     dr.d_surname='$_d_surname', 
					     dr.d_add='$_d_add',
					     dr.SSN='$_SSN', 
					     dr.d_tel='$_d_tel', 
                                                     dr.d_bdate='$_d_bdate',
                                                     p.p_id='$prof_id',
                                                    dr.dept_id='$dept_id',
                                                    dr.password = '$password'
                            
					WHERE dr.d_id ='$id'    AND 
					d.dept_id = '$dept_id'  AND
					p.p_id = '$prof_id'     AND dr.dept_id = d.dept_id AND dr.p_id = p.p_id ;";

$query=mysql_query($_u);

I test the $query....there is no error.....but it is not recording the data

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.