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
https://forums.phpfreaks.com/topic/107184-mysql-update-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.