Forum Moderators: coopster
Parse error: syntax error, unexpected T_STRING in /home/website/public_html/includes/connection.inc.php on line 1
I'm not exactly sure what the problem is but I believe it's just a syntax problem. It worked before when we were running PHP v4.x but now we're running PHP v5.2.5 and the site is broken. Can anyone help?
This is the file:
<?php
function dbConnect() {
$user = "username";
$db = "database";
$pwd ="password";
$conn = mysql_connect('localhost', $user, $pwd) or die ('Cannot connect to server');
mysql_select_db($db) or die ('This command is not working, this is where it is breaking.');
return $conn;
}
?>
by the way, Welcome to WebmasterWorld! :)
<?phpfunction dbConnect() {
$user = "username";
$db = "database";
$pwd ="password";
$conn = mysql_connect('localhost', $user, $pwd) or die ('Cannot connect to server');
mysql_select_db($db) or die ('This command is not working, this is where it is breaking.');
return $conn;
}
?>
function db_connect()
{
$result = @mysql_pconnect("localhost", "my_username", "my_password");
if (!isset($result) && empty($result))
{echo "can't connect!"; }
if (!@mysql_select_db("my_DB"))
return false;
return $result;
}
usage:
<?php
$conn = db_connect();
?>
if it doesn't then we know that it comes from soemewhere else!
<edit>Typo</edit>
<?php
if ($_SERVER['REQUEST_METHOD'] != 'POST'){
$me = $_SERVER['PHP_SELF'];
?>
<form name="form1" method="post"
action="<?php echo $me;?>">
<table border="0" cellspacing="0" cellpadding="2">
<tr>
<td><font face="Arial, Helvetica, sans-serif">Name:</font></td>
<td><input type="text" name="Name"></td>
</tr></br>
<tr>
<td><font face="Arial, Helvetica, sans-serif">E-mail:</font></td>
<td><input type="text" name="e-mail"></td>
</tr></br>
<tr>
<td valign="top"><font face="Arial, Helvetica, sans-serif">Phone:</font></td>
<td><input name="Phone" type="text" value=""></td>
</tr></br>
<tr>
<td><font face="Arial, Helvetica, sans-serif">Fax:</font></td>
<td><input type="text" name="Fax"></td>
</tr></br>
<tr>
<td> </td>
<td><input type="submit" name="Submit"
value="Send"></td>
</tr></br>
</table>
</form>
<p>
<?php
else {
error_reporting(0);
$recipient = 'aaron@example.com';
$from = stripslashes($_POST['Name']);
$e-mail = stripslashes($_POST['E-mail']);
$phone = stripslashes($_POST['Phone']);
$fax = stripslashes($_POST['Fax']);
if (mail($recipient, $name, $e-mail, $phone, $fax))
echo nl2br("<b>Message Sent:</b>
To: $recipient
Name: $name
E-mail: $e-mail
Phone: $phone
Fax: $fax
$msg");
else
echo "Message failed to send";
}
?>
i really dont know wuts goin on...some help please?
thanks
[edited by: eelixduppy at 4:09 pm (utc) on Mar. 28, 2008]
[edit reason] exemplified [/edit]