Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I make a php code so my category is able to be viewed by certian user ranks
    text
    copied!<p>Here is my php code. I want to know if its possible to make an if statement so it can only be viewed by the user with a user level of 1. I tried an if statement but I get an Unexpected T_STRING my database had this <a href="http://prntscr.com/glmqi" rel="nofollow">http://prntscr.com/glmqi</a> cat_mod is for the if statement because it's a moderator topic.</p> <pre><code>&lt;?php $sql = "SELECT cat_id, cat_name, cat_description FROM categories WHERE cat_id = " . mysql_real_escape_string($_GET['id']); $result = mysql_query($sql); if(!$result) { echo 'The category could not be displayed, please try again later.' . mysql_error(); } else { if(mysql_num_rows($result) == 0) { echo 'This category does not exist.'; } else { //display category data while($row = mysql_fetch_assoc($result)) { echo ' &lt;h3&gt;You are currently in this section: &lt;u&gt;' . $row['cat_name'] . '&lt;u/&gt;&lt;/h3&gt; &lt;/div&gt; &lt;div class="container_oro2" style="overflow: hidden;"&gt; Users currently viewing this section: &lt;/div&gt;&lt;div class="header"&gt; &lt;h3 class="header_title"&gt;Topics in this section&lt;/h3&gt; &lt;div class="header_topics"&gt;Hits&lt;/div&gt; &lt;div class="header_replies"&gt;Replies&lt;/div&gt; &lt;div class="header_action"&gt;Last Action&lt;/div&gt; &lt;/div&gt;&lt;table class="container"&gt;'; } //do a query for the topics $sql = "SELECT topics.topic_id, topics.topic_subject, topics.topic_date, topics.topic_cat, topics.topic_by, topics.view, topics.reply, users.user_id, users.user_name FROM topics LEFT JOIN users ON topics.topic_by = users.user_id WHERE topic_cat = " . mysql_real_escape_string($_GET['id']); $result = mysql_query($sql); if(!$result) { echo 'The topics could not be displayed, please try again later.'; } else { if(mysql_num_rows($result) == 0) { echo 'There are no topics in this section yet.'; } else { //prepare the table while($row = mysql_fetch_assoc($result)) { echo ' &lt;tr class="altcolor_2"&gt;'; echo '&lt;td class="title"&gt;'; echo ' &lt;table&gt;'; echo '&lt;tr&gt;'; echo '&lt;td class="title_icon_small"&gt; &lt;img src="http://www.naruto-boards.com/images/forum/topic_old.gif" alt="" /&gt; &lt;/td&gt; &lt;td class="title_icon_small"&gt; &lt;img src="http://www.naruto-boards.com/images/forum/topic_sticky.gif" alt="" /&gt; &lt;/td&gt; &lt;td class="title_title"&gt;'; echo '&lt;h4 class="inline"&gt;&lt;a href="/index.php?area=topic&amp;id=' . $row['topic_id'] . '"&gt;' . $row['topic_subject'] . '&lt;/a&gt; '; echo '&lt;img class="pages" src="http://naruto-boards.com/images/forum/topic_paging.gif" alt="" /&gt; &lt;/h4&gt; '; echo'&lt;span&gt;Started on '; echo date(" F j, Y, g:i A", strtotime($row['topic_date'])); echo' by &lt;a href="/profile/kross/" class="profilelink"&gt;&lt;/a&gt;&lt;/span&gt;'; echo '&lt;/td&gt;'; echo '&lt;/tr&gt;'; echo '&lt;/table&gt;'; echo '&lt;/td&gt;'; echo '&lt;td class="info1"&gt;' . $row['view'] . '&lt;/td&gt;'; echo '&lt;td class="info1"&gt;' . $row['reply'] . '&lt;/td&gt;'; echo '&lt;td class="info2"&gt; &lt;div&gt;'; echo'Date: ';echo date(" F j, Y, g:i A", strtotime($row['topic_date']));echo'&lt;br /&gt;'; echo 'By: &lt;a href="/profile/igi33/" class="profilelink"&gt;&lt;/a&gt;'; echo '&lt;/div&gt;'; echo '&lt;/td&gt;'; echo '&lt;/tr&gt;'; echo '&lt;tr class="spacer"&gt;&lt;td colspan="4"&gt;&lt;/td&gt;&lt;/tr&gt; '; } } } } } ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload