Re: mysql_query() and mysql_db_query() not returning a value

From: Date: Mon, 19 Jun 2000 01:25:55 +0000
Subject: Re: mysql_query() and mysql_db_query() not returning a value
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-457@lists.php.net to get a copy of this message
Thanks for the reply, It still doesn't work, I get this error, with the source attached at the bottom. Thanks in advance, Mark ********************************************************************** Database connection complete. The conn number is Resource id #1. Warning: Supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\mysql\tester.php on line 18 *********************************************************************** Source <HTML> <HEAD> <TITLE> Looking here, a mysql tester. </TITLE> </HEAD> <BODY> <? if(!($conn = mysql_connect("crocbyte", "", ""))){ echo "Error opening database.\n"; exit(); } else{ echo "Database connection complete.<br>\n"; echo "The conn number is $conn.<br>\n"; } $whatTo = "Select * from links"; $result_pointer = mysql_db_query("linkcount", $whatTo, $conn); while ( $recordSet = mysql_fetch_row( $result_pointer ) ) { print "One row returned\n<br>"; print $recordSet[1] . $recordSet[2] . $recordSet[3] ."<br>\n"; // these can be indexed by the filed name as well // print $recordSet["col_name"] . $recordSet["second_col_name"]."<br>\n"; } exit; ?> </BODY> </HTML> ----- Original Message ----- From: "Erik Stainsby" <stainsby@telus.net> To: "Mark A Mucha" <mmucha@cfl.rr.com> Sent: Sunday, June 18, 2000 7:36 PM Subject: Re: [PHP-DB] mysql_query() and mysql_db_query() not returning a value > The mysql_query() family of functions does not return the > result set, but a pointer to the result set. > > You then have to retrieve specific rows from that resultset. > > Try > > $result_pointer = mysql_db_query("linkcount", $whatTo, $conn); > > while ( $recordSet = mysql_fetch_row( $result_pointer ) ) { > > print "One row returned\n<br>"; > print $recordSet[1] . $recordSet[2] . $recordSet[3] ."<br>\n"; > // these can be indexed by the filed name as well > print $recordSet["col_name"] . > $recordSet["second_col_name"]."<br>\n"; > } > exit; > > ----- Original Message ----- > From: "Mark A Mucha" <mmucha@cfl.rr.com> > To: <php-db@lists.php.net> > Sent: Sunday, June 18, 2000 4:10 PM > Subject: [PHP-DB] mysql_query() and mysql_db_query() not returning a value > > > I can connect to mysql, and get a list of databases, but for some reason I > can't get a query to return a value. > > $recordSet = mysql_db_query("linkcount", $whatTo, $conn); /* $recordSet > doesn't hold a value after this statement */ > > Any ideas. Thanks > Mark > > >

« previous php.db (#457) next »