Aureole Posted July 24, 2007 Share Posted July 24, 2007 I want to add something to my news script that I'm making where you can mark it as a draft or mark it as published. So I make a dropdown box saying draft or publish and I add a row to the database for it but how am I meant to change my queries to only show drafts to certain people. I will have an array... $canviewdrafts = array(1, 5, 7); But how am I meant to change my query so that only people whose member id is in that array can see drafts... Currently my query to retrieve news and show it is...like... <?php $query = "SELECT title, short, full, author, cat, id, date_format(date, '%a %D %b %Y %H:%i') as prettydate FROM news WHERE cat ='v' ORDER BY id DESC LIMIT 5"; $result = @mysql_query($query) or die(mysql_error()); if (mysql_num_rows($result)>0) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<a href=\"http://www.veraci7y.net/news/read.php?id={$row['id']}\" target=\"_blank\" title=\"Read full story...\" class=\"newstitle\">{$row['title']}</a><p class=\"newsinfo\">Posted by <a href=\"http://www.veraci7y.net/forums/index.php?showuser={$row['authorid']}\" class=\"user\" title=\"View Member\'s Profile\">{$row['author']}</a> <span class=\"newsdate\">{$row['prettydate']}</span></p><p class=\"newscontent\">{$row['short']}</p><br />"; // echo "<br /><a class=\"user\" href=\"javascript:openComments('$url')\">Comments</a></p><br />"; } } else { echo "$nonewstodisplay"; } ?> I just don't know how to change it so that drafts are only shown to certain people...and published posts are shown to everyone. Link to comment https://forums.phpfreaks.com/topic/61517-news-publisheddraft/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.