Jump to content

help with query


nepzap2

Recommended Posts

First I want to thank all of you for all your help.

 

I need a little help with this query, I'm trying to check if the column "active" in the sa_events table has any rows with the word yes to print otherwize print all the other rows that have the word no. My query prints the row with the word yes in the active column but when I delete it it does not print it doesn't print the row with the word no.

 

Any help is greatly appreciated.

 

Below is my code.

 

Thanks

 


<?php
		include 'zdb_config.php';

		$data = mysql_query("SELECT * 
							 FROM sa_events
							 WHERE sa_events.active = 'yes'")
		or die(mysql_error());

		while($info = mysql_fetch_array($data))


			if ($data) {
				print "<p style='line-height: 12px;'>" .$info['id']. "<br />" 
							.$info['title']. "<br />" 
							.$info['date_time']. "<br />"
							.$info['category']. "<br />"
							.$info['speaker']. "<br />"
							.$info['room']. "<br />"
							.$info['description']. "</p>"; 

			} else {

				$data = mysql_query("SELECT * 
									 FROM sa_events
									 WHERE sa_events.active = 'no'")
				or die(mysql_error());

				while($info = mysql_fetch_array($data))

				print "<p style='line-height: 12px;'>" .$info['id']. "<br />" 
							.$info['title']. "<br />" 
							.$info['date_time']. "<br />"
							.$info['category']. "<br />"
							.$info['speaker']. "<br />"
							.$info['room']. "<br />"
							.$info['description']. "</p>";
			}

	?>

Link to comment
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.