Nevybrali jste databázi – použijte mysql_select_db()
To by bylo něco jako:
<?php
$link = mysql_connect('localhost', 'root', 'geheim');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
$db_selected = mysql_select_db('foo', $link);
if (!$db_selected) {
die ('Error selecting database: '. mysql_error());
}
echo 'Using database successfully';
$query = "SELECT * FROM Auctions";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
foreach($row as $field=>$value) {
echo "$field: {$value} <br />";
}
}
mysql_close($link);
?>