|
|
|
|
Re: why do I get a syntax error? [message #180757 is a reply to message #180753] |
Sat, 16 March 2013 18:31   |
|
Am Sat, 16 Mar 2013 17:32:00 -0400 schrieb richard:
> 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.
There is a ")" missing:
if (!$con) { die ("can not connect: " . mysql_error())};
Regards
Ralf
--
Wegen SPAM: Für e-mail verwenden: "errr" statt "erxr" !
|
|
|
Re: why do I get a syntax error? [message #180758 is a reply to message #180756] |
Sat, 16 March 2013 18:42   |
 |
richard
 Messages: 213 Registered: June 2013
Karma: 0
|
Senior Member |
add to buddy list ignore all messages by this user
|
|
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.
|
|
|
Re: why do I get a syntax error? [message #180759 is a reply to message #180753] |
Sat, 16 March 2013 18:44   |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
add to buddy list ignore all messages by this user
|
|
On 3/16/2013 5:32 PM, 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.
>
Rewrite it with sensible formatting (as you should ALL your code):
if (!$con) {
die ("can not connect: " . mysql_error()
};
You're missing both a right paren and a semicolon.
And the semicolon AFTER the right brace is superfluous.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
|
|
Re: why do I get a syntax error? [message #180764 is a reply to message #180756] |
Sat, 16 March 2013 22:49   |
|
richard the sto0pid wrote:
> richard the sto0pid wrote:
>
>> if (!$con) { die ("can not connect: " . mysql_error()};
>
> Ok so here is the code I am using.
> I use Notepad++. It checks for matching brackets on the fly.
If that is true, you should ask for your money back.
--
-bts
-This space for rent, but the price is high
|
|
|
Re: why do I get a syntax error? [message #180765 is a reply to message #180763] |
Sat, 16 March 2013 22:50   |
|
The Natural Philosopher wrote:
> richard the sto0pid wrote:
>> $sql = "SELECT * FROM 1960";
>
> Do you really have a table called '1960'?
Yes, RtS does. He's been dicking with this list of 1960 rock-n-roll songs
for about a decade now, and still hasn't been able to produce a worthwhile
page.
--
-bts
-This space for rent, but the price is high
|
|
|
|
Re: why do I get a syntax error? [message #180771 is a reply to message #180768] |
Sun, 17 March 2013 10:04  |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
add to buddy list ignore all messages by this user
|
|
On 3/17/2013 5:43 AM, The Natural Philosopher wrote:
> On 17/03/13 02:50, Beauregard T. Shagnasty wrote:
>> The Natural Philosopher wrote:
>>
>>> richard the sto0pid wrote:
>>>> $sql = "SELECT * FROM 1960";
>>>
>>> Do you really have a table called '1960'?
>>
>> Yes, RtS does. He's been dicking with this list of 1960 rock-n-roll songs
>> for about a decade now, and still hasn't been able to produce a
>> worthwhile
>> page.
>>
> well yes. richard does seem to falsify the proposition that all men are
> created equal.
>
>
Pot - Kettle - Black.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|