Jump to content


Photo

Database Logs


  • Please log in to reply
3 replies to this topic

#1 CJLeah

CJLeah
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 12 June 2006 - 05:23 PM

<?php $sql_logs = mysql_query("SELECT * FROM logs ORDER by id DESC LIMIT 0, 25");
$logs_data = mysql_fetch_assoc($sql_logs);
do {
echo($logs_data['userid,username,hostname,time,type,message']);
} while ($logs_data = mysql_fetch_assoc($sql_logs)); ?>

hello the above code, is what i'm trying to use to show all log's in the database, it shows NO log information, just leave's it blank. Please HELP guys, thank you.

Chris Leah

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 12 June 2006 - 05:33 PM

Okay this code here is completly wrong:
echo($logs_data['userid,username,hostname,time,type,message']);
it should be this:
echo $logs_date['userid'] . "<br />\n" . $logs_date['username'] . "<br />\n";
echo $logs_date['hostname'] . "<br />\n" .  $logs_date['time'] . "<br />\n";
echo $logs_date['type'] . "<br />\n" . $logs_date['message'];


#3 CJLeah

CJLeah
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 12 June 2006 - 05:40 PM



My mistake, you put date instead of data, works now. thank you

#4 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 12 June 2006 - 06:04 PM

FYI, I've edited the title... try to keep the 4-letter words out of the titles... I don't care so much about the content of the thread itself, but we don't need the younger crowd seeing that on the index.

And please be more descriptive with your titles in the future.

Info: PHP Manual





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users