Hi Naxon,
Thank you for putting your code here,
that is helpful.
There are some issues in the User.php you have
posted here.
There is a missing parenthesis on the function save() at the end
of the function.
There is also an extra parenthesis at the bottom of the file.
In the function save, in both query statements,
you need to change the column email to "EMAIL_ADDR",
otherwise mysql_query will fail.
Be sure to change this in any other queries as well.
In these same queries you need to change the name of the table
from user to USER (assuming that is how you named it in the database).
There is one issue in your short script that calls
User.php. You need to change
user->email to user->emailAddr.
The script will still write to the database okay, it
just won't write the email address.
If you have not already done so, you may want
to add a line to your short script to log errors.
For example,
PHP Code:
ini_set('error_log','./php.error.log');
For your query statements, use mysql_error(), it will show
what is wrong with your query. Example
PHP Code:
$result = mysql_query($query, $GLOBALS['DB']);
if (!$result) {
die("my sql error is ", mysql_error() );
}
Also, even though User.php is not a program you run off
the command line, doing "php User.php" on the command
line will show you syntax errors. That surfaced the
parenthesis problem.
Make sure the path to your include files is
correct relative to the directory where you are
executing the script.
You are probably already doing a lot of these
troubleshooting techniques, but maybe something
here could be useful.
For this chapter, I am using the code from the
book, not the download code, and it is working
for me.
There are some errors in Chapter 1, you may want to
read through the errata and also look at the forum
here.
I hope this helps.