FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » why do I get a syntax error?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: why do I get a syntax error? [message #180758 is a reply to message #180756] Sat, 16 March 2013 22:42 Go to previous messageGo to previous message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma:
Senior Member
On Sat, 16 Mar 2013 17:54:53 -0400, richard wrote:

> On Sat, 16 Mar 2013 17:32:00 -0400, richard wrote:
>
>> if (!$con) { die ("can not connect: " . mysql_error()};
>>
>> generates "Parse error: syntax error, unexpected '}' "
>> i have checked for matching brackets and other obvious syntax errors.
>
> Ok so here is the code I am using.
> I use Notepad++. It checks for matching brackets on the fly.
> If anything is not correct with the syntax, you will know their is a
> problem because the text colors change.
>
>
> $con = mysql_connect('localhost','user','pass');
>
>
> if (!$con){die("can not connect: " . mysql_error())};
>
> mysql_select_db('dbName',$con);
>
> $sql = "SELECT * FROM 1960";
> $myData=mysql_query($sql,$con);
> echo "<table border='1'>";
> echo
> "<tr><th>atitle</th><th>btitle</th><th>artist</th><th>label</th ></tr>";
>
> while ($record = mysql_fetch_array($myData)) {
> echo "<tr>";
> echo "<td>" . $record[atitle] . "</td>";
> echo "<td>" . $record[btitle] . "</td>";
> echo "<td>" . $record[artist] . "</td>";
> echo "<td>" . $record[label] . "</td>";
> echo "</tr>";
>
> };
>
> echo "</table";

I noticed I was missing a ) in that line.
so I corrected it here but still get the error.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: change of color on a field value basis in a table...
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 03:37:57 GMT 2024

Total time taken to generate the page: 0.05156 seconds