Solved

Syntax error...probably something simple

Posted on 2004-08-19
6
211 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
ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to count occurrences of each item in an array.
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.

770 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