-
Posts
1,686 -
Joined
-
Last visited
Never
Everything posted by Lamez
-
I need help bad, I have been at this for hours, and I am getting no luck. Here is how I need help. I have table that pulls out all the user picks, username, and total points. here is how I want it: Username | Lamez | Anotheruser | MyUsername | tester | -------------------------------------------------------------- 2nd Round| TeamA | Team B | Team C | TeamD| -------------------------------------------------------------- |Team D | TeamG | Team AD | TeamL| -------------------------------------------------------------- |Team H | TeamY | Team N |TeamM| -------------------------------------------------------------- and so on, but It does not look like that, I do not think I am putting my loop in the right place, could someone guide me where to put my other loop. here is what I have so far: <?php include ("../../style/include/session.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php $user = mysql_query("SELECT username FROM users"); $r = mysql_query("SELECT * FROM rnd1 WHERE username = '$user'"); $rnd1 = mysql_fetch_array($r); $rto = mysql_query("SELECT * FROM userpoints WHERE username = '$user'"); ?> <table width="604" border="1"> <tr> <td width="76">Username</td> <?php while($username = mysql_fetch_array($user)){ ?> <td width="190"><?php echo $username['username']; ?></td> <td width="316"> </td> <?php } ?> </tr> <tr> <td>2nd Round </td> <td><?php echo $rnd1['a1']; ?></td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> </body> </html> -Thanks Guys
-
sorry for wasting a thread, I got it, here is my code so far: <?php $num = 2; include ("include/session.php"); $page = isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] >= 1 ? $_GET['page'] : 1; $per_page = $num; $count_q = mysql_query("SELECT COUNT(username) FROM ".TBL_USERS." ORDER BY username DESC"); $count_r = mysql_fetch_row($count_q); $count = $count_r[0]; if($page > ceil($count/$per_page)) $page = 1; $limit_min = ($page-1)*$per_page; $query = mysql_query("SELECT * FROM ".TBL_USERS." ORDER BY username DESC LIMIT {$limit_min}, {$per_page}"); ?> <table width="33%" border="0" align="left"> <form aciton="<?php $_SERVER['PHP_SELF']?>" method="get"> <tr> <td width="12%"></td> <td width="16%">Sort By: </td> <td colspan="2"><select name="sort"> <option value="all&" selected="selected">All Members</option> <option value="online">Online</option> <option value="offline">Offline</option> <option value="a">Username A-Z</option> <option value="z">Username Z-A</option> <option value="last">Last Logged In</option> </select> <label> <input type="submit" name="Sort" value="Sort" /> </label></td> </tr> </form> <tr> <td colspan="2"><strong>Username</strong></td> <td width="35%" align="left"><strong>E-Mail</strong></td> <td width="37%" align="left"><strong>Status</strong></td> </tr> <?php $getlink = $_GET["sort"]; if ($getlink == "all&") { while($rs = mysql_fetch_assoc($query)) { $users = $rs['username']; ?> <tr> <td colspan="2" align="left"><?php echo '<a href="userinfo.php?user='.$users.'">'.$users.'</a>'; ?></td> <td align="left"><?php echo $rs['email']; ?></td> <td align="left"> <?php $que = mysql_query("SELECT u.username FROM ".TBL_USERS." u INNER JOIN ".TBL_ACTIVE_USERS." a ON a.username=u.username WHERE a.timestamp < (NOW() - INTERVAL 5 MINUTE) AND u.username= '$users'")or die(mysql_error()); if (mysql_num_rows($que) > 0) { echo "<font color=\"#04db04\">Online</font><br />"; }else{ echo "<font color=\"#FF0000\">Offline<br /></font>"; } echo '</td>'; echo '</tr>'; } } ?> <tr> <td colspan="4"> <?php $limit2 = $per_page; $q = "SELECT username FROM ".TBL_USERS; $r = mysql_query($q); $num = ceil(mysql_num_rows($r) / $limit2); if($num != 1) { for($i = 1; $i <= $num; $i++) { if ($getlink == "all&"){ $var = "sort=all%26&Sort=Sort"; } /*if($page / $limit2 != $i)*/ echo "[<a href='?".$var."&list&page=".$i."'>".$i."</a>] "; //else echo "[<b>".$i."</b>] "; } } ?> </td> </tr> </table>
-
Alright on my member's list, I am trying to sort them, and have pagination, but it is not working. with out sorting, I have it like this so I want it like this how? here is my code, any suggestions? <?php $num = 2; include ("include/session.php"); $page = isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] >= 1 ? $_GET['page'] : 1; $per_page = $num; $count_q = mysql_query("SELECT COUNT(username) FROM ".TBL_USERS." ORDER BY username DESC"); $count_r = mysql_fetch_row($count_q); $count = $count_r[0]; if($page > ceil($count/$per_page)) $page = 1; $limit_min = ($page-1)*$per_page; $query = mysql_query("SELECT * FROM ".TBL_USERS." ORDER BY username DESC LIMIT {$limit_min}, {$per_page}"); ?> <script type="text/JavaScript"> <!-- function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } //--> </script> <table width="33%" border="0" align="left"> <form aciton="<?php $_SERVER['PHP_SELF']?>" method="get"> <tr> <td width="12%"></td> <td width="16%">Sort By: </td> <td colspan="2"><select name="sort"> <option value="all&" selected="selected">All Members</option> <option value="online">Online</option> <option value="offline">Offline</option> <option value="a">Username A-Z</option> <option value="z">Username Z-A</option> <option value="last">Last Logged In</option> </select> <label> <input type="submit" name="<?php echo md5("sort"); ?>" value="Sort" /> </label></td> </tr> </form> <tr> <td colspan="2"><strong>Username</strong></td> <td width="35%" align="left"><strong>E-Mail</strong></td> <td width="37%" align="left"><strong>Status</strong></td> </tr> <?php $getlink = $_GET["sort"]; if ($getlink == "all&") { while($rs = mysql_fetch_assoc($query)) { $users = $rs['username']; ?> <tr> <td colspan="2" align="left"><?php echo '<a href="userinfo.php?user='.$users.'">'.$users.'</a>'; ?></td> <td align="left"><?php echo $rs['email']; ?></td> <td align="left"> <?php $que = mysql_query("SELECT u.username FROM ".TBL_USERS." u INNER JOIN ".TBL_ACTIVE_USERS." a ON a.username=u.username WHERE a.timestamp < (NOW() - INTERVAL 5 MINUTE) AND u.username= '$users'")or die(mysql_error()); if (mysql_num_rows($que) > 0) { echo "<font color=\"#04db04\">Online</font><br />"; }else{ echo "<font color=\"#FF0000\">Offline<br /></font>"; } echo '</td>'; echo '</tr>'; } } ?> <tr> <td colspan="4"> <?php $limit2 = $per_page; $q = "SELECT username FROM ".TBL_USERS; $r = mysql_query($q); $num = ceil(mysql_num_rows($r) / $limit2); if($num != 1) { for($i = 1; $i <= $num; $i++) { /*if($page / $limit2 != $i)*/ echo "[<a href='?p=list&page=".$i."'>".$i."</a>] "; //else echo "[<b>".$i."</b>] "; } } ?> </td> </tr> </table>
-
give uploader.php permission set it to 777 as well.
-
add or die (mysql_error()); at the end of all your querys example: mysql_query("SELECT * FROM table") or die (mysql_error());
-
1. I am working with images, and is there a function where I can resize a picture? 2.This is one is kinda hard to explain, so let me explain what I need a certain function for: Alright, when a user uploads a image, I want the script to delete their old one, well the image name is hased, except the last part of the name is their username. The image name looks like this: here is the code to get the image name. md5($new_filename)."-".$user.".".getExt($bfilename); as you can see, before the extension is their username, so is there a function that can take last part of the filename before the extension, and tell if it is the user that is trying to upload a new image?
-
wow that worked great, except the bolding does not work too well, but I will take it out, thanks final code: <?php include ("style/include/session.php"); $page = isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] >= 1 ? $_GET['page'] : 1; $per_page = 10; $count_q = mysql_query("SELECT COUNT(username) FROM ".TBL_USERS." ORDER BY username DESC"); $count_r = mysql_fetch_row($count_q); $count = $count_r[0]; if($page > ceil($count/$per_page)) $page = 1; $limit_min = ($page-1)*$per_page; $query = mysql_query("SELECT * FROM ".TBL_USERS." ORDER BY username DESC LIMIT {$limit_min}, {$per_page}"); while($r = mysql_fetch_assoc($query)) { echo $r['username'] ."<br>"; } $limit2 = $per_page; $q = "SELECT username FROM ".TBL_USERS; $r = mysql_query($q); $num = ceil(mysql_num_rows($r) / $limit2); if($num != 1) { for($i = 1; $i <= $num; $i++) { /*if($page / $limit2 != $i)*/ echo "[<a href='?p=list&page=".$i."'>".$i."</a>] "; //else echo "[<b>".$i."</b>] "; } } ?> however if I set the limit2 to 4, and click on page 4 it makes one disappear, well no biggy, thanks you guys very much!
-
you need to set the folder chmode to 777, not 700
-
aww this looks neat, so all I really need to do is change the query, and define $limit2?
-
anyone know how do setup the links?
-
oh never thought of that.
-
Could someone post a code that will upload files? Not html, but the php end, I think I am doing mine wrong.
-
try the CSS board --> http://www.phpfreaks.com/forums/index.php/board,5.0.html
-
alright now I am trying to make the links Prev Page [1] [2] [3] Next Page I can make it go from page 1 to page 2, but that is about all, could someone give me some advice? code: <?php include ("include/session.php"); $page = isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] >= 1 ? $_GET['page'] : 1; $per_page = 1; $count_q = mysql_query("SELECT COUNT(username) FROM ".TBL_USERS); $count_r = mysql_fetch_row($count_q); $count = $count_r[0]; if($page > ceil($count/$per_page)) $page = 1; $limit_min = ($page-1)*$per_page; $query = mysql_query("SELECT * FROM ".TBL_USERS." ORDER BY username DESC LIMIT {$limit_min}, {$per_page}"); while($r = mysql_fetch_assoc($query)) { echo $r['username'] ."<br>"; } $nxt = $page + 1; $prv = $nxt - 2; echo '<a href="?page='.$nxt.'">Next Page</a><br>'; echo '<a href="?page='.$prv.'">Prev Page</a>'; ?>
-
that is javascript. you can do <script>alert("hi");</script> that is only a ok box.
-
oh a stupid mistake, thanks it works now
-
it is not working I am getting an error, it is: Warning: Division by zero in /mounted-storage/home48c/sub007/sc33591-LWQU/uploads/Login System v.2.0/list.php on line 12 here is my new code: <?php include ("include/session.php"); $page = isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] >= 1 ? $_GET['page'] : 1; $per_page = 1; $count_q = mysql_query("SELECT COUNT(username) FROM ".TBL_USERS); $count_r = mysql_fetch_row($count_q); $count = $count_r[0]; if($page > ceil($count/per_page)) $page = 1; $limit_min = ($page-1)*$per_page; $query = mysql_query("SELECT * FROM ".TBL_USERS." ORDER BY username DESC LIMIT {$limit_min}, {$per_page}"); while($r = mysql_fetch_assoc($query)) { echo $r['username'] ."<br>"; } ?> am I doing somthing wrong?
-
cool, I think I can use it. Thank you very much.
-
wow you saved me a lot of trouble, but what does this line do:
-
I would use php to add and what not and set it to a variable, then use the variable to insert into the DB
-
I am starting my pagination script, and I am going to use a mysql query with limit here is some code: <?php $r = mysql_query("SELECT `username` FROM `users` LIMIT 10"); while($rs = mysql_fetch_array($r)){ echo $rs['username']; } ?> selects the first 10 users, but how do I select the next 10 users?
-
no I did not ignore them, I thought I fixed them, let me look over them again.
-
use the getimagesize() function to test to see if a file is really an image. Renaming wombat.exe as wombat.jpg will NOT make the file an image nice, I did not even think of that
-
so you want to tell if a file is a image? <?php function getExt($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $var = $_POST['file']; $file = getExt($var); if ($file == ("png" || "jpeg" || "bmp" || "jpg")){ echo '<img src="$var" alt="Image" />'; }else{ echo '<a href="page.php">Page</a>'; } ?> any help?
-
alright, it is still not uploading, but would this work, if the file was uploaded? <?php { $bfilename = $_FILES["file"]["name"]; $filename = str_replace(' ', '_', $bfilename); $uploaddir . basename($filename); $tmp = $_FILES["file"]["tmp_name"]; move_uploaded_file($uploaddir, $filename); $newname = rand(100, 9000000); $new_filename = rename($filename, $newname."-".$user."-".$filename); $final = md5($new_filename)."-".$user.".".getExt($filename); echo "<br>"; echo "Before Name: ".$bfilename; echo "<br>"; echo "Random Number: ".$newname; echo "<br>"; echo "After Name: ".$new_filename; echo "<br>"; echo "Hased Name: ".$final; echo "<br>Uploaded"; } ?>