Hi, the following query appears to be invisible to the program.... ie it does not appear to be executed....no echos // open the connection $conn = mysql_connect("h41mysql45.secureserver.net", "ezevetdistanceed", "password"); // pick the database to use mysql_select_db("ezevetdistanceed",$conn) or die(mysql_error()); // create the SQL statement $getsomething = "SELECT * FROM studentanswers"; $result = mysql_query($getsomething, $conn) or die(mysql_error("cant access student answers")); $numberofrows = mysql_num_rows($result); echo "the number of rows is $numberofrows"; echo "got thru to studentanswers"; PHP: all of the subsequent queries are executed, so I think that $conn is OK. the server and database and password must also be OK....so why the invisibility anyone??? PLEASE? gilk
Place these lines on top of your code and see what you get: error_reporting(E_ALL); ini_set('display_errors', '1'); PHP: EDIT: This doesn't look right: die(mysql_error("cant access student answers")); PHP:
Check all the connections, and remove the extra white space after SELECT in the query. Then try again.
Did all that....even the white space....even tho they reckon that php ignores white space. Code still seems to be invisible to php Any more ideas??? gilk
Hope you can come up with somethins else.....im off to bed now but hope to find an answer in the (our) morning Cheers, gilk
mysql_error() expects a resource (or nothing) as first parameter, and not a string. it should be: die("cant access student answers. MySQL error: " . mysql_error()); PHP:
// open the connection if ( false === ($conn = mysql_connect("h41mysql45.secureserver.net", "ezevetdistanceed", "password")) ){ die('Could not connect to DB: ' . mysql_error()); } // pick the database to use if ( false === ($db = mysql_select_db("ezevetdistanceed", $conn)) ){ die('Could not select DB: ' . mysql_error()); } // create the SQL statement $sql = "SELECT * FROM studentanswers"; if ( false === ($query = mysql_query($sql, $conn)) ){ echo 'Query failed: ' . mysql_error(); } else { $numRows = mysql_num_rows($query); echo 'Number of rows: ' . $numRows; } PHP: