Thread: Php Problem
View Single Post
  #2  
Old 01-14-2008, 07:23 AM
Watdaflip's Avatar
Watdaflip Watdaflip is offline
Brigadier General
 
Join Date: Sep 2005
Location: Cincinnati, Ohio
Posts: 1,638
Default Re: Php Problem

First of all you should change your error handling. You need to close the database connection, so you should either make it
PHP Code:
 if (!mysql_query($query$con)) {
mysql_close($con);
  die(
'ERROR: ' mysql_error());
 } 
of just echo an error message and set a flag if needed...


Anyway, on to the error.

You need to change the name of the column "key" to something else, the word "key" is a reserved word in both php and mysql. Its fine to use it as a variable name (ie. $key is fine), but you can't use it as a column name in a database table. Once you change that the query should work fine.



PS. In your variables, you don't have to surround them with ().

For instance you have $query = ("");

You can just format it like $query = "";

Its not wrong, it still works, its just more work for you to type it, and for anyone else reading through your code it can make it less readable (depending on what else is being done). Just FYI.
__________________

Register/Login Script
Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script
Reply With Quote