Free Web Hosting Forum
(#1 (permalink))
Old
Zitra's Avatar
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, 02: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
(#2 (permalink))
Old
Zitra's Avatar
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 07-15-2008, 02:26 PM

-- Problem solved --


Kind Regards
Mr. Hansen
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.6.9
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0
vBulletin Skin developed by: vBStyles.com