Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Syntax error...probably something simple

Posted on 2004-08-19
6
Medium Priority
?
216 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 17

Accepted Solution

by:
akshah123 earned 400 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

636 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