Forum Topic: Php: Loops

(96 views • 3 replies)

This topic is 1 page long.

<< < > >>
None

Fallin-Again

Reply To Post Reply & Quote

Posted at: 5/3/09 10:50 PM

Fallin-Again EVIL LEVEL 11

Sign-Up: 08/24/04

Posts: 464

Ok I have a query that checks for an array in the database. And then I have a while loops which displays the info from the databse. I would like the while loop to only display the rows of the database which dont have a value in the array stored in the row.

I have tried for a day or two now and havent come up with a solution could someone assist me with the proper type of loops or a better way of doing so.

BBS Signature

None

Gateau

Reply To Post Reply & Quote

Posted at: 5/3/09 11:06 PM

Gateau FAB LEVEL 20

Sign-Up: 07/09/05

Posts: 1,443

<?
$Content = "";
if (!DatabaseConnect()) $DBErrorMsg = $Content = "Unable to connect to Database";
else{

$query = "SELECT * FROM table WHERE value = ''";
  $result = mysql_query($query);
    $num_rows = mysql_num_rows($result);
    
    if((!is_bool($result) || $result) && $num_rows) {
     while($row = mysql_fetch_array($result))
      {
	          $content = "";
	  } //while
	 } // if is_bool
	 else {
        $TickContent .= "<br />Unable to retrieve records from database.\n";    
          
    }
	
}

That will retrieve all of the blank data from the table... The loop and the query is there, dunno if that's what you are looking for or not :)

Interested? Probably not. It's okay, I wouldn't be either. Just PM me
Je parle Français, Ich spreche Deutsch! Don't worry, I speak English too!

BBS Signature

None

Fallin-Again

Reply To Post Reply & Quote

Posted at: 5/3/09 11:33 PM

Fallin-Again EVIL LEVEL 11

Sign-Up: 08/24/04

Posts: 464

well everytime the while loop comes back around i need it to check if the next row its gonna display has that variable in the column.

BBS Signature

None

WoogieNoogie

Reply To Post Reply & Quote

Posted at: 5/4/09 01:33 AM

WoogieNoogie LIGHT LEVEL 14

Sign-Up: 06/26/05

Posts: 3,284

Okay, I don't know if I'm just having trouble, but I REALLY can't understand what you need. Please be specific with exactly what you're doing. That would help immensely.

Honestly, if what I think you need is what you actually need...just use the query to filter the results. Like the last guy said.


All times are Eastern Standard Time (GMT -5) | Current Time: 11:35 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!