note 86579 added to function.mysql-fetch-array
| From: | marquee_fb14 at yahoo dot com | Date: | Fri, 24 Oct 2008 12:07:06 +0000 |
| Subject: | note 86579 added to function.mysql-fetch-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145691@lists.php.net to get a copy of this message | ||
Im a beginner and I just starting my first code to try if my MySQL and PHP is going will work. But
the result is always "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result resource in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\mysql_test.php on
line 15. Is there anyone how can help me how solve this problem. The code i use in this example is
this:
<?php
define("MYSQL_HOST", "localhost");
define("MYSQL_USER", "root");
define("MYSQL_PASS", "mypass");
define("MYSQL_DB", "test");
$conn = mysql_connect("".MYSQL_HOST."", "".MYSQL_USER."",
"".MYSQL_PASS."") or
die(mysql_error());
mysql_select_db("".MYSQL_DB."",$conn) or die(mysql_error());
$sql = "SELECT * FROM test";
$res_value = mysql_query($sql);
//while ($field = mysql_fetch_array($res_value))
//{
$id = $field['id'];
$name = $field['name'];
echo 'ID: ' . $field['id'] . '<br />';
echo 'Name: ' . $field['name'] . '<br /><br />';
//}
?>
Please help...
----
Server IP: 208.69.120.35
Probable Submitter: 116.50.217.234
----
Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-array.php
Edit -- https://master.php.net/note/edit/86579
Del: integrated -- https://master.php.net/note/delete/86579/integrated
Del: useless -- https://master.php.net/note/delete/86579/useless
Del: bad code -- https://master.php.net/note/delete/86579/bad+code
Del: spam -- https://master.php.net/note/delete/86579/spam
Del: non-english -- https://master.php.net/note/delete/86579/non-english
Del: in docs -- https://master.php.net/note/delete/86579/in+docs
Del: other reasons-- https://master.php.net/note/delete/86579
Reject -- https://master.php.net/note/reject/86579
Search -- https://master.php.net/manage/user-notes.php