473,516 Members | 3,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what is error in this line of code?

The following code snippet gives an error "unexpected '}'"

I have tried chopping up the line into small parts and it seems to die
when I get the the "onclick" part of the line.

Can anyone see what the problem is or offer a suggestion on how to do
this better.

Thanks!

Mike

Jul 17 '05 #1
10 1477
might help if I posted the code :) The line in question is the long
print line

while ($line = mysql_fetch_assoc($pics)) {
$num = $line["SeqNo"];
$name = $line["Name"];
print "<p>$num $name</p>";
print "<p align=\"left\"><a style=\"cursor:hand\"
onclick=\"chgpic($num)\"><font color="#FFFFFF">$name</font></a></p>";
}

Jul 17 '05 #2
Fivestar wrote:
might help if I posted the code :) The line in question is the long
print line

while ($line = mysql_fetch_assoc($pics)) {
$num = $line["SeqNo"];
$name = $line["Name"];
print "<p>$num $name</p>";
print "<p align=\"left\"><a style=\"cursor:hand\"
onclick=\"chgpic($num)\"><font color="#FFFFFF">$name</font></a></p>";
}


<font color="#FFFFFF">

should be

<font color=\"#FFFFFF\">

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #3
Fivestar wrote:
might help if I posted the code :) The line in question is the long
print line

while ($line = mysql_fetch_assoc($pics)) {
$num = $line["SeqNo"];
$name = $line["Name"];
print "<p>$num $name</p>";
print "<p align=\"left\"><a style=\"cursor:hand\"
onclick=\"chgpic($num)\"><font color="#FFFFFF">$name</font></a></p>";
}

The immediate thing that springs to mind is yuo haven't escaped the
quotes around the colour string
Jul 17 '05 #4
.oO(Fivestar)
might help if I posted the code :) The line in question is the long
print line

while ($line = mysql_fetch_assoc($pics)) {
$num = $line["SeqNo"];
$name = $line["Name"];
print "<p>$num $name</p>";
print "<p align=\"left\"><a style=\"cursor:hand\"
onclick=\"chgpic($num)\"><font color="#FFFFFF">$name</font></a></p>";
}


There are some unescaped double quotes in the string, causing the parse
error. Either escape them or simply use single quotes.

Micha
Jul 17 '05 #5
Chris,

Thanks for the quick response! Can't believe I missed something that
obvious!

Thanks again!

Mike

Jul 17 '05 #6
*** Fivestar escribió/wrote (22 Feb 2005 14:27:16 -0800):
Thanks for the quick response! Can't believe I missed something that
obvious!


This kind of errors become pretty obvious when your text editor has syntax
highlight.

Also (and this is merely a personal opinion) scaping quotes makes code
harder to understand:

print "<p align=\"left\"><a style=\"cursor:hand\" onclick=\"chgpic($num)\"><font color="#FFFFFF">$name</font></a></p>";
print '<p align="left"><a style="cursor:hand" onclick="chgpic(' . $num. ')"><font color="#FFFFFF">' . $name . '</font></a></p>';
--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Manda tus dudas al grupo, no a mi buzón
-+ Send your questions to the group, not to my mailbox
--
Jul 17 '05 #7
I noticed that Message-ID: <cv**********@lust.ihug.co.nz> from Chris
Hope contained the following:
<font color="#FFFFFF">

should be

removed and replaced by CSS.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #8
"Geoff Berrow" <bl******@ckdog.co.uk> wrote in message
news:f9********************************@4ax.com...

: ><font color="#FFFFFF">
: >
: >should be
: >
: removed and replaced by CSS.

and then all of it should be removed into a template somewhere ;-)

Jul 17 '05 #9
Templates are the only way to go.....

Jul 17 '05 #10
JDS
On Tue, 22 Feb 2005 14:06:15 -0800, Fivestar wrote:
might help if I posted the code :) The line in question is the long


It also might help if you posted the entire error.

--
JDS | je*****@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

Jul 17 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1558
by: Sims | last post by:
Hi, I have an eval(...) and sometimes, (not often), i get an error. I can catch the error quite easily, if( FALSE === eval($code )) { // output the code echo ( htmlentities($code ); }
2
17524
by: Mike Fisher | last post by:
I'm seeing an error when I try to run/debug a web service. Although it doesn't happen every time, it does occur more than half of the times I hit F5. It appears to be returned by the the JIT compiler as the page is requested by the browser. The result is that the "compiler failed with error code 2000". I have tested the same code on...
72
5742
by: E. Robert Tisdale | last post by:
What makes a good C/C++ programmer? Would you be surprised if I told you that it has almost nothing to do with your knowledge of C or C++? There isn't much difference in productivity, for example, between a C/C++ programmers with a few weeks of experience and a C/C++ programmer with years of experience. You don't really need to...
5
5688
by: Enos Meroka | last post by:
Hallo, I am a student doing my project in the university.. I have been trying to compile the program using HP -UX aCC compiler, however I keep on getting the following errors. ================================================================= Error 19: "CORBAManagerMessages.h", line 4 # Unexpected 'std'. using std::string; ^^^
121
9912
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather...
6
4715
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
51
13299
by: WindAndWaves | last post by:
Can anyone tell me what is wrong with the goto command. I noticed it is one of those NEVER USE. I can understand that it may lead to confusing code, but I often use it like this: is this wrong????? Function x select case z
18
3100
by: vermarajeev | last post by:
Hello everybody, This is my second query in this post. Firstly thankx to Banfa, for helping me solve my first query. Here is the code which I have written. #include<iostream> #include<fstream> using namespace std; class myClass
1
9574
by: bhanupoornakumar | last post by:
Hi .. when i am setting a website i am getting the following error.. The compiler failed with error code -1073741819. This is the full error .. u can see below. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and...
9
32486
by: simple12 | last post by:
Hello I have a script which have the facility of entering any code to some part of a webpage. I have some problems with it. When i put some code in the script then their is no error shown. When i try to not use a code and leave it empty the following php errors happens. I dont understand why. Help me. Error shown are: - PHP Notice: in...
0
7408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7581
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7142
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7548
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5714
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.