Jump to content

bbram

Members
  • Content Count

    22
  • Joined

  • Last visited

Community Reputation

0 Neutral

About bbram

  • Rank
    Member

Profile Information

  • Gender
    Not Telling
  1. Joins in general are still hard for me to figure out, and I don’t know why. I have the following code in my PHPMyAdmin console, and keep getting an error message: select DISTINCT login.username, login.login_time, players.Player_ID, players.Player_name, players.Player_First_Name, Players.Player_Last_Name, players.player_email INNER JOIN players on login.username=players.Player_ID where login.login_time > ‘2019-09-09’ Basically I am trying to figure out the last people that have logged in to our system within the past year and then will max it out to a certain number like 1000, or 500 depending on what mail server we use. Any help is greatly appreciated.
  2. Ok I saw what you meant...I added <?php to the front and was getting an error message. I apparently changed my DB name sometime and forgot to update code. Thanks for helping with this.
  3. I changed the file name to connect.php I do have <? and ?> in my connect file I also changed to use the following require 'includes/connect.php'; I also added echo $server and my page is telling me that i have an undefined error Still I am not sure what the problem is
  4. I have a very simple page, where I use the include statement that includes my connection string. The connection string and a variables are not being passed to my test server - (WAMP). My include file is below $server = "servername"; $username = "username"; $password = ""; $database = "dbname"; $portNumber = 3308; $link = mysqli_connect($server,$username,$password,$database,$portNumber); if(!$link) { echo "cannot connet to the server"; } else { echo "This works"; } echo "Hi"; I am including this file with the following code: include ("includes/connect.inc"); My site is not connecting to the database, and is not displaying "This works", or "Hi". Do you have any pointers on how to get this connect?
  5. I have 2 pages...1 one that has something like 500 checkboxes that list all of the active users in a database. When any number of checkboxes are selected it passes the variables from the checkboxes to the next page, asking for confirmation. Right now I have the 2nd page displaying numbers for the people, but doesn't display the correct entries. The code is below, hopefully it helps: if(isset($_POST['Update'])) //if the update button was pressed { if (isset($_POST['Player_number'])) //checks to see if any checkboxes are selected { //$Player_number = IMPLODE(',',$_POST['Player_number']); //putting the comma in between the array items echo $Player_number; ?> <input type="hidden" name="<?PHP $Player_number; ?>" value="<?PHP $Player_number; ?>"> $Player_number = IMPLODE(',',$_POST['Player_number']); //putting the comma in between the array items $result = mysql_query("SELECT * FROM `players` WHERE `Player_number` = '$Player_number' ORDER BY Player_Last_Name") or die(mysql_error()); while ($row = mysql_fetch_array($result)) //while ($row = mysql_fetch_assoc($result)) { // here is your data echo "FName: ".$row['Player_First_Name']; echo "lName: ".$row['Player_Last_Name']; echo "email: ".$row['player_email']; } foreach($_POST['Player_number'] as $row) { $result = mysql_query("SELECT `Player_First_Name`,`Player_Last_Name`,`player_email`, `Player_number` FROM `players` WHERE `Player_number` = '$Player_number' ORDER BY Player_Last_Name") or die(mysql_error()); $Player_number = IMPLODE(',',$_POST['Player_number']); //putting the comma in between the array items while($rows=mysql_fetch_array($result)) { echo "Player Number: ".$Player_number; //echo "pNumber: ".$row; //echo $rows['Player_First_Name']; ?> <tr bgcolor='<?PHP echo $bkcolor; ?>'> <td width = '20%' height="20"><div align="center"><input type="hidden" name="Player_number[]" value="<?php echo $row; ?>"></div></td> <td width= '20%' headers="20"><div align="center"><?php echo $rows['Player_First_Name']; ?></div></td> <td width= '20%' headers="20"><div align="center"><?php echo $rows['Player_Last_Name']; ?></div></td> <td width= '20%' headers="20"><div align="center"><?php echo $rows['player_email']; ?></div></td> <?PHP }//close of the while loop }//close of the foreach loop }//close of if (isset($_POST['Player_number'])) } //close of (isset($_POST['Update'] My issue that it goes through the For loop that is listed above, but list the player first name X amount of times.
  6. I have a list that pulls information from a database. This information is pulled dynamically. There are 4 different list and all 4 different list display the exact same thing...the issue is that only the first list is populating items. I have pasted code below as an example for two of the list. <select name="Winning_Player_1" size="1"> <?php $sql=mysqli_query($con, "Select Player_Number, Player_Name from players order by Player_Name"); while ($row = $result->fetch_assoc()) { unset($Winid1, $WinPlayer1); $Winid1 = $row['Player_Number']; $WinPlayer1 = $row['Player_Name']; echo '<option value="'.$Winid1.'">'.$WinPlayer1.'</option>'; }?></select> </td> <td>Winning Player 2 <select name="Winning_Player_2" size="1"> <?php $sql=mysqli_query($con, "Select Player_Number, Player_Name from players order by Player_Name"); while ($row = $result->fetch_assoc()) { unset($Winid1, $WinPlayer1); $Winid1 = $row['Player_Number']; $WinPlayer1 = $row['Player_Name']; echo '<option value="'.$Winid1.'">'.$WinPlayer1.'</option>'; }?></select> Any help is greatly appreciated with this. What I plan on doing is passing each variable to another page and see if the winning players exists and if not then process my next set of code.
×
×
  • 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.