PHP Help -
Lefon - 23.08.2011
Hi,
I got this thing: on bottom:
Warning: mysql_close(): 5 is not a valid MySQL-Link resource in C:\xampp\htdocs\UCP\index.php on line 56
line 56is: <? mysql_close($con); ?>
any help?
con - is $con = mysql_connect(SQL_SERVER, SQL_USERNAME, SQL_PASSWORD);
Re: PHP Help -
Corello2010 - 23.08.2011
Re: PHP Help -
Lefon - 23.08.2011
Nop nothing
Re: PHP Help -
Wanted1900 - 23.08.2011
First:
Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution. (
Source)
Second:
As Corello2010 says, using mysql_close(); should work without any errors. If you still WANT to use that function, make sure you acces $con in the same page (so that the variable still exists), and that you don't have any other variables with the name $con.
Re: PHP Help -
Farsek - 23.08.2011
connections had successful? I think no,because '5 is not a valid MySQL-Link resource ' -> mysql connection #5 ($con) isn't a valid connection ...
try with this:
if(mysql_ping($conn) <=0) die "fail to connect";
Re: PHP Help - XFlawless - 23.08.2011
Quote:
Originally Posted by Farsek
connections had successful? I think no,because '5 is not a valid MySQL-Link resource ' -> mysql connection #5 ($con) isn't a valid connection ...
try with this:
if(mysql_ping($conn) <=0) die "fail to connect";
|
$Con = mysql_connect() or die('Connection failed '.mysql_error());
OT:
Check if the connection was success.
Check if you can select database properly.
Re: PHP Help -
Lefon - 23.08.2011
Nop, don't work... Or this warning, or a lot of them
Re: PHP Help -
Corello2010 - 23.08.2011
Код:
$con = mysql_connect($SQL_SERVER, $SQL_USERNAME, $SQL_PASSWORD) or die('Connection failed '.mysql_error());
Don't forget your $!!!
Re: PHP Help -
Lefon - 23.08.2011
Notice: Undefined variable: SQL_SERVER in C:\xampp\htdocs\nfengine\database.php on line 11
Notice: Undefined variable: SQL_USERNAME in C:\xampp\htdocs\nfengine\database.php on line 11
Notice: Undefined variable: SQL_PASSWORD in C:\xampp\htdocs\nfengine\database.php on line 11
Re: PHP Help -
Farsek - 23.08.2011
Quote:
Originally Posted by Lefon
Notice: Undefined variable: SQL_SERVER in C:\xampp\htdocs\nfengine\database.php on line 11
Notice: Undefined variable: SQL_USERNAME in C:\xampp\htdocs\nfengine\database.php on line 11
Notice: Undefined variable: SQL_PASSWORD in C:\xampp\htdocs\nfengine\database.php on line 11
|
Start with start.
http://www.w3schools.com/html/default.asp
http://www.w3schools.com/php/default.asp
http://dev.mysql.com/doc/refman/5.0/en/tutorial.html
$SQL_SERVER = "localhost";
$SQL_USERNAME = "root";
$SQL_PASSWORD ="pass"; // if mysql db don't have a pass,dont put $SQL_PASSWORD