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....
Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
Posted:
Tue Sep 27, 2005 6:32 pm
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;
Joined: Aug 29, 2004 Posts: 9136 Location: Arizona
Posted:
Tue Sep 27, 2005 8:40 pm
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.
Joined: Aug 29, 2004 Posts: 9136 Location: Arizona
Posted:
Wed Sep 28, 2005 7:50 pm
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...
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