DATE        ads visible
  2014-06-23   3    1
  2014-06-13   1    1
  2014-06-12   4    1
  2014-06-10   1    1
  2014-06-09   7    1
  2014-06-08   12   0
  2014-06-07   12   1

i have these three colums selected in mysql

through php i want to display the result like above on front end how can loop through all these columns after this check

if (!empty($adsList['ads']) and $adsList['visible']==1)
// display data here

Recommended Answers

All 3 Replies

Just a question, why not filter the results when you do your query with a where statement "select date, ads, visible from table where visible = 1".

Secondly, how are you fetching the data to your PHP ?, most common way to get your results out would be :

$result = $mysqli->query($query)

//start a table here

$icount  = 0;
while ($record = $result->fetch_object()) {
     //make the table row

     if ($record->visible == 1 && $record->ads != 0) {
       echo " $icount {$record->DATE} {$record->ads} {$record->visible} ";   
     }
     //close the table row
     $icount++;

}

//end table here

please can you convert this code in simple php i want to edit but dont understand this arrow language :p .

i got it done thanx :p

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.