|
|
#1 |
|
Member
Join Date: Aug 2008
Posts: 63
Rep Power: 4 ![]() |
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 |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Mar 2006
Posts: 4,118
Rep Power: 101 ![]() ![]() |
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 |
|
|
|
|
|
#3 |
|
Member
Join Date: Aug 2008
Posts: 63
Rep Power: 4 ![]() |
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 |
|
|
|
|
|
#4 |
|
68 Classifieds Staff
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,776
Rep Power: 110 ![]() |
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 |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
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 |