Cavte, mám taký banálny problém. Skúšal som výpis z databazy mysql. Na hostingu kde mám stránku to ide v poriadku ale na mojom localhoste ( cez easy php ) vypisuje chybu
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:\Program Files\EasyPHP5.3.0\www\hu.php on line 6
Kód:
<?php
include ("config.php");
mysql_connect(SQL_HOST, SQL_USERNAME, SQL_PASSWORD);
mysql_select_db(SQL_DBNAME);
$vysledek=mysql_query("SELECT * FROM timy ORDER BY poznamka");
while ($zaznam=MySql_Fetch_Array($vysledek)):
echo "<p><a href='vypisclanku.php?id=";
echo $zaznam["id"];
echo "'>";
echo $zaznam["nazov"];
echo "<br></a>";
echo $zaznam["manager"];
echo "<br>";
echo "Autor: ";
echo $zaznam["miesto"];
echo "</p>";
echo $zaznam["poznamka"];
echo "</p>";
endwhile;
?>
a tu je config.php
Kód:
<?php
if ($_SERVER["SERVER_ADDR"]=="127.0.0.1")
{
define("SQL_HOST","127.0.0.1");
define("SQL_DBNAME","menodatabazy");
define("SQL_USERNAME","user");
define("SQL_PASSWORD","heslo");
}
else
{
define("SQL_HOST", "blabla");
define("SQL_DBNAME", "blabla");
define("SQL_USERNAME", "blabla");
define("SQL_PASSWORD", "blabla");
}
?>