MySQL Forums
Forum List  »  PHP

Re: PHP and MySQL form problems
Posted by: Martyn Coupland
Date: June 14, 2005 09:20AM

Firstly, what is your error when using $_SERVER['DOCUMENT_ROOT']?

I would change this line...

if(!ereg($page, $_SERVER['HTTP_REFERER']))

to this...

if(!eregi("pagename.php", $_SERVER['HTTP_REFERER']))

This line...

$result = mysql_query($query);

Alter to...

$result = mysql_query($query) or die(mysql_error());

This is useful for debugging your script and will return any errors returned by MySQL.

Finally...

$query = INSERT INTO table_name VALUES ('', 'fname', 'lname', 'phone', 'fax', 'email', 'message');

Should be...

$query = "INSERT INTO table_name ('field','fname','lname','phone','fax','email','message') VALUES ('', 'fname', 'lname', 'phone', 'fax', 'email', 'message')";

That this then let us know.

Regards,
Martyn Coupland
Development Officer

Options: ReplyQuote


Subject
Written By
Posted
Re: PHP and MySQL form problems
June 14, 2005 09:20AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.