Jump to content

Lamez

Members
  • Posts

    1,686
  • Joined

  • Last visited

    Never

Everything posted by Lamez

  1. yes this is the code I am using.. <?php $path = ""; $title = "Website's Statistics"; $rank = "yes"; include ($path."main/include/cons/head.php"); $tot_usr = mysql_query("SELECT * FROM `users`")or NULL; $tot_usr = mysql_num_rows($tot_usr)or NULL; $banned = mysql_query("SELECT * FROM `users` WHERE `ban` = '1'")or NULL; $banned = mysql_num_rows($banned)or NULL; $admins = mysql_query("SELECT * FROM `users` WHERE `userlevel` = '9'") or NULL; $admins = mysql_num_rows($admins)or NULL; $members = mysql_query("SELECT * FROM `users` WHERE `userlevel` = '1'") or NULL; $members = mysql_num_rows($members)or NULL; $tot_pms = mysql_query("SELECT * FROM `messages` WHERE `id` >= 0") or NULL; $tot_pms = mysql_num_rows($tot_pms) or NULL; $un_pm = mysql_query("SELECT * FROM `messages` WHERE `recieved` = '0'")or NULL; $un_pm = mysql_num_rows($un_pm) or NULL; $re_pm = mysql_query("SELECT * FROM `messages` WHERE `recieved` = '1'")or NULL; $re_pm = mysql_num_rows($re_pm) or NULL; $top = mysql_query("SELECT * FROM `forum_question`")or NULL; $top = mysql_num_rows($top) or NULL; $res = mysql_query("SELECT * FROM `forum_answer`")or NULL; $res = mysql_num_rows($res) or NULL; echo' <p class="header">Website\'s Statistics</p> <p class="maintext"> <b>Total Users</b>: '.$tot_usr.' <br /> <b>Total Banned Users</b>: '.$banned.' <br /> <b>Total Admins</b>: '.$admins.' <br /> <b>Total Members</b>: '.$members.' <br /><br /> <b>Website Status</b>: '.$site_stat.' <br /><br /> <b>Total PMs</b>: '.$tot_pms.' <br /> <b>Total Unread PMs</b>: '.$un_pm.' <br /> <b>Total Read PMs</b>: '.$re_pm.' <br /><br /> <b>Total Forum Topics</b>: '.$top.' <br /> <b>Total Forum Responses</b>: '.$res.' </p>'; include ($path."main/include/cons/foot.php"); ?>
  2. wow thanks, now could I add or die as well!?
  3. Ok so I have a website's statistics page, and if one of the query is empty, it does not display any of the page. I am wondering how to fix this, here is the code: <?php $path = ""; $title = "Website's Statistics"; $rank = "yes"; $ban = "yes"; include ($path."main/include/cons/head.php"); $tot_usr = mysql_query("SELECT * FROM `users`")or die(mysql_error()); $tot_usr = mysql_num_rows($tot_usr)or die(mysql_error()); $banned = mysql_query("SELECT * FROM `users` WHERE `ban` = '1'")or die(mysql_error()); $banned = mysql_num_rows($banned)or die(mysql_error()); $admins = mysql_query("SELECT * FROM `users` WHERE `userlevel` = '9'") or die(mysql_error()); $admins = mysql_num_rows($admins)or die(mysql_error()); $members = mysql_query("SELECT * FROM `users` WHERE `userlevel` = '1'") or die(mysql_error()); $members = mysql_num_rows($members)or die(mysql_error()); $tot_pms = mysql_query("SELECT * FROM `messages` WHERE `id` >= 0") or die(mysql_error()); $tot_pms = mysql_num_rows($tot_pms) or die(mysql_error()); $un_pm = mysql_query("SELECT * FROM `messages` WHERE `recieved` = '0'")or die(mysql_error()); $un_pm = mysql_num_rows($un_pm) or die(mysql_error()); $re_pm = mysql_query("SELECT * FROM `messages` WHERE `recieved` = '1'")or die(mysql_error()); $re_pm = mysql_num_rows($re_pm) or die(mysql_error()); $top = mysql_query("SELECT * FROM `forum_question`")or die(mysql_error()); $top = mysql_num_rows($top) or die(mysql_error()); $res = mysql_query("SELECT * FROM `forum_answer`")or die(mysql_error()); $res = mysql_num_rows($res) or die(mysql_error()); echo' <p class="header">Website\'s Statistics</p> <p class="maintext"> <b>Total Users</b>: '.$tot_usr.' <br /> <b>Total Banned Users</b>: '.$banned.' <br /> <b>Total Admins</b>: '.$admins.' <br /> <b>Total Members</b>: '.$members.' <br /><br /> <b>Website Status</b>: '.$site_stat.' <br /><br /> <b>Total PMs</b>: '.$tot_pms.' <br /> <b>Total Unread PMs</b>: '.$un_pm.' <br /> <b>Total Read PMs</b>: '.$re_pm.' <br /><br /> <b>Total Forum Topics</b>: '.$top.' <br /> <b>Total Forum Responses</b>: '.$res.' </p>'; include ($path."main/include/cons/foot.php"); ?>
  4. so what do you need help with?
  5. lol never mind, I was right I just spelled something wrong
  6. ok now I am working on my PM system, and I cannot figure out how to total up the unread messages. My DB: sender, receiver, received, message, subject so when the user logs in I want them to see how many unreceived messages they have. so something like this? <?php $r = mysql_query("SELECT * FROM `messages` WHERE `receiver`='$user_' AND `received`='0'"); $total = mysql_num_rows($r); echo $total; ?>
  7. well, so what would be the best way? It looks like I am going to use the code posted before.
  8. that is not the problem, I am here to learn, and I can strip the file names, but I want to make the code my own, so I know exactly how it works. I just figured it would be easier to do a nested loop. And I am asking if my code would be correct.
  9. I am a bit confused by your code. could I do something like this: <?php function getExt($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $dir = $path."main/style/img/Helmets"; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if($file !== (".")){ if($file !== ("..")){ if($file !== ("index.html")){ echo'<option value="'.$file.'">'.$n_file.'</option>'; }//close index }//close . }//close . }//close while loop closedir($dh); }//close open dir $dh }//close is dir ?> but then all I get listed is dir, could I add this <?php if(is_dir($file){ echo "is dir?"; }else{ echo "is file?"; ?>
  10. wow that helps, but I get an output like: [0] => ../../main/style/img/Helmets/Atlantic Coast Conference/Boston College.jpeg how could I make it just Boston Collage
  11. oh cool, well now I have ran into a problem, I have some sub directorys, is there a way to go into the folder, and find all the images? then do that for all sub dirs? I think I would need a nested loop.
  12. Hi, and thank you for the link I did not know that existed (not the manual). But could you walk me trough this example code? I have commented some lines <?php $dir = "/etc/php5/"; // Open a known directory, and proceed to read its contents if (is_dir($dir)) { if ($dh = opendir($dir)) { //what is $dh? while (($file = readdir($dh)) !== false) { echo "filename: $file : filetype: " . filetype($dir . $file) . "\n"; //what is $file, filename? } closedir($dh); } } ?>
  13. How can I get all the file names in a directory? The reason is because I am using Java script to load images from a drop down box, but the you have to enter the image names, but I have tons and tons of images in my Helmet directory, so is there a for loop or something to find all the image names? <form name="<?php echo $path; ?>/main/style/img/Helmets/"><p> <select name="picture" size="1" onChange="showimage()"> <option value="img.gif">Picture 1</option> <option value="img_2.gif">Picture 2</option> <option value="img_3.gif">Picture 3</option> </select> </form>
  14. I have my own NCAA bracket system put together my self and I just made the drop down box have only 2 teams, now white space, so that way if they left one blank, then it would pick the top one. Do you get what I am saying?
  15. I might be just plan stupid, but what are you wanting to achieve much less talk about?
  16. <?php if ($a == (4)){ $a = "selected"; }else{ $a = ""; } ?> <select name="test" size=1> <option value="2">123</option> <option value="3">test</option> <option <?php echo $a; ?> value="4">something</option> </select>
  17. wow simple as that! Thanks
  18. oh ok, I will see if that helps!
  19. yes, this is how I know it is doing this
  20. ok so I am pulling all the information from the foot ball bowl database and I have selected 10 bowls, but with my query I have it comes out like this 1 10 2 3 5 ... 9 Why? here is my query <?php $q = mysql_query("SELECT * FROM `foot_bowls` ORDER BY `id` ASC"); ?>
  21. <?php $var = 100; if ($var = (200)){ echo "Has 200 referrals"; } if ($var = (100)){ echo "Has 100 referraks"; } ?> Please elaborate!
  22. This helped me a bit on the headers! I smell a sticky!
  23. Translation: Hi I am new here. First of all, hi and I need help with my php code. I just made a table in the database, how do I use the insert query on my website? Other question is, how do I make a hyper link to the database table in my php code? I think that is what he is say...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.