Support Forums

Old 01-18-2009, 01:15 PM   #1
Member
 
Join Date: Aug 2008
Posts: 63
Rep Power: 4
nagrap2 is on a distinguished road
Default SELECT Error

Hi,

I am modifying a query in one my functions listed under the smarty folder by joining two tables.

The SQL code I am using is as follows:

$sSQL="SELECT id,title,price,dateadded,firstname,lastname FROM ".PREFIX."listings, u.".PREFIX."users WHERE u.id = owner AND display = 'Y' AND expiration > NOW() ORDER BY dateadded desc LIMIT ".$number;

I am getting following error on my php page:

Notice: Query failed: SELECT command denied to user 'xxxxxxxxxxx'@xxxxxxxxxxxxxx' for table 'class_users' SQL: SELECT id,title,price,dateadded,firstname,lastname FROM class_listings, u.class_users WHERE u.id = owner AND display = 'Y' AND expiration > NOW() ORDER BY dateadded desc LIMIT 8 in /home/content/t/u/t/tutorheaven/html/includes/classes/database/mysql.php on line 134

I have replaced the username and ip address with "xxxxxxxxxxxxxx" above.

Can someone let me know why I'm getting this error and how can I resolve?

Thanks in advance...
__________________
Many Thanks,

Nagrap2

Developer Version 4.1
nagrap2 is offline   Reply With Quote
Old 01-18-2009, 01:18 PM   #2
Moderator
 
 
Join Date: Mar 2006
Posts: 4,118
Rep Power: 101
Lhotch is just really niceLhotch is just really nice
Default

Was there an existing query in the file and function you are editing?

Also, it helps us if you can be a bit more specific about the file and/or function you are editing.
__________________
Larry.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Lhotch is offline   Reply With Quote
Old 01-18-2009, 02:21 PM   #3
Member
 
Join Date: Aug 2008
Posts: 63
Rep Power: 4
nagrap2 is on a distinguished road
Default

Hi,

I originally made a copy of "smarty_function_feature_listings_horizontal" and modified the SQL so that it displays new listings and named the function "smarty_function_new_listings_horizontal". Location: homepage\includes\classes\smarty\plugins

The function was working fine with the original SQL I had modified: $sSQL="SELECT id,title,price,dateadded FROM ".PREFIX."listings WHERE display = 'Y' AND expiration > NOW() ORDER BY dateadded desc LIMIT ".$number;

I then wanted to add the First Name and Last Name of the owner of each listing and so changed the SQL to the following, and this is now giving me the error I mentioned:

$sSQL="SELECT id,title,price,dateadded,firstname,lastname FROM ".PREFIX."listings, u.".PREFIX."users WHERE u.id = owner AND display = 'Y' AND expiration > NOW() ORDER BY dateadded desc LIMIT ".$number;
__________________
Many Thanks,

Nagrap2

Developer Version 4.1
nagrap2 is offline   Reply With Quote
Old 01-18-2009, 02:29 PM   #4
68 Classifieds Staff
 
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,776
Rep Power: 110
Eric Barnes is a jewel in the rough
Default

I think it should be:
FROM ".PREFIX."listings LEFT JOIN ".PREFIX."users AS u
__________________
Eric Barnes
68 Classifieds Developer
Please do not send me a private message asking for support. Instead use these open forums or our ticket system.

Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules
Eric Barnes is offline   Reply With Quote

Bookmarks

Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Categories for Coupons bluepx Feature Requests 1 11-14-2008 08:48 AM
If I only have 1 country can a user select states? gstar Pre Sales Questions 5 09-11-2008 07:51 AM
Add Listing - Select Package antboy v3.1 Modules & Modifications 1 04-19-2008 05:24 AM
Select Provinces By Country. pschievink v3.1 Questions & Support 0 07-06-2007 02:02 PM
Install or Upgrade 3.1.0 - what to select dawyatt v3.1 Questions & Support 6 05-11-2006 04:41 PM


All times are GMT -4. The time now is 07:47 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0