php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10456 Warning: Supplied argument is not a valid MySQL result resource in c:\inetpub\w
Submitted: 2001-04-23 07:39 UTC Modified: 2001-04-23 07:47 UTC
From: joris_van_boven at hotmail dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.0.4pl1 OS: win 2000
Private report: No CVE-ID: None
 [2001-04-23 07:39 UTC] joris_van_boven at hotmail dot com
<html><body>
<h1>Kijk hier een database!</h1>
<a href='Prob01.PHP'>Prob 01 (PHP)</a>
<?
$SQLhost = "localhost";
$SQLgebruiker = "Administrator";
$SQLpassword = "xxxxxxxxx";

// connect database-------------------------------------------------------------------------------------------------

@$objconn = mysql_connect($SQLhost,$SQLgebruiker,$SQLpassword)
 or die("Da is hier mis gelopen! Kan niet inloggen op de database: ".$SQLhost." ".$SQLgebruiker." ".$SQLpassword );

// Basis SQL-string-------------------------------------------------------------------------------------------------

 $Sqlstring = "SELECT id, naam, com FROM prob";

// Ophalen data en in tabel steken----------------------------------------------------------------------------------

 echo "<table border=1><TR><TH>ID</TH><TH>Persoon</TH><TH>Commentaar</TH></TR>";
 $dbRecordSet = mysql_db_query($SQLgebruiker, $Sqlstring);
 while ($dbRecord = mysql_fetch_array($dbRecordSet))
       {
        echo "<TR><TD>".$dbRecord[id]."</TD><TD>".$dbRecord[naam]."</TD><TD>".$dbRecord[com]."</TD></TR>";
       }
 echo "</table>";
// Sluiten database--------------------------------------------------------------------------------------------------

$dbRecord=null;
mysql_close($objconn);
$objconn=null;

?>
</body></html>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-23 07:47 UTC] derick@php.net
RTFM:

mysql_connect ("localhost"," user", "pw");
$query = "SELECT * from blaat";
mysql_select_db ("db1");
$r = mysql_query ($query);
while ($s = mysql_fetch_row($r))
{
/* Do Stuff */
}
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 28 07:01:29 2024 UTC