Jump to content

Recommended Posts

this code was created with the support on this forum from another post.  It returns a result all the time using the mysql_sql_num_rows regardless if the out put is blank

 

thanks

 

      <?php $query_get_buddys = ("SELECT * FROM buddylink b
								 LEFT JOIN users u ON b.buddy_id = u.user_id AND month(u.DOB) ='$month'
								 WHERE b.owner_id = '$id'"); 

		$get_buddys = mysql_query($query_get_buddys) or die ("Invalid query". mysql_error());
	    
		while($buddyBirthdays = mysql_fetch_assoc($get_buddys)){

		//Get child birth day
		$buddyBirthDay = $buddyBirthdays['DOB'];
		$buddyBirthDay_array = explode("-",$buddyBirthDay);
		$buddy_day_num = $buddyBirthDay_array[2]; ?>
      <?php if(!empty($buddyBirthdays['DOB'])){?>
      <p class="bdayText"> <?php echo $buddy_day_num; ?> - <a class="bdayLink" href="../profile.php?id=<?php echo $buddyBirthdays['user_id'] ?>"><?php echo $buddyBirthdays['first_name'].' '.$buddyBirthdays['last_name']; ?></a>(<?php echo birthday($buddyBirthdays['DOB']) ?>)</p>
      <?php }else{}?>
      <?php }	?>
      <?php $query_get_buddys = ("SELECT * FROM buddylink b
								 LEFT JOIN users u ON b.buddy_id = u.user_id AND month(u.DOB) ='2'
								 WHERE b.owner_id = '$user_id'"); 

		$get_buddys = mysql_query($query_get_buddys) or die ("Invalid query". mysql_error());

		while($buddyBirthdays = mysql_fetch_assoc($get_buddys)){

		//Get child birth day
		$buddyBirthDay = $buddyBirthdays['DOB'];
		$buddyBirthDay_array = explode("-",$buddyBirthDay);
		$buddy_day_num = $buddyBirthDay_array[2]; ?>
      <?php if(!empty($buddyBirthdays['DOB'])){?>
      <p class="bdayText"> <?php echo $buddy_day_num; ?> - <a class="bdayLink" href="../profile.php?id=<?php echo $buddyBirthdays['user_id'] ?>"><?php echo $buddyBirthdays['first_name'].		' '.$buddyBirthdays['last_name']; ?></a>(<?php echo birthday($buddyBirthdays['DOB']) ?>)</p>
      <?php }else{}?>
      <?php }	?>

Link to comment
https://forums.phpfreaks.com/topic/67171-empty-query/#findComment-336953
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.