Jump to content

MySql Errors in insert.php


shadrxninga

Recommended Posts

I have a problem where I am getting these errors after a form has been submitted from join.html

Here are the errors:

 

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'scswccla'@'localhost' (using password: NO) in /home/scswccla/public_html/insert.php on line 9

 

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/scswccla/public_html/insert.php on line 9

 

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'scswccla'@'localhost' (using password: NO) in /home/scswccla/public_html/insert.php on line 9

 

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/scswccla/public_html/insert.php on line 9

 

 

Here is the insert.php file http://pastebin.com/EVtgidQC

And the join.html file - http://pastebin.com/hqDtGLe5

 

 

How would I fix those errors - I got the code from

http://forum.hey0.net/showthread.php?tid=2509

 

The form is at scswc.com/join.html if you want to look at  it.

 

 

I really want to get this working so if you need any more info to help fix it just ask

 

thanks!

Link to comment
https://forums.phpfreaks.com/topic/223426-mysql-errors-in-insertphp/
Share on other sites

You don't have a valid mysql connection at that time you are calling mysql_real_escape_string() (and it is attempting to create a connection using default values, which doesn't work.) You must make a mysql connection before you call that function.

So how would i fix that? - This is the first time I have Used php

 

Do I need to Move mysql_real_escape_string() to after the database settings or move the database settings before mysql_real_escape_string()

 

 

Or do I need to do something else?

 

Thanks again.

So how would i fix that? - This is the first time I have Used php

 

Do I need to Move mysql_real_escape_string() to after the database settings or move the database settings before mysql_real_escape_string()

 

 

Or do I need to do something else?

 

Thanks again.

 

Well you're calling the function check_input at the top, which calls mysql_real_escape_string. Which requires a database connection be open and working. So your function declaration can be up there, however where you check your POST input has to be after your mysql_connect declaration.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.