PHP Web Host - Quality Web Hosting For All PHP Applications Free RavenNuke(tm) Add Ons
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
ThePiston
Worker
Worker


Joined: Dec 22, 2004
Posts: 135

PostPosted: Tue Sep 27, 2005 3:14 pm Reply with quote Back to top

I have this code in the beginning of my "edithome" function of "Your Account" index.php file
Code:
$sql = "select u.user_id, u.name, o.user_id, o.offname, o.add1, o.add2, o.city, o.state, o.zip, o.phone, o.fax FROM nuke_users u, offices o WHERE username='$check'";
Shouldn't that only pull those specific data points from the DB where username = "whoever the cookie is set to"? Right now, it pulls info from all members and not just the specific "username" from cookie. I tried to use WHERE userID='$check', but Igot an error.

PS - i know NOTHING about PHP, I am pretty much cutting and pasting my way around this problem and now I'm stuck....
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Tue Sep 27, 2005 6:32 pm Reply with quote Back to top

Not the way it is written. This has nothing at all to do with PHP. It is an SQL issue. When you join 2 tables and you do not cross reference the two tables by a common column, you wil get what is called a Cartesian join, or all members from both tables that match any of the criteria. You are matching the username to $check but I can't see where you are matching the users table to the office table. You need to do something like

where u.username='$check' and u.SOMEFIELD=o.SOME_OTHERFIELD;
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
ThePiston
Worker
Worker


Joined: Dec 22, 2004
Posts: 135

PostPosted: Tue Sep 27, 2005 8:30 pm Reply with quote Back to top

d***! i knew this would be harder than I thought. What's the best "SQL and PHP for dummies" book?
View user's profile Send private message
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9136
Location: Arizona

PostPosted: Tue Sep 27, 2005 8:40 pm Reply with quote Back to top

I have had great luck with the "Bible" series of books such as "The Javascript Bible" and "PHP and mySQL Bible", etc... never had a bad book from this series.

Regards,
montego
View user's profile Send private message Visit poster's website
ThePiston
Worker
Worker


Joined: Dec 22, 2004
Posts: 135

PostPosted: Wed Sep 28, 2005 9:21 am Reply with quote Back to top

I havn't learned code since Apple II... it's addictive and I have a new bidness and a new baby on the way... could be trouble.
View user's profile Send private message
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9136
Location: Arizona

PostPosted: Wed Sep 28, 2005 7:50 pm Reply with quote Back to top

Yup, you are in trouble! I can say that from experience, however, I've been coding in one form or the other for over 20 years... and, yes, it is very addictive!

Don't worry, the Baby and wife will "help" you with the priorities... Laughing

montego
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum