View Single Post

(#1 (permalink))
Old
Zitra's Avatar
Zitra Zitra is offline
Junior Member
Zitra is on a distinguished road
 
Posts: 29
Join Date: Jul 2008
Location: South East DK
Send a message via AIM to Zitra Send a message via MSN to Zitra Send a message via Skype™ to Zitra
Default Include database connect problem - 07-15-2008, 03:09 PM

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?


Kind Regards
Mr. Hansen
Reply With Quote