Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

44 users online



ffdb array displaying help

ffdb array displaying help

Currently viewing this thread: 1 (0 members and 1 guests)


nertman

nertman

lurker
Status: Offline!

ffdb array displaying help

i have a flat file database that looks like
sitename||siteurl||siteimage||discription||added||removed||reason||valid
mysite||domain.com||path/to/image.jpg||a really cool website||10.10.05|| || ||1

i want to loop through the array echoing the data for the ones that have 1 in the valid spot for my navigation display and only displaying the ones with 1 in the valid spot
then for another page i'd like to display all the data and echo the ones with 0 to be red text and the ones with 1 to be green
i know how to loop through the data outputting it all normally, but not how to check if there is a 0 or 1 in the valid feild then echoing it --current code

PHP:

<?php
$Lines 
file("data.txt");

foreach(
$Lines as $Key => $Val
{
   
$Data[$Key] = explode("||"$Val);
}

for(
$K 0$K sizeof($Lines); $K++) 

   echo 
'<p>';   
   echo 
'sitename:    '.$Data[$K][0].'<br>';
   echo 
'siteurl:        '.$Data[$K][1].'<br>';
   echo 
'siteimage:   '.$Data[$K][2].'<br>';
   echo 
'discription:  '.$Data[$K][3].'<br>';
   echo 
'added:        '.$Data[$K][4].'<br>';
   echo 
'removed:    '.$Data[$K][5].'<br>';
   echo 
'reason:       '.$Data[$K][6].'<br>';
   echo 
'valid:          '.$Data[$K][7].'<br>';
   echo 
'</p>';
}
?>

thanks for any help :]

Alekz

Alekz

So what's up :)
Status: Offline!
PHP:

<?php

$file 
file("data.txt");

foreach(
$file as $line) {
list(
$sitename,$siteurl,$siteimage,$description,$added,$removed,$reason,$valid) = explode('||',$line);

if(
$valid == 1) {
// use variables for echoing here
}
}

?>

For the second question just check

PHP:

<?php

$color 
$valid == 'style="color: red"' 'style="green"';

?>

I hope it helps :)

___________________

"¿Por qué buscais la felicidad, oh, mortales, fuera de vosotros mismos?"
~Boecio

nertman

nertman

lurker
Status: Offline!

Alekz, thanks so much i love the list command now haha thanks a lot again Alekz

Alekz

Alekz

So what's up :)
Status: Offline!

No problem :)

___________________

"¿Por qué buscais la felicidad, oh, mortales, fuera de vosotros mismos?"
~Boecio

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0077 seconds.