Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> MySQL
Author Message
helsnicht
Hangin' Around



Joined: Jan 25, 2008
Posts: 44

PostPosted: Tue Jun 10, 2008 9:42 am Reply with quote

Code:
$result9 = $db->sql_query("SELECT * 

FROM " . $prefix . "_milpacs_members m
LEFT JOIN  " . $prefix . "_milpacs_members m1
ON m.reports = m1.uniqueid");
   while ($member1row = $db->sql_fetchrow($result9)) {
      if ($member1row[reports]==0) {
         $reports = 'N/A';
      } else {
         $reports = '<a href="modules.php?name='.$module_name.'&amp;file=soldierprofile&amp;uniqueid='.$info[reports].'">'.$member1row['rank_abbr'].' '.$member1row['lastname'].'</a>';
      }
   }


I have almost no experience with mysql queries so I've just been copy & pasting til something shows. Which to my surprize it did, but its displaying the exact same rank_abbr/lastname for every reports/uniqueid number. So I'm assuming I written it wrong. Can someone show me where I went wrong with the above code?
 
View user's profile Send private message Visit poster's website
fkelly
Former Moderator in Good Standing



Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Tue Jun 10, 2008 10:04 am Reply with quote

" if ($member1row[reports]==0)" { you need single quotes around reports I believe.

I don't know if you'll get an undefined constant ... assuming ... error message or not. Turn on error reporting all the way.
 
View user's profile Send private message Visit poster's website
helsnicht







PostPosted: Tue Jun 10, 2008 10:44 am Reply with quote

Thanks for the reply fkelly.

You mean like this?
if ($member1row['reports']==0) {

If so then yeah, I've tried it like that. I get no errors, just the same issue of it showing a different user's info then what it should show.

Also after playing with the values in the database it appears to be calling the reports id from the last member in the table. Any clue?
 
helsnicht







PostPosted: Tue Jun 10, 2008 5:45 pm Reply with quote

Nevermind, after playing with it some more I figured out what I left out.

m.uniqueid = '$uniqueid'

Thanks anyways.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> MySQL

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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©