If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Perl and the DBI > SQL Query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-21-11, 21:35
l flipboi l l flipboi l is offline
Registered User
 
Join Date: Mar 2011
Posts: 3
Cool SQL Query

Hello,

Can someone please help me figure this out?

I can make a query like so....

"SELECT * FROM ACCOUNT WHERE ID = '1.3.500'"

but for some reason, this query is not working:

$account = 1.3.500;

"SELECT * FROM ACCOUNT WHERE ID = " . $account;

what am I doing wrong? is there another format to query using a variable?

Thanks!!
Reply With Quote
  #2 (permalink)  
Old 03-21-11, 22:39
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,538
looks like you forgot the single quotes

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 03-22-11, 17:15
l flipboi l l flipboi l is offline
Registered User
 
Join Date: Mar 2011
Posts: 3
Thanks! Here's how i got it to work:

"SELECT * FROM ACCOUNT WHERE ID = '$account'";
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On