Alright, small problem here I think, but I've tried a ton of things and I can't figure out how to solve it!
What's happening is that I have a calendar page where users click on a date on the calendar, this in turn enters their user ID into a column in the table "availability" where the column name = the date. Example column name: 3-20, 3-21, 3-22, 12-25, etc.
I have successfully stored the month and day in a variable:
$availdate = "$month-$day";
However, I cannot get the information to save into the table! The code for saving the data into the table is as follows, please note that the session[id] is stored from logging in. When I try it, the following error is displayed: "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 '3-20 ='17' WHERE id ='17'' at line 2"
I believe the problem lies in the fact that I am issuing the query $availdate ='$_SESSION[id]....I need to get rid of the "$" sign but I'm not sure how to do that.
Please help!
//set up table and database names
$db_name ="refphoto_testdb";
$table_name ="availability";
//connect to server and select database
$connection = @mysql_connect("localhost","refphoto","08291983") or die(mysql_error());
$db = @mysql_select_db($db_name,$connection) or die(mysql_error());
//build and issue query
$sql ="UPDATE $table_name SET
$availdate ='$_SESSION[id]'
WHERE id ='$_SESSION[id]'";
$result = @mysql_query($sql,$connection) or die(mysql_error());