Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
CJ Webmaster Forums Forum Index » PHP & MySQL

   
SQL Syntax Error (Yet again) - Solved
View previous topic :: View next topic  
Author Message
centre
CJ-Design.com Moderator



Joined: 13 Jun 2004
Posts: 155
Location: Canada

Posted: Sat Nov 05, 2005 7:37 pm    Post subject: SQL Syntax Error (Yet again) - Solved

Alright, as you may know i am running a private messaging system. When I try to execute a query a get the following error with my syntax.

You have an error in your SQL syntax near 'AND pmb_message.from_user = Member.id' at line 1

The code where I execute this query is here:

Code:

$user_id = $_SESSION['user_id'];
$sql = 'SELECT Member.loginName,pmb_message.subject,pmb_message.hasRead,pmb_message.message_id FROM pmb_message,Member WHERE pmb_message.to_user = '.$user_id.' AND pmb_message.from_user = Member.id';


Please help.
_________________
centre
CJ Design Forum Moderator
(Sorry GodFatherUK, I stole your signature)

Also, CJ NewsFlash is in it's first stage of development.

Contact me here


Last edited by centre on Thu Dec 08, 2005 6:45 pm; edited 1 time in total
Back to top
darkcarnival
CJ-Design.com Admin



Joined: 10 Jul 2003
Posts: 1410
Location: Michigan

Posted: Sat Nov 05, 2005 10:17 pm    Post subject:

try this:

Code:
"SELECT * FROM pmb_message,Member WHERE pmb_message.to_user = '$user_id' AND pmb_message.from_user = 'Member.id'";


remember in sql querys variables have to have ''s and the query should be between ""s

also i editted all that above stuff with *, but thats just my thing
_________________
Admin of CJ-Design Forum
watch out spammers, I'm watching you!

offical rules:
http://www.cj-design.com/forum/viewtopic.php?t=2002

Elite Bulletin Board v0.5 try it out today!
http://www.elite-board.z42.us/

version 0.9 coming soon!
Back to top
PHPDUMMY
CJ-Design.com Moderator



Joined: 09 Mar 2005
Posts: 569
Location: South East Kentucky,U.S.A.

Posted: Tue Nov 08, 2005 2:02 am    Post subject:

im just curious , are you chopping out portions of the phpBB messaging abilities? see the "pmb_message" is straight out of the source code for the phpBB code...... just curious.......
_________________
Cheers,
Danny
C-J Search Engine All Tidied Up V4.0http://www.cj-design.com/forum/viewtopic.php?t=1820

C-J Search Engine MySQL !http://www.cj-design.com/forum/viewtopic.php?t=1555
Back to top
darkcarnival
CJ-Design.com Admin



Joined: 10 Jul 2003
Posts: 1410
Location: Michigan

Posted: Tue Nov 08, 2005 2:38 pm    Post subject:

hmm you know i thought i seen that code before

if you want, i can show you the basics of the concept.
_________________
Admin of CJ-Design Forum
watch out spammers, I'm watching you!

offical rules:
http://www.cj-design.com/forum/viewtopic.php?t=2002

Elite Bulletin Board v0.5 try it out today!
http://www.elite-board.z42.us/

version 0.9 coming soon!
Back to top
PHPDUMMY
CJ-Design.com Moderator



Joined: 09 Mar 2005
Posts: 569
Location: South East Kentucky,U.S.A.

Posted: Tue Nov 08, 2005 4:39 pm    Post subject:

Well , theres 2 well known scripts which make constant use of the "pmb_" , thats phpmyadmin & phpBB , it's almost like an internal trademark
_________________
Cheers,
Danny
C-J Search Engine All Tidied Up V4.0http://www.cj-design.com/forum/viewtopic.php?t=1820

C-J Search Engine MySQL !http://www.cj-design.com/forum/viewtopic.php?t=1555
Back to top
centre
CJ-Design.com Moderator



Joined: 13 Jun 2004
Posts: 155
Location: Canada

Posted: Wed Nov 09, 2005 12:22 am    Post subject:

Actually, I just found this awesome tutorial you can check out here:

http://infinitylimit.com/blog/?p=5#more-5

I'm just having a few errors.
_________________
centre
CJ Design Forum Moderator
(Sorry GodFatherUK, I stole your signature)

Also, CJ NewsFlash is in it's first stage of development.

Contact me here
Back to top
darkcarnival
CJ-Design.com Admin



Joined: 10 Jul 2003
Posts: 1410
Location: Michigan

Posted: Wed Nov 09, 2005 1:28 am    Post subject:

looking at that its not bad but i would try the link they posted at the above

the basic is:

look for the message sent to someuser

then output the results based on that
_________________
Admin of CJ-Design Forum
watch out spammers, I'm watching you!

offical rules:
http://www.cj-design.com/forum/viewtopic.php?t=2002

Elite Bulletin Board v0.5 try it out today!
http://www.elite-board.z42.us/

version 0.9 coming soon!
Back to top
PHPDUMMY
CJ-Design.com Moderator



Joined: 09 Mar 2005
Posts: 569
Location: South East Kentucky,U.S.A.

Posted: Wed Nov 09, 2005 2:28 am    Post subject:

well then , i guess that it was that tutorial site that has managed to swipe a bit of code......lol...
_________________
Cheers,
Danny
C-J Search Engine All Tidied Up V4.0http://www.cj-design.com/forum/viewtopic.php?t=1820

C-J Search Engine MySQL !http://www.cj-design.com/forum/viewtopic.php?t=1555
Back to top
Display posts from previous:   
       CJ Webmaster Forums Forum Index » PHP & MySQL All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2002 phpBB Group
iCGstation v1.0 Template By Ray © 2003, 2004 iOptional, Mods by CJ Website Design