doh. sorry for the previous message i pasted an old one.
anyway, here's my problem:
Fatal error: Call to undefined function: mysql_connect() in
/var/www/test2.php on line 15
this appears whenever i tried to open "http://localhost/test2.php". i
installed LAMP using apt-get like so:
apt-get install apache-perl mysql-server mysql-client php4
php4 is working fine with apache as i've tested opening a test.php file
with "<? phpinfo(); ?>" as the only contents. it showed what is
expected. mysql on the other hand is only tested directly within mysql
when i created the sample database "books". what am i missing or do i
really have to use the source to make it work? i prefer using all .deb
package as that's how i update my kernel using kernel-package.
test2.php contents is here:
<html>
<head>
<title>Example 2 -- more details</title>
</head>
<body bgcolor="white">
<?
$dbuser='root';
$dbhost='localhost';
$dbpass='password';
$dbname='test2';
$dbtable='books';
//---------- DATABASE CONNECTION ------------//
$mysql_link = mysql_connect($dbhost,$dbuser,$dbpass);
$column = mysql_list_fields($dbname,$dbtable,$mysql_link);
$sql = "select * from $dbtable";
$result = mysql_db_query($dbname,$sql);
?>
<table bgcolor="black">
<tr><td>
<table><!---- Inside Table ---->
<?
while($value = mysql_fetch_array($result))
{
print "<tr BGCOLOR=YELLOW>";
//This loop goes through the columns and prints
//each value
for ($i=0; $i < mysql_num_fields($column); $i++)
{
print "<td> $value[$i] </td>";
}
print "</tr>";
}
mysql_free_result($result);
mysql_close();
?>
</table><!---- Inside Table ---->
</td></tr>
</table>
</body>
</html>
--
--------------------------------------------------------------------
Key fingerprint = 9DE1 5825 77B4 FF45 7485 D3EB DCCF DE48 09B6 4426
--------------------------------------------------------------------
"Who's watching the watchmen?"
Attachment:
pgpKFTVaU1fXX.pgp
Description: PGP signature