Page 1 of 1

WEIRD! error, dont know why, can anyone help?

Posted: Mon Dec 04, 2006 1:06 am
by Mythic Fr0st
Im getting a parse error somewhere in this line of code...

Code: Select all

if (!mysql_query($sql,$con))
  {
  die('<font color="red" size="4"><br/>Error: </font>' . mysql_error());
  }
<div align='center'>
echo '<font size=\'4\' color=\'blue\'>'Welcome to Mythic Aeons</font>';

mysql_close($con);
I dunno why?, someone plz help

Posted: Mon Dec 04, 2006 1:11 am
by Flamie

Code: Select all

echo '<font size=\'4\' color=\'blue\'>'Welcome to Mythic Aeons</font>';
change to

Code: Select all

echo '<font size=\'4\' color=\'blue\'>Welcome to Mythic Aeons</font>';

Posted: Mon Dec 04, 2006 1:12 am
by pgolovko

Code: Select all

if(!mysql_query($sql,$con)){ 
  die("<font color=\"red\" size=\"4\"><br/>Error: </font>" . mysql_error()); 
  } 
echo "<div align=\"center\"><font size=\"4\" color=\"blue\">'Welcome to Mythic Aeons</font>"; 

mysql_close($con);

Posted: Mon Dec 04, 2006 1:31 am
by RobertGonzalez
Mythic Fr0st wrote:Im getting a parse error somewhere in this line of code...

Code: Select all

if (!mysql_query($sql,$con))
  {
  die('<font color="red" size="4"><br/>Error: </font>' . mysql_error());
  }
<div align='center'>
echo '<font size=\'4\' color=\'blue\'>'Welcome to Mythic Aeons</font>';

mysql_close($con);
I dunno why?, someone plz help
You are mixing PHP and HTML incorrectly, that is why. You either need to use PHP to output your HTML or you need to move into and out of HTML mode using your PHP code. Take what you have posted and turn it into this:

Code: Select all

<?php
if (!$result = mysql_query($sql,$con)) // makes sense to store the query result for use later, no?
{
  die('<font color="red" size="4"><br/>Error: </font>' . mysql_error());
}
echo '<div align="center">'; // This was your error
echo '<font size="4" color="blue">Welcome to Mythic Aeons</font>'; // This would have thrown errors as well

mysql_close($con);
?>
Also, might I suggest reviewing your code before or even as you post it? This is something that might have become evident to you as you look at it. And please try to use a more descriptive title to your posts. 'WEIRD! error, dont know why, can anyone help?' will make more people want to bypass your post than answer it.

Posted: Mon Dec 04, 2006 1:33 am
by Mythic Fr0st
I know, I usually give better ones, but didnt know what to put O_O, thanks though

Posted: Mon Dec 04, 2006 1:51 am
by RobertGonzalez
Maybe 'HELP NEEDED - I can't find the parse error in this code snippet'? Although PHP should have reported the error and location to you. Do you have display_errors set to 'On'?

Posted: Mon Dec 04, 2006 1:59 am
by Mythic Fr0st
Yea, it does show me the line