Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-06-2007, 05:49 AM   PM User | #1
rocky86
New to the CF scene

 
Join Date: Aug 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
rocky86 is an unknown quantity at this point
How to display all the record that matches the condition instead of just 1?

Hi ppl I need help with my php basically I manage to get my php to display the uname that matches the sql condition however it only return 1 record when there are 2 record that match the condition I understand that my code can only return the first row instead of the second or third row that matches the condition my question is how to modify my code to make it able to display not only the first but all of the row that fulfill the sql condition?

PHP Code:
$resultpostal=mysql_query("SELECT location.uname,location.uid FROM location,districts WHERE districts.districtno ='57' AND
location.lat BETWEEN districts.startlat AND districts.endlat AND location.lng BETWEEN districts.startlng AND districts.endlng"
);

$counterx=0;
while(
$row=mysql_fetch_array($resultpostal)){
foreach(
$row as $col_value){
$temp[$counterx]=$col_value;
$counterx++;
}


  
$report.="uid"."=".$temp[0]."&";
  
$report.="uname"."=".$temp[1]."&"
rocky86 is offline   Reply With Quote
Old 08-06-2007, 08:31 AM   PM User | #2
s_pradeep
New to the CF scene

 
Join Date: Aug 2007
Location: Kolkata,India
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
s_pradeep is an unknown quantity at this point
Use LEFT JOIN instead of an INNER JOIN
s_pradeep is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:41 AM.


Advertisement
Log in to turn off these ads.