Jump to content

Query Help


aussiefly

Recommended Posts

Hey everyone!

 

I've got a query that im running to stick multiple values into a table ina  mysql database.

 

$schedule_insert ="INSERT INTO `days` (monday, tuesday, wednesday, thursday, friday, saturday, sunday) VALUES ('$monday','$tuesday','$wednesday','$thursday','$friday','$saturday','$sunday') WHERE userid = $_SESSION[id]";
  $schedule_update = mysql_query($schedule_insert);

 

Now is that the best way to do it and will it work fine??? I've been using the query without the `WHERE` conditional and it works...im just wondering if ive got the WHERE conditional in the right spot.

 

Any ideas

Link to comment
https://forums.phpfreaks.com/topic/94857-query-help/
Share on other sites

yup you guys are totally correct...dont know whay i was trying to insert those details rather than update  :o

 

Anyway, even with update it throws an sql syntax error...this seems to happen when im trying to insert multiple values in my query...anyone know where im going wrong ???

Link to comment
https://forums.phpfreaks.com/topic/94857-query-help/#findComment-485877
Share on other sites

yup you guys are totally correct...dont know whay i was trying to insert those details rather than update  :o

 

Anyway, even with update it throws an sql syntax error...this seems to happen when im trying to insert multiple values in my query...anyone know where im going wrong ???

 

Try this

 

$schedule_update ="UPDATE `days` SET monday = '" . $monday . "', tuesday = '" . $tuesday . "', wednesday = '" . $wednesday . "', thursday = '" . $thursday. "', friday = '" . $friday . "', saturday = '" . $saturday. "', sunday = '" . $sunday . "' WHERE userid = '" . $_SESSION[id] . "' LIMIT 1";

  

Link to comment
https://forums.phpfreaks.com/topic/94857-query-help/#findComment-485899
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.