Hi.
I've tried to include a database connect file called "connect.php" and I've got a news site, where it's being included, called "news.php"
connect.php:
Code:
<?
// Define global variable for db connection string
define (’DBHOST’,'sql2.000webhost.com’);
define (’DBNAME’,'a1927491_general’);
define (’DBUSER’,'a1927491_general’);
define (’DBPASS’,'password hided’);
// Here is the function to call
// Receive sql statement as parameter and return result set)
function dbQuery($sql) {
$conn = mysql_connect(DBHOST, DBUSER, DBPASS) OR DIE (mysql_error());
@mysql_select_db (DBNAME, $conn) OR DIE (mysql_error());
}
?>
news.php:
Code:
<!-- news text -->
<div class="news">
<?
include("connect.php");
$query = "SELECT text FROM a_news";
$result = mysql_query($query);
$sql = $result;
dbQuery($sql);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo $row['text'] .' <br>';
} ?>
Error:
Quote:
|
Parse error: syntax error, unexpected T_STRING in /home/a1927491/public_html/connect.php on line 5
|
Can someone help me?