Hi, am trying to get a simple php script working:
===========================================
<?PHP $user = "maincom_test"; $pass = "test"; $data = "maincom_test"; // setup the connection $link = mysql_connect ("localhost", $user, $pass) || die("first dead"); printf("user: %s",$user); printf("db: %s",$data); // select the table mysql_select_db ($data, $link) or die("die"); // get some results o_O $result = mysql_query("SELECT * FROM employees", $link); // print results printf("Printing results
"); ?>===========================================
But it does not work!
I went into cpanel and i made the user named test and it automatically added maincom_test ( user ) then i also made a database named test and hence, maincom_test (database) was made.
So i am sure about the username and password because i do not get error on the connection ( when i make $link)
but when when i load that page in a browser it executes the die(“die”) and os the text is outputted and then die. NO INFORMATION FROM THE DATABASE IS RETREIVED. When i remove the || die(“die”) part it just gives error on the query line. It says:
mysql_query does not have a valid MySQL resrouce - Link.
So am thinking then it is becuase the $link is not established. I am not sure.
But for the above the user name and password are correct because the connection to the database error does not show up. And i doulbe checked to see whether the database name is correct adn it is also.
my phpsqladmin says database maincom_test on localhost
someone please help i appreciate your kindness in advance .