PHP 4.0 Bug #6666 Updated: mySQL result

From: Date: Tue, 12 Sep 2000 05:50:44 +0000
Subject: PHP 4.0 Bug #6666 Updated: mySQL result
Groups: php.dev 
Request: Send a blank email to php-dev+get-32940@lists.php.net to get a copy of this message
ID: 6666 Updated by: derick Reported By: ldcosta@tutopia.com Status: Closed Bug Type: MySQL related Assigned To: Comments: Hello, this list is NOT for reporting userland errors, but you can use MySQL as follows: $query = "select * from t1"; $result = mysql_query ($query); while ($array_r = mysql_fetch_array ($restul)) { printf ("C1: %s", $array_r["c1"]); } Please read the manual more carefully, I'm sure it is in it. Previous Comments: --------------------------------------------------------------------------- [2000-09-12 01:40:51] ldcosta@tutopia.com Hi, I'm form Argentina, and I've done the configuration of PHP4 --with-mysql, --with-apxs and --enable-ftp. Now, i'm trying to work with mysql and i can't, it says that it has an error. Here's the code: <html> <body> <? /*$conex = mysql_connect("localhost", "nobody"); mysql_select_db("hardsite", $conex); $resultado = mysql_query("SELECT * FROM hardsite", $conex); echo "Vendedor: ".mysql_result($resultado, 0, "vendedor")."<BR>"; echo "e-mail: ".mysql_result($resultado, 0, "mail")."<BR>"; echo "Producto: ".mysql_result($resultado, 0, "producto")."<BR>"; echo "Precio: ".mysql_result($resultado, 0, "precio")."<BR>"; echo "Tipo de pago: ".mysql_result($resultado, 0, "pago")."<BR>"; echo "Descripción: ".mysql_result($resultado, 0, "descripcion")."<BR>"; */ $link = mysql_connect("localhost", "nobody"); mysql_select_db("hardsite", $link); $result = mysql_query("SELECT * FROM ventas", $link); echo "Nombre: ".mysql_result($result, 0, "vendedor")."<br>"; echo "Dirección: ".mysql_result($result, 0, "mail")."<br>"; ?> </body> </html> And here the result of the page Warning: Supplied argument is not a valid MySQL result resource in /home/httpd/html/miprimeradb.php on line 17 Nombre: Warning: Supplied argument is not a valid MySQL result resource in /home/httpd/html/miprimeradb.php on line 18 Dirección: ----------------------------- I know that i'have commented the first part, but it was because i was trying, and it didn't work. But the second part was part of an example that i've downloaded of the net, i've changed the name of the database and the fields. Well, i hope you can help me Regards, Leandro Costa --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=6666

« previous php.dev (#32940) next »