AW: [PHP-DB] newbie: Trying to select a database in php
| From: | Stefan Siefert | Date: | Wed, 20 Jun 2001 12:09:12 +0000 |
| Subject: | AW: [PHP-DB] newbie: Trying to select a database in php | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-9657@lists.php.net to get a copy of this message | ||
Try it with mysql_select_db($database,$connect) instead of
msql_select_db($database,$connect) :-)
msql is a different Database System (in general, it is a lot older than
mysql I think)
Stefan
-----Ursprüngliche Nachricht-----
Von: Paul Lockyer [mailto:paul_lockyer23@yahoo.co.uk]
Gesendet: Mittwoch, 20. Juni 2001 10:07
An: php-db@lists.php.net
Betreff: [PHP-DB] newbie: Trying to select a database in php
Im using win2k and php to retrieve and dipslay database records, however
whenever the page is loaded in a browser I get the following error (the line
in question is in bold)
Fatal error: Call to undefined function: msql_select_db() in
D:\ASP\test\php\default.php on line 18
The code I am using is below
<?php
$connect = mysql_connect();
if(!$connect){
echo "Could not etsablish connection to mySQL!";
exit;
}
$database = "dvd_listings";
$dbb = msql_select_db($database,$connect) or die("Unable to select
Database!");
$sql = "SELECT * FROM dvd_main";
$sql_result = mysql_query($sql,$connect);
echo "<table border=1>";
echo "<tr><td>DVD Title</td></tr>";
while($row = mysql_fetch_array($sql_result)){
$title = $row["main_title"];
echo "<tr><td>$title</td></tr>";
}
echo "</table>";
mysql_free_result($sql_result);
mysql_close($connection);
?>
Any help would be appreciated