Jump to content

layman

Members
  • Posts

    52
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

layman's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you! I think I need some sleep, it is 1.32 am here... Thanks again, really appreciate your help! All the very best, Layman
  2. Thank you! I changed it to decimal(7,2), but still getting an error. #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'text not null default '', Product_price decimal(7,2) not null default '', Pr' at line 5 Do you see what the problem is with my table? CREATE TABLE Products ( Grp ENUM('Motherboard', 'HardDrive', 'Processor', 'RAM', 'GraphicCard', 'SoundCard', 'USBPort', 'RouterSwitch', 'Server', 'PowerAdaptor', 'Webcam', 'OperatingSystem', 'Software', 'CaseStyle', 'Speaker', 'FloppyDrive', 'OpticalStorage', 'Monitor', 'Printer', 'Mouse', 'Keyboard') NOT NULL, Serialno varchar(20) not null default '', Product_name varchar(50) not null default '', Product_description varchar(50)text not null default '', Product_price decimal(7,2) not null default '', Product_review varchar(70), Product_brand varchar(30), Product_type varchar(30), Product_speed varchar(30), Product_size varchar(30), Product_dimensions varchar(30), Product_on_board_dev varchar(30), Product_form_factor varchar(30), Product_FSB varchar(30), Product_secu_spec varchar(30), Product_techn_stand varchar(30), Product_maxres varchar(30), Product_colour varchar(30), Admin_id int(4) not null, key Serialno(Serialno), PRIMARY KEY (Serialno), FOREIGN KEY (Admin_id) references SYSTEM_ADMIN(Admin_id) on update cascade on delete cascade ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  3. Hello, Could you tell me why is this code not working? I appreciate any help! Thanks. The error I am getting is: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'number(5) not null default '', Product_review text(100), Product_brand var' at line 6 Server version: 5.1.41 I have created already the SYSTEM_ADMIN table I am referencing, so that one should not be the problem. Can not see what is the problem with line 6. Can anyone spot it? CREATE TABLE Products ( Grp ENUM('Motherboard', 'HardDrive', 'Processor', 'RAM', 'GraphicCard', 'SoundCard', 'USBPort', 'RouterSwitch', 'Server', 'PowerAdaptor', 'Webcam', 'OperatingSystem', 'Software', 'CaseStyle', 'Speaker', 'FloppyDrive', 'OpticalStorage', 'Monitor', 'Printer', 'Mouse', 'Keyboard') NOT NULL, Serialno varchar(20) not null default '', Product_name text(100) not null default '', line 6 Product_description text(100) not null default '', Product_price number(5) not null default '', Product_review text(100), Product_brand varchar(30), Product_type varchar(30), Product_speed varchar(30), Product_size varchar(30), Product_dimensions varchar(30), Product_on_board_devices varchar(30), Product_form_factor varchar(30), Product_FSB varchar(30), Product_secu_spec varchar(30), Product_techn_stand varchar(30), Product_maxres varchar(30), Product_colour varchar(30), Admin_id int(4) not null, key Serialno(Serialno), PRIMARY KEY (Grp, Serialno), FOREIGN KEY (Admin_id) references SYSTEM_ADMIN(Admin_id) on update cascade on delete cascade ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  4. Hi I don`t understand. How should I make a foreign key if not like this?
  5. Hello, Could anyone tell me what is wrong with this code? Thanks for any help! The error I am getting is: #1072 - Key column 'Login_id' doesn't exist in table Server version: 5.1.41 I have created already the Login_detail table I am referencing, so that one can not be the problem. Or can be??? CREATE TABLE IF NOT EXISTS CUSTOMERS ( Customer_id int(4) not null auto_increment, Customer_name varchar(80) not null default '', Customer_address1 varchar(50) not null default '', Customer_address2 varchar(50) not null default '', Customer_town varchar(50) not null default '', Customer_postcode varchar(9) not null default '', Customer_county varchar(30) not null default '', Customer_country varchar(30) not null default '', Customer_phoneno int(14) not null, Customer_email varchar(50) not null default '', key Customer_id (Customer_id), PRIMARY KEY (Customer_id), FOREIGN KEY (Login_id) references login_detail(Login_id) on update cascade on delete cascade ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  6. Yes, that is what I would like to do! Is this the right way to represent one to many relationships?
  7. Thank you! It was accepted! So if I want to relate Order_no to the Customer_id from the Customer table, it should be always like this? I mean at the Foreign key part? I thought it has to be the customer id... CREATE TABLE ORDERS ( Orders_no int(6) not null auto_increment, Orders_date date default '0000-00-00', key Orders_no (Orders_no), PRIMARY KEY (Orders_no), FOREIGN KEY (Orders_no) references CUSTOMER(Customer_id) on update cascade on delete cascade ) ENGINE=INNODB AUTO_INCREMENT=1;
  8. Thank you. Put an "s" behind, so now the table is Orders. But still getting the same error! #1072 - Key column 'Customer_id' doesn't exist in table Could you help me why? Thanks for any help. CREATE TABLE ORDERS ( Orders_no int(6) not null auto_increment, Orders_date date default '0000-00-00', key Orders_no (Orders_no), PRIMARY KEY (Orders_no), FOREIGN KEY (Customer_id) references CUSTOMER(Customer_id) on update cascade on delete cascade ) ENGINE=INNODB AUTO_INCREMENT=1;
  9. Hello, Could you help me why is my CREATE TABLE statement not working? CREATE TABLE ORDER ( Order_no int(6) not null auto_increment, Order_date date default '0000-00-00', key Order_no (Order_no), PRIMARY KEY (Order_no), FOREIGN KEY (Customer_id) references CUSTOMER(Customer_id) on update cascade on delete cascade ) ENGINE=INNODB AUTO_INCREMENT=1; The error I am getting is: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER ( Order_no int(6) not null auto_increment, Order_date date default '00' at line 1 Server version: 5.1.41 I have created already the Customer table I am referencing, so that one can not be the problem. Also I took out the default date, but got the same error. Thanks for any help!
  10. I got, its WORKING!! Thank you very much for everyone for the contribution. Again, I learned a lot from you guys! Thanks again. All the very best, layman
  11. Notice: Use of undefined constant getResult - assumed 'getResult' in C:\xampp\htdocs\cwk\Class_Student_Course_Proba.php on line 29 Notice: Use of undefined constant getResult - assumed 'getResult' in C:\xampp\htdocs\cwk\Class_Student_Course_Proba.php on line 29 Notice: Undefined variable: esc_grade in C:\xampp\htdocs\cwk\Student_Course_Update.php on line 66 Notice: Undefined variable: esc_comments in C:\xampp\htdocs\cwk\Student_Course_Update.php on line 66 Notice: Undefined variable: esc_sid in C:\xampp\htdocs\cwk\Student_Course_Update.php on line 66 Notice: Undefined variable: esc_cid in C:\xampp\htdocs\cwk\Student_Course_Update.php on line 66 UPDATE studentcourses set grade='', comments='' where sid='' and cid='' Notice: Undefined variable: numofrows in C:\xampp\htdocs\cwk\Student_Course_Update.php on line 71 Success. Number of rows affected: I have defined the constant on line 29. Line 66 is: $sql = "UPDATE studentcourses set grade='{$esc_grade}', comments='{$esc_comments}' where sid='{$esc_sid}' and cid='{$esc_cid}'"; Line 71 is: echo "Success. Number of rows affected: <strong>{$numofrows}</strong>"; //in this row
  12. I got the line, where the error is, but I can not see what is wrong here. $sql = "UPDATE studentcourses set grade='{$esc_grade}', comments='{$esc_comments}' where sid='{$esc_sid}' and cid='{$esc_cid}'"; And also here: echo "Success. Number of rows affected: <strong>{$numofrows}</strong>"; //in this row Could anyone point the it out for me what am I doing wrong? Thank you.
  13. I have looked for the syntax, but what I am trying is not working. http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting Is this the right syntax? function display_errors() { on; } error_reporting(E_ALL); display_errors(on);
  14. And where should I set this error reporting? Is that goes straight after the opening PHP tag?
×
×
  • 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.