MySQL() bug
| From: | Sander Pilon | Date: | Tue, 20 Jul 1999 20:57:05 +0000 |
| Subject: | MySQL() bug | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-2348@lists.php.net to get a copy of this message | ||
(Submitting it to the bug database right now too.)
Well, simply put - the mysql() call is broken. Example script at the bottom.
<script language="php">
function mysql_test1()
{
$r = mysql("tdn_sections","select * from sections");
echo mysql_error();
$i=0;
while($o=mysql_fetch_object($r))
{
echo "$i : $o->url <BR>";
}
}
mysql_test1();
function mysql_test2()
{
$c = mysql_pconnect();
mysql_select_db("tdn_sections",$c);
$r = mysql_query("select * from sections");
$i=0;
while($o=mysql_fetch_object($r))
{
echo "$i : $o->url <BR>";
$i++;
}
}
mysql_test2();
</script>
Output of 'mysql_test1()':
Warning: MySQL Connection Failed: Unknown MySQL Server Host 'tdn_sections'
(111) in /o3dfx/work/php4/hs~mysql_tests.x on line 4
Warning: MySQL: A link to the server could not be established in
/o3dfx/work/php4/hs~mysql_tests.x on line 4
Warning: 0 is not a MySQL result index in /o3dfx/work/php4/hs~mysql_tests.x
on line 6
Output of 'mysql_test2()':
0 : @POLL:7
1 : @3DSHOP
2 : NULL
3 : NULL
4 : NULL
... (correct output)
-----------------------------------------------------
MySQL table 'tdn_sections':
root:/usr/local/lib$ mysqldump tdn_sections
#
# Table structure for table 'sections'
#
CREATE TABLE sections (
identifier varchar(20) DEFAULT '' NOT NULL,
section blob,
contents blob NOT NULL,
urlname blob,
url blob,
added timestamp(14),
PRIMARY KEY (identifier)
);
#
# Dumping data for table 'sections'
#
INSERT INTO sections VALUES
('tdn_fp1','tdn_fp','5','5','@POLL:7',19980618165020);
... (loads more of similar tables)