Solved

Syntax error...probably something simple

Posted on 2004-08-19
6
209 Views
Last Modified: 2013-12-12
Hello.
Can't get rid of a sytax error.  The code works (to send a message) ,but get the error re syntax ::

Code :
$nick = db_arr("SELECT NickName FROM Profiles WHERE ID=".($_GET[to]? $_GET[to] : $_GET[ID]));


Error:
Error in /compose.php: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Query: 'SELECT NickName FROM Profiles WHERE ID='


Help?
Thanks.
STeve
0
Comment
Question by:Steve_Newbie
  • 3
  • 3
6 Comments
 
LVL 17

Expert Comment

by:akshah123
ID: 11846530
your this line of code

($_GET[to]? $_GET[to] : $_GET[ID])

is not getting anything.  That's the problem
0
 
LVL 17

Expert Comment

by:akshah123
ID: 11846533
perhaps botth $_GET[to] and $_GET[ID] are empty.
0
 

Author Comment

by:Steve_Newbie
ID: 11846587
?
Not a programmer, so pardon if this does not make sense.....but this code seems to define NickName, so that $nick is set and echos correctly when called one line later via:
echo "<b>TO:<font color=red>$nick[0]</font></b>";

Without that line $nick and NickName do not echo.....with it, $nick does.  (That is what I am trying to do with this.)  
?
Steve
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 17

Accepted Solution

by:
akshah123 earned 100 total points
ID: 11846619
I understand what you are tyring to do but the problem is that variable $_GET[to] and $_GET[ID] do not hold any values.

Try this

$nick = db_arr("SELECT NickName FROM Profiles WHERE ID=\"".($_GET[to]? $_GET[to] : $_GET[ID]) . "\"");

If above does not return anything then  $_GET[to] and $_GET[ID] are empty.
0
 

Author Comment

by:Steve_Newbie
ID: 11846713
Actually, it works fine.  That was it.  Don't ask....been working on the actual code for two weeks to get it to do the message echo and send....this was just the final touch (getting rid of the syntax error).  IT works, well, and that is fine......
Thanks very much.
!!
Steve
0
 

Author Comment

by:Steve_Newbie
ID: 11846723
IF I am missing something (which is way probable) please don't hesitate to post a final comment.  Thanks again.
Steve
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now