Jump to content

get query info


proctk

Recommended Posts

Hi

 

I have a query that is returning the correct information however its adding in blank rows, I reviewed my tables to see if there were records that would cause this. I'm lookig to have somthing returned to help me determine why there are extra recoreds returned.

 

here is my code

 


$sqlbuddy = "
	SELECT buddylink.owner_id, buddylink.buddy_id, users.first_name,
	users.last_name, users.DOB 
	FROM buddylink 
	LEFT JOIN users ON buddylink.buddy_id = users.user_id ".$qryUserDate ."
	WHERE buddylink.owner_id = $id". $exString;

echo $sqlbuddy;
$qrybuddy = mysql_query($sqlbuddy)or die("SQL Error: $sqlbuddy<br>" . mysql_error());

 

$sqlBuddy returns

 

SELECT buddylink.owner_id, buddylink.buddy_id, users.first_name, users.last_name, users.DOB FROM buddylink LEFT JOIN users ON buddylink.buddy_id = users.user_id AND (month(users.DOB) = 03) WHERE buddylink.owner_id = 63 AND buddylink.buddy_id <>4 AND buddylink.buddy_id <>5 AND buddylink.buddy_id <>7 AND buddylink.buddy_id <>13 AND buddylink.buddy_id <>26 AND buddylink.buddy_id <>178

 

 

When I call the result

 

<?php while($rbuddy = mysql_fetch_assoc($qrybuddy)) : ?>
<?php echo 'Yes'.$rbuddy['DOB']; ?><br/>
<?php endwhile; ?>

 

I get

 

Yes

Yes

Yes1953-03-19

Yes1990-03-05

Yes

Yes1966-03-15

 

The Yes with no date next to them should not be there

 

any help is great

Link to comment
https://forums.phpfreaks.com/topic/94617-get-query-info/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.