php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6666 mySQL result
Submitted: 2000-09-12 01:40 UTC Modified: 2000-09-12 01:50 UTC
From: ldcosta at tutopia dot com Assigned:
Status: Closed Package: MySQL related
PHP Version: 4.0.2 OS: Linux
Private report: No CVE-ID: None
 [2000-09-12 01:40 UTC] ldcosta at tutopia dot 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-09-12 01:50 UTC] derick@php.net
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.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 21:00:01 2026 UTC