RE: [PHP-DB] Re: PHP-WIN MYSQL Double results

2003-01-30 Thread Hutchins, Richard
Try this:

After this line:
 $prcp = mysql_query($pquery);

add this line:
print_r($prcp);
(For additional info: http://www.php.net/manual/en/function.print-r.php)

What that should do is print the results directly from your query (which are
stored as an associative array) before anything else is done with it. So, if
your query is returning a single row in the MySQL monitor, and you expect it
to return the same thing when called from your script, print_r() should
confirm that for you.

If print_r returns double results, then there's a problem with your query.
If it doesn't then there's a problem further down in your code.

 -Original Message-
 From: Chris Deam [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 30, 2003 3:07 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Re: PHP-WIN MYSQL Double results
 
 
 ?
 $pquery = SELECT
 problem_list.code,freetext,problems.DESC1,stopdate,problem_lis
 t.problem_id
 from problem_list, problems where patient_id='$patid' AND 
 problem_list.code
 = problems.code ORDER BY stopdate DESC;
 $prcp = mysql_query($pquery);
 ?
 TABLE BORDER=2 CELLPADDING=0 CELLSPACING=0 WIDTH=100%
 ALIGN=CENTER
 TR
 ?
 while ($row = mysql_fetch_array($prcp)) {
 echo TRTDINPUT TYPE=\Checkbox\ NAME=\del[]\
 VALUE=\$row[4]\/TDTDFONT COLOR=\WHITE\nbsp
 $row[0]/FONT/TDTDFONT COLOR=\#99\nbsp
 $row[2]/FONT/TDTDFONT COLOR=\darkblue\nbsp
 $row[1]/FONT/TDTDFONT COLOR=\EEFF99\nbsp
 $row[3]/FONT/TD/TR;
 }
 ?
 /TABLE
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Re: PHP-WIN MYSQL Double results

2003-01-30 Thread Chris Deam
Okay, I used print_r but now I get Resource Id #19 no sort of array info.




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Re: PHP-WIN MYSQL Double results

2003-01-30 Thread Chris Deam
Okay, I kinda fixed it.  I added the DISTINCT option to the sql query.
DISTINCT returns only one row when multiples arre found.  What I don't
understand is that there is only one row returned in the MYSQL console.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php