Insert variables in MySQL

wxdqz

New Member
I'm attempting to use the following bit of code (new to actually using databases, so I'm trying to piece together rather useless MySQL manual entrys and tutorial pages with my knowledge of PHP, so I have a feeling I'm just making a basic syntax error here) to insert values into a database:

$result = mysql_query ("insert into table globals (bgcolor) values ($bgcolor)")
or die ("Could not query database.");


Right above that I have:

$bgcolor = "#E7D5A3";


The field "bgcolor" is a text field, but I also tried it with integer to no avail.

All I get is the die message to display.

*sigh*

Anyone know of a site that teaches MySQL WITH PHP, assuming no experiance with databases? All I have is sites that teach PHP, while assuming previous knowledge of databases. Thus, they are utterly useless to me.


Thanks
 
Back
Top