PHP4 Bug #1769: mysql() broken
| From: | sander at pilon dot com | Date: | Tue, 20 Jul 1999 20:59:12 +0000 |
| Subject: | PHP4 Bug #1769: mysql() broken | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-8809@lists.php.net to get a copy of this message | ||
From: sander@pilon.com
Operating system: Linux 2.2
PHP version: 4.0 Beta 1
PHP Bug Type: MySQL related
Bug description: mysql() broken
(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)
PHP.ini contents (mysql related) - NONE!
Both functions work just fine in PHP3.