Jump to content

pocobueno1388

Members
  • Posts

    3,369
  • Joined

  • Last visited

    Never

Everything posted by pocobueno1388

  1. Is the $id variable coming from the database? If it is, your forgetting to use $row. Change it to this echo "<td><a href='staff.php?cmd=bio&id={$row['id']}'>". $row['username'] . "</a></td>";
  2. It's very hard to explain, here is a link http://www.tonymarston.net/php-mysql/many-to-many.html#a1 Basically it's two or more tables in a database that share one common unique field. That way, you can create a query that can grab information from both tables at once without having to store replicated information.
  3. I'm not limiting his options, I'm actually trying to do the opposite. I'm trying to figure out why in the world they would want to do that as I can't think of a single reason, and then maybe I can direct them to a better method.
  4. Why not just test it? Also, why would you want to do that?
  5. Uhhh...that just sounds like a bad database setup. Here is how I would do it. You would first setup a table for all the individual items TABLE items ------------ itemID name quantity price ...whatever else Now for the user owned items...for items that were bought TABLE user_items ----------------- itemID (links to the itemID in "items" table) ownerID (who owns the item) ...whatever else With that setup, you can always control how much is in stock at the store, easily check who owns what item, and how much, or whatever else.
  6. Then change your query to this $sql = "SELECT * FROM `users` WHERE admin='1'";
  7. DESC goes along with the ORDER BY clause. You have the choice between DESC (going from highest value to lowest) or ASC (lowest to highest). Since you have 1's for admins and 0's for normal members, then you want to order by DESC so it will display all the 1's first, then the normal members.
  8. Need a semi-colon on the end of the $SQL line. Oops, I copied and pasted that line from your code to start with You started it, haha.
  9. Use a session to store the URL they were just at, then when they log in redirect them to that page.
  10. Try <?php $sql = "SELECT * FROM `users` ORDER BY `admin` DESC" $result = mysql_query($sql) or die("ERROR: ".mysql_error().'<br>With Query: '.$sql); while ($row = mysql_fetch_array($result)) { echo $row['col'].'<br>'; } ?>
  11. That means there is a problem with your query, and I do see an error in it. Change it to $result = mysql_query("select * from users order by admin")or die(mysql_error());
  12. Here is how you would do it <?php $bloggins = mysql_query("SELECT `date`, blogtext, id, MAX(id) as highest FROM blogs")or die(mysql_error()); $count = 0; while ($blog = mysql_fetch_array($bloggins)) { if($count == $row['highest']) $css = "class_name"; else $css = "aDifferentClassName"; ?> <table class="<?php echo $css; ?>" width="75%" border="1" cellpadding="1" cellspacing="0"> <tr><td width="12%" valign="top"><?php echo $blog["date"]; ?></td> <td width="76%"><?php echo $blog['blogtext']; ?></td> <td width="12%" valign="top"><?php echo "<a href=\"blogeditor.php?id={$blog['id']}\">Modify/Delete</a>"; ?></tr> </table> <?php $count++; } ?> Wes1890 - You don't need two separate queries to get the highest ID
  13. You need to close the <font> tags BEFORE the <td> tags. Also, where is your table tags? <?php echo"<br>"; echo"<br>"; while (list($id, $name, $type,$size,$content, $dance) = mysql_fetch_array($data_p)) { echo "<tr>"; echo "<td><font size='2'font color = '#ffffff' face='Arial'><a href=\"download3.php?id=$id\">$name</a></font></td>"; echo "<td><font size='2'font color = '#ffffff' face='Arial'>$dance</td></font>"; //echo "<td><font size='2'font color = '#ffffff' face='Arial'>$id</font></td>"; echo "</tr>"; } Your gonna have to explain what "kind of working" means...we can't really help you any further if we don't know what to help you with.
  14. Don't forget to click solved Unless of course you need help figuring out why it doesn't have a value.
  15. Well...I suppose you can do that then. Try this code and tell me what it does <?php If (isset($_GET['friends'])) { $Get = mysql_query("SELECT * FROM userregistration WHERE UserID='{$_SESSION['Current_User']}'") or die(mysql_error()); $Row = mysql_fetch_assoc($Get); $BeenDonator = $Row['HasBeenDonator']; If ($BeenDonator == 1) { $GetList = mysql_query("SELECT * FROM friendslist WHERE UserID='{$_SESSION['Current_User']}'") or die(mysql_error()); If (mysql_num_rows($GetList) > 0) { ?> <div id="bv_" style="position:absolute;left:50px;top:350px;width:150px;height:22px;z-index:1" align="center"> <table width="800" border="1" cellpadding="0" cellspacing="0"> <tr> <td width="200"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>UserName: </center></b></u></font></td> <td width="100"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>UserID: </center></b></u></font></td> <td width="200"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>Infomation: </center></b></u></font></td> <td width="80"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>Online: </center></b></u></font></td> <td width="80"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>Has you?: </center></b></u></font></td> </tr> <?php while ($ListRow = mysql_fetch_array($GetList)) { $FriendID = $ListRow['FriendID']; $Description = $ListRow['Description']; $GetUsername = mysql_query("SELECT * FROM userregistration WHERE UserID='$FriendID'") or die(mysql_error); $Usernamerow = mysql_fetch_assoc($GetUsername); $Username = $Usernamerow['Username']; $Online = $Usernamerow['Online']; If ($Online == 1) { $YesNo = 'Online'; } Else{ $YesNo = 'Offline'; } $GotYou = mysql_query("SELECT * FROM friendslist WHERE UserID='$FriendID' AND FriendID='{$_SESSION['Current_User']}'") or die(mysql_error()); if (mysql_num_rows == 1) { $HasYou = 'Yes'; } Else{ $HasYou = 'No'; } ?> <tr> <td width="200"><center><font style="font-size:14px" color="#32CD32" face="Arial"><?=$Username?> </center></font></td> <td width="100"><center><font style="font-size:14px" color="#32CD32" face="Arial"><?=$FriendID?> </center></font></td> <td width="200"><center><font style="font-size:14px" color="#32CD32" face="Arial"><?=$Description?> </center></font></td> <td width="80"><center><font style="font-size:14px" color="#32CD32" face="Arial"><?=$YesNo?></center> </font></td> <td width="80"><center><font style="font-size:14px" color="#32CD32" face="Arial"><?=$HasYou?> </center></font></td> </tr> <?php } } Else { ?> <div id="bv_" style="position:absolute;left:280px;top:400px;width:300px;height:24px;z-index:11" align="center"> <font style="font-size:15px" color="#FFFFFF" face="Arial"><b><u>You have no one on your friends list! </u></b></font></div> <?php } } else { echo 'The variable $beenDonator DOES NOT equal 1'; } ?>
  16. You have to actually set "friends" in the URL to something. Your URL looks like this friendenemylist.php?friends It SHOULD look like this friendenemylist.php?friends=view Where "view" is, you can put anything...whatever is appropriate.
  17. Give this a try <?php function getStuff($db) { $query = 'SELECT item.id AS id FROM table ORDER BY views DESC LIMIT 51'; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)){ if (file_exists("../path/".$row['id'].".jpg")){ $new_arr[] = $row['id']; } return $new_arr; } ?>
  18. There should be a modify/edit button that you can press...it may be timed out though.
  19. I recommend using mysql_real_escape_string() on all your variables. Also, instead of just checking if the same "words" have been said before, check for the same words said by the same person as well. If you keep it your way, two people can never say the same thing someone else already said. So I would change this $check = mysql_query("SELECT chat FROM chat WHERE chat = '$chatcheck'") or die(mysql_error()); To $poster = mysql_real_escape_string($_POST['poster']); $check = mysql_query("SELECT chat FROM chat WHERE chat = '$chatcheck' AND poster='$poster'") or die(mysql_error()); Even then it isn't a great system as the same person wouldn't be able to say something they said in the past.
  20. This question is so common there's a tutorial for it http://www.phpfreaks.com/forums/index.php/topic,95426.0.html
  21. Well...I don't think you can get access to that folder via a query. You could possibly do this though <?php if (file_exists("../path/".$row['id'].".jpg")){ //the file exists, display it } else { //the file doesn't exist, so don't display it } ?>
  22. Look at this query $check = mysql_query("SELECT chat FROM chat WHERE chat = '$chatcheck'") or die(mysql_error()); Where is the variable $chatcheck coming from? Shouldn't it be $itemcheck?
  23. Your welcome I did make a mistake though. In my code, change echo $phrase; To echo $coconut; $coconut is the variable that will hold the correct phrase.
  24. You are not giving us even close to enough information. Do you have another table with a relationship to this one that store the files? If so, give us the table structure of both tables.
×
×
  • 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.