This is a really strange one.
I have been trying for a couple of hours to get a certain script running
and it seems that the msql server is looking at the wrong data base.
This is my script:
<?php ini_set ("display_errors", "1"); error_reporting(E_ALL); /*Database info*/ $username="eaaagt"; $password="password"; $database="gggwnet7y"; $host="localhost"; $fm_email = "paymaster@expert-world.net"; $fm_name = "Paymaster"; Mysql_close(); $today = date("U"); $connection = mysql_connect($host,$username,$password) or die ("Couldn't connect to server.". mysql_error()); $db = mysql_select_db($database, $connection) or die ("Couldn't select the database.". mysql_error()); $err = "error test $item_name"; $det = "error test detail: $mc_gross"; // Inform admin $to = "dave.fethiye@gmail.com"; $contact = "David"; $subject = "1 PRODUCT ERROR: Modus:$modus"; $message_html = "Hi DaveNO errors. Method: $modus
Database:$database "; require('send_email.php'); // Record the Error $err_str = "INSERT into data (method, req, response) VALUES ('$modus','$err','$det' )"; $result = mysql_query($err_str) or die("could not INSERT data.". mysql_error()); ?>
Now you can see that I actually email myself the database variable
and this is what is emailed:
Hi Dave
NO errors. Method:
Database:gggwnet7y
OK that is what we expect.
But the error I get from running this script is:
Warning: mysql_close(): no MySQL-Link resource supplied in /home/ew78gt/public_html/sys/ipn_test.php on line 31
could not INSERT data.Table ‘guru777.data’ doesn’t exist
Now the warning is OK - I put that “close” there just to close any open connection.
Now when I get the mysql_error()); as part of the “die” because it is failing,
Notice that the database is “guru777”
That database is not even used by this server - it is a database used by expert-world.com
The user , password and database that I specify at the top of the script are
for expert-world.net. There should be no relationship at all.
So how is it failing to look at the database that I gave it ?
The email proves what $database is set to ( ie gggwnet7y )
Any ideas how this can happen, and more importantly
how I can fix it ?
Thanks