Сообщение от dmitriymar
|
mysqli_select_db
|
<?php
if(!$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')) {
exit('Could not connect to mysql');
}
if(!mysql_select_db('mysql_dbname', $link)) {
exit('Could not select database');
}
$sql = 'SELECT * FROM foo';
$result = mysql_query($sql, $link);
if(!$result) {
exit('DB Error, could not query the database\n'.mysql_error());
}
while($row = mysql_fetch_assoc($result)) {
echo $row['foo'];
}
mysql_free_result($result); //Освобождаем память от результата запроса
?>