[thelist] PHP & MySQL - Generating dynamic pages...

Jay Blanchard jay.blanchard at niicommunications.com
Fri Jul 26 13:32:10 CDT 2002

 Am I missing anything?

What version of PHP? Is register_globals turned off in your php.ini?

Try this
//check connection to db
if(!($dbconnect = mysql_pconnect("", "username", "password"))){
	print("Failed to connect to database!\n");
if(!mysql_select_db("db", $dbconnect)){
	print("Failed to select database!\n");

$state = $_GET['State'];
print($state); //to make sure you're getting what you wanted

$query = SELECT * ";
$query .= "FROM db ";
$query .= "WHERE State = '" . $state . "'
//the above method of coding the query is for neatness only

print($query); //so that you can see the query

//do the query and return errors if not right
if(!($dbquery = mysql_query($query, $dbconnect))){
   print("MySQL reports this error: " . mysql_error());



More information about the thelist mailing list