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 #180763 is a reply to message #180756] Sun, 17 March 2013 02:25 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
On 16/03/13 21:54, 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()};

Try ;} instead of };

>
> mysql_select_db('dbName',$con);
>
> $sql = "SELECT * FROM 1960";

Do you really have a table called '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>";
>
> };
Try } instead of };
>
> echo "</table";
>


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
[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 09:12:48 GMT 2024

Total time taken to generate the page: 0.04982 seconds