Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 26 Jun 2006, 20:45
LBSources LBSources is offline
 
Join Date: Nov 2005
Real name: Lenny
Question Error .. 1054 MYSQL .. Where Clause seems correct .. ideas?

This is a simple statement to draw some info on a home page regarding user stats .. right now the error i get is
Invalid SQL:
SELECT userid, username FROM myprefix_user WHERE myprefix_userid=2;

MySQL Error : Unknown column 'myprefix_userid' in 'where clause'
Error Number : 1054
I changed the prefix in this example, but the correct prefix is in the error. What exactly is it complaining about?


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
.....
LBSources

Learn About The Bronx, New York!
Reply With Quote
  #2  
Old 28 Jun 2006, 00:56
LBSources LBSources is offline
 
Join Date: Nov 2005
Real name: Lenny
bump ..
__________________
.....
LBSources

Learn About The Bronx, New York!
Reply With Quote
  #3  
Old 28 Jun 2006, 01:45
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #4  
Old 28 Jun 2006, 01:56
LBSources LBSources is offline
 
Join Date: Nov 2005
Real name: Lenny
ive seen the page before i was more hoping for somone to point out the error if it jumped out at them ..

I see the section you are pointing out, but how can i also set that syntax in this code.

cause it seems the problem is at this section


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
.....
LBSources

Learn About The Bronx, New York!
Reply With Quote
  #5  
Old 28 Jun 2006, 05:16
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Real name: Paul M
This is the same error as this thread ;

http://www.vbulletin.org/forum/showthread.php?t=119719

The broken line is this one ;


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

The table name is missing from the WHERE section after the table prefix.

i.e. TABLE_PREFIX . "userid should be TABLE_PREFIX . "user.userid

However, table prefix should not be used in WHERE clauses anyway, instead you should us an AS after the initial table selection, like this ;


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Finally, since only one table is actually used in this select, the table references can be dropped completely as no ambiguity is possible.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Former vBulletin.org Staff Member


Cable Forum
Please do not PM me about custom work - I no longer undertake any.
Note: I will not answer support questions via e-mail or PM - please use the relevant thread or forum.
Reply With Quote
  #6  
Old 28 Jun 2006, 05:25
LBSources LBSources is offline
 
Join Date: Nov 2005
Real name: Lenny
Paul, thanks this did help me also
__________________
.....
LBSources

Learn About The Bronx, New York!
Reply With Quote
  #7  
Old 28 Jun 2006, 05:31
VBUsers's Avatar
VBUsers VBUsers is offline
 
Join Date: Sep 2004
Thank you for the help much appreciated.
__________________
- Steve M.
Medical Marijuana Forums
High 5 Media LLC
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 21:22.

Layout Options | Width: Wide Color: