Jump to content

SteveCatbert

Members
  • Posts

    10
  • Joined

  • Last visited

SteveCatbert's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Did that and it did not change anything. select DISTINCT svr1.rank_title, svp1.pf_fleetposition, svp1.pf_usergamesplayed, svu1.username from (sv1ranks as svr1, sv1profile_fields_data as svp1) inner join sv1users as svu2 on svr1.rank_id = svu2.user_rank inner join sv1users as svu1 on svp1.user_id = svu1.user_id where site_order between '01A' AND '34D' order by site_order asc
  2. Query: select DISTINCT * from (sv1ranks as svr1, sv1profile_fields_data as svp1) inner join sv1users as svu2 on svr1.rank_id = svu2.user_rank inner join sv1users as svu1 on svp1.user_id = svu1.user_id where site_order between '01A' AND '34D' order by site_order asc I am using a basic while loop to display the entries. I am getting all of the information I need from the query above but it duplicates its self. while($r_user_rank_search = mysql_fetch_assoc($q_user_rank_search)) { ECHO EVERYTHING; } Actual Page http://svcommand.com/personnel.php Any idea what is going on? Also, mysqli does not work due to the php version of the server.
  3. I managed to get this to work, thank you all
  4. I feel like an idiot now. Thank you very much, that did it.
  5. I need to put this into a mysql query where only values between 1A and 5D would show up (including 1A and 5D). Do you know how to this could be accomplished?
  6. Hi, I am working on a range script where the range consists of values ranging from 01A, 01B, 01C..... 05A, 05B.... 11A, 11B, 11C, etc. Is there a way to filter out a range such as this so if I wanted to, say, select all values between 1A-5D, would that be possible? Is there a way to manipulate the range function to accomplish this?
  7. Hi, Thank you for your help. I put what you had above into my script (changed the names to the exact names of the tables) and I am getting an error saying the column name does not exist in the field list. Any idea why? I have confirmed that all the field and column names are correct.
  8. Unfortunately I have not been able to get any mysqli_ commands to work with the current server version of php, which is why I am using mysql_. For the sake of ease, I am only including,the necessary fields as there are many more that are not related to this issue. 'Join' table', user_group group_id, user_id Users Table, users user_id, username, user_rank Group Table, groups group_id, group_name Ranks Table, user_ranks rank_id, rank_name
  9. Unfortunately I have no control of the database design nor the PHP version. The version of the PHP on this server is 5.4.36.
  10. Hi All, I am designing a web page that needs to call up a database for multiple queries. The problem is that the current way I am running the script is that it requires me to run approximately 100+ queries on a single page and want to try to reduce this substantially, if not entirely. I have a database that holds four tables. One table is a list of ranks that can be assigned to a user. There are approximately 100-150 of these ranks. The second table consists of a list of groups that users can join. The third table is the user table. The user table consists of a field that contains the rank_id associated with the user and only one rank can be assigned to a user at a time. The fourth and final table is a joining table. This table connects the user table and the groups table together. The page I am designing is supposed to call up each rank, in a specific order, the order not correlating in any alphabetical or numerical sequence, and list all associated users with that rank. It then moves onto the next rank and repeats the query over and over until all ranks are used up. Currently I am manually creating the code to call up each rank and display all members with said rank. Is there a way to run one query or fewer queries for this task? An example of what I am doing is below: *Search the joining table for all users associated with group number 34* $q_user_rank_search = mysql_query("select * from sv1user_group where group_id='34'") or die(mysql_error()); while($r_user_rank_search = mysql_fetch_assoc($q_user_rank_search)) *Search the users table for all users that are part of the above group AND have the rank with ID number 34* $q_user_search = mysql_query("select username,user_id,user_rank from sv1users where user_id='$g_user_id' AND user_rank='34'") or die(mysql_error()); while($r_user_search = mysql_fetch_assoc($q_user_search)) { echo $r_user_search['username']."<br>"; } The second set of code above is repeated for each rank and this is where I would like to reduce the load on the database and limit the queries if possible.
×
×
  • 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.