why am I getting this parse error?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bruceg
Forum Contributor
Posts: 174
Joined: Wed Mar 16, 2005 11:07 am
Location: Morrisville, NC
Contact:

why am I getting this parse error?

Post by bruceg »

I get the following error:

Parse error: parse error, unexpected T_STRING in /hsphere/local/home/bruceg/inspired-evolution.com/search/include/connect.php on line 7

here is the code

Code: Select all

<?php
	$database="bruceg_search";
	$mysql_user = "bruceg_webmaster";
	$mysql_password = "password"; 
	$mysql_host = "server-10.existhost.com";
	$mysql_table_prefix = "";
	$success = mysql_pconnect ($server-10.existhost.com, $bruceg_search, $password);
	if (!$success)
		die ("<b>Cannot connect to database, check if username, password and host are correct.</b>");
    $success = mysql_select_db ($database);
	if (!$success) {
		print "<b>Cannot choose database, check if database name is correct.";
		die();
	}
?>
thanks for any hints...
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

change line 7 to the variables you set above it:

Code: Select all

$success = mysql_pconnect ($mysql_host, $mysql_user, $mysql_password);
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

This is invalid:

Code: Select all

$success = mysql_pconnect ($server-10.existhost.com,
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Man Burrito, I was there first...BTW Amost Wednsday it is...
bruceg
Forum Contributor
Posts: 174
Joined: Wed Mar 16, 2005 11:07 am
Location: Morrisville, NC
Contact:

Post by bruceg »

confused, I now am....

What I have now is:

Code: Select all

<?php
	$database="bruceg_search";
	$mysql_user = "bruceg_webmaster";
	$mysql_password = "password"; 
	$mysql_host = "server-10.existhost.com";
	$mysql_table_prefix = "";
	$success = mysql_pconnect ($bruceg_search, $bruceg_webmaster, $password, $server-10.existhost.com);
	if (!$success)
		die ("<b>Cannot connect to database, check if username, password and host are correct.</b>");
    $success = mysql_select_db ($database);
	if (!$success) {
		print "<b>Cannot choose database, check if database name is correct.";
		die();
	}
?>
Changed line 7 to variables above, but get same error...
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Replace line 7 with exactly what Burrito Posted:

Code: Select all

$success = mysql_pconnect ($mysql_host, $mysql_user, $mysql_password);
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

In other words:

Code: Select all

<?php
    $database="bruceg_search";
    $mysql_user = "bruceg_webmaster";
    $mysql_password = "password"; 
    $mysql_host = "server-10.existhost.com";
    $mysql_table_prefix = "";
    $success = mysql_pconnect ($mysql_host, $mysql_user, $mysql_password);
    if (!$success)
        die ("<b>Cannot connect to database, check if username, password and host are correct.</b>");
    $success = mysql_select_db ($database);
    if (!$success) {
        print "<b>Cannot choose database, check if database name is correct.";
        die();
    }
?>
Voila!
Post Reply