Code: Select all
TABLE my_users (
id int(11) NOT NULL auto_increment,
username varchar(50) NOT NULL default '',
displayname varchar(50) NOT NULL default '',
PRIMARY KEY (id),
UNIQUE KEY id (id)
);
TABLE my_docs (
id int(11) NOT NULL auto_increment,
grp varchar(18) NOT NULL default '',
title varchar(171) NOT NULL default '',
intro text NOT NULL,
doc mediumtext NOT NULL,
active tinyint(4) NOT NULL default '0',
author varchar(45) NOT NULL default '',
date int(11) NOT NULL default '0',
PRIMARY KEY (id),
UNIQUE KEY id (id)
);// active is 1 (yes/display) or 0 (no/pending)
As I want to show visitors only active articles in PHP group, I did the following
Code: Select all
$doc_list = mysql_query ("select id,grp,title,intro,active,author,date from my_docs where grp = PHP and active = 1 order by id desc limit 5");
while ($doc = mysql_fetch_array($doc_list)) {
$postdate = date("m.d.Y",$doc[date]);
$time = date("H:i",$doc[date]);
$quser = mysql_query ("select id,username,displayname from my_users where username = '$doc[author]'");
$user = mysql_fetch_array ($quser);
echo "
<p>
<a href='?view=$doc[id]'><b>$doc[title]</b></a><br>
Author: <b>$user[displayname]</b> :: Posted $time, $postdate
<p>$doc[intro]
";A guy in EFNET has told me to put PHP in quotes (Like this grp = 'PHP'). I did, but it didn't help.
Thanks for reading

It's worked!