Jump to content

bbram

Members
  • Posts

    24
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

bbram's Achievements

Member

Member (2/5)

0

Reputation

  1. you are correct...I totally forgot that and have fixed my code to have that and to display error messages...thank you for the help!
  2. I am finally making the upgrade from PHP 5.3 to PHP 7.3. When converting over the code I noticed that session some sessions are not being processed. My test code for this is below: session_start(); include ("../includes/connect.inc"); echo "hiiiiiiii: ".$currentDate; echo "Here: ".$_SESSION['user']; if (isset($_SESSION['user'])) { $user = $_SESSION['user']; $currentDate = date("Y/m/d"); } else { echo "Session not started: "; } My include is listed below: $link = mysqli_connect('localhost', 'root', ''); if (!$link) { die('Could not connect: ' . mysql_error("Connection error message")); } mysqli_select_db($link, 'dbname') or die (mysqli_error($link)); date_default_timezone_set('America/Chicago'); define ("TZ_CORRECTION", 43200); $bkcolor = "#FFFFFF"; $currentDate = (Date("Y-m-d")); I am not getting the message "Session not started or the current date from the include". If it matters I am using WAMP as my testing server Any help is greatly appreciated.
  3. 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.
  4. 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.
  5. 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
  6. 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?
  7. 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.
  8. I have the following code $ifNameAlreadyExsist = "[0-9]"; //echo $newUserName[0-9]; echo $testUserName = $ifNewUserName[$ifNameAlreadyExsist]+; When I run the code I get the following error Parse error: syntax error, unexpected ';' in C:\wamp\www\new_signup.php on line if I have the following line of code $ifExsist = "SELECT COUNT( player_id ) FROM players WHERE player_id LIKE '$newUserName[0-9]'"; I get the following error: Parse error: syntax error, unexpected '-', expecting ']' in C:\wamp\www\new_signup.php on line 138 Can someone help me to figure out why I am getting the error messages listed above?
  9. suggestions on how to write this code better I have a form that has 2 textboxes in it. The php listed below...confirms that the passwords match, confirms that there are at least 6 characters in in, confirms that there is at least 1 number. I am doing mostly if statements with it, but I was wondering if there was a better way to write. <!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> <form name="form1" method="post" action="<?PHP $_SERVER['PHP_SELF'] ?>"> <table width="100%" border="1"> <tr> <th scope="row"> <strong>New password: </strong> <input type="password" maxlength="15" name="password"></th> <th scope="row"> <strong>New password confirmed: </strong> <input type="password" maxlength="15" name="confirm_password"></th> <th scope="row"><input type="submit" name="update" value="Update Password" /></th> </tr> </table> </form> <?PHP //verify that the update button is pressed if (isset($_POST['update'])) { //verify that the passwords match if($_POST['password'] == $_POST['confirm_password']) { echo "passwords match"; echo "<br>"; } //verify that the password and password confirmation was entered elseif ((isset($_POST['password'])) && ($_POST['confirm_password'])) { echo "Password and confirm password set"; echo "<br>"; } //verify that the # of characters was entered elseif (strlen($_POST['password'])<6) { $num_char=strlen($_POST['password']); echo "Please enter more characters"; echo "<br>"; } //find out if number exsist if (strlen($_POST['password'])>5) { $subject = $_POST['password']; preg_match_all('/[0-9]/', $subject, $matches); $count = count($matches[0]); //echo $count; if ($count <=1) echo "Please enter in at least 1 number you currently have: " .$count; }//close of verification of both boxes entered }//close of $_POST ?> </body> </html>
  10. Can't you do it like this if (isset$_post['textboxname'] { do something } else { redirect back to main page }
  11. Okay I got it fixed thanks for your help... Now my query is not displaying any information... $countPlayers=mysql_query("SELECT players.Player_number, players.Player_name FROM players WHERE ((NOT Inactive_player) AND ((players.Player_Last_Name = '$player_find%'))) ORDER BY Player_name"); $row = mysql_fetch_assoc($countPlayers) or die("No rows returned by query"); echo $row['Player_number'];
  12. Hello I have the following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM players WHERE ((NOT inactive_player) AND ((players.Player_Last_Name = 'p' at line 3 I think my error is in the statement below... echo "1"; $getNewPlayers = "SELECT players.Player_number, players.Player_name, FROM players WHERE ((NOT inactive_player) AND ((players.Player_Last_Name = 'player_find%'))) ORDER BY player_name"; $rsNewPlayers = mysql_query($getNewPlayers, $link) or die (mysql_error()); $varNewCount = mysql_num_rows($rsNewPlayers); echo $varNewCount['Player_name']; Can you tell me where the error is and how I might go about to fix it? Thanks,
  13. I know this probably not it...but you are missing closing ) on the if statement.
  14. <?PHP session_start(); if (isset($_SESSION['user'])) { $user = $_SESSION['user']; $password = $_SESSION['password']; } else { //if the username is not passed then it goes back to the login page header("location: /player_login.php"); } $link = mysql_connect('localhost', 'root', ''); echo $user; echo $password; if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db("movedb")or die("Cannot Select Database"); //gets the current player number for the person logged in $checkquery = "Select player_number from players where Player_ID = '$user'"; $checkresults = mysql_query($checkquery) or die (mysql_error()); //select the rung number for the singles ladder $checksingles = "Select rung_number from doubles_ladder where player_number = '$user'"; $checkifsingles = mysql_query($checksingles) or die (mysql_error()); $checkplayernumber = "Select player_number from security where userid = '$user' AND password = '$password'"; $getplayernumber = mysql_query($checkplayernumber) or die (mysql_error()); $ssPlayerNumber=mysql_fetch_assoc($getplayernumber); $query = "SELECT MAX(paid_thru) FROM players_paid where paid_type = '1' AND player_number = '{$ssPlayerNumber['player_number']}'"; $result = mysql_query($query)or die ('Error in query: $query. ' . mysql_error()); $row = mysql_fetch_assoc($result); $max = $row['MAX(paid_thru)']; //converts the date to a more readable format $max = $row['MAX(paid_thru)'] = date("M d, Y",strtotime($row['MAX(paid_thru)'])); echo "Ladder Membership Recently Expired on : " .$max. "!!!"; $rsSingles = "SELECT match_results_singles.match_date AS match_date, match_results_singles.match_time, match_results_singles.match_result, match_results_singles.home_sets_won as my_wins, match_results_singles.visitor_sets_won as my_losses, locations.loc_name, players.Player_name, ' ' as supplies_balls FROM (match_results_singles INNER JOIN players ON match_results_singles.match_visiting_player = players.Player_number) INNER JOIN locations ON match_results_singles.match_location = locations.loc_code WHERE (((match_results_singles.match_home_player)='{$ssPlayerNumber['player_number']}' )) UNION SELECT match_results_singles.match_date AS match_date, match_results_singles.match_time, match_results_singles.match_result, match_results_singles.visitor_sets_won as my_wins, match_results_singles.home_sets_won as my_losses, locations.loc_name, players.Player_name, '*' as supplies_balls FROM (match_results_singles INNER JOIN players ON match_results_singles.match_home_player = players.Player_number) INNER JOIN locations ON match_results_singles.match_location = locations.loc_code WHERE (((match_results_singles.match_visiting_player)='{$ssPlayerNumber['player_number']}' )) ORDER BY match_date"; $rsSinglesMatch = mysql_query($rsSingles) or die (mysql_error()); $rsSinglesMatches = mysql_fetch_array($rsSinglesMatch); ?> <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 while($rows=mysql_fetch_array($checkresults)) { echo $rows['player_number'] ; } $num_rows = mysql_num_rows($rsSinglesMatch); //$num_rows now contains the number of rows from the query echo $num_rows; if ($num_rows > 0 ) { echo $ssPlayerNumber; echo ("YEX"); } else { echo "ROWS"; } $myrow = mysql_fetch_row($rsSinglesMatch); //$rsSinglesMatches = mysql_fetch_assoc($rsSinglesMatch); print_r($myrow); // if (!($rsSinglesMatches==0) || !($rsSinglesMatches_BOF==1)) if ($myrow > 0) { echo $myrow; } else { echo "Rows not counted: "; } ?> <br> </body> </html> Sorry for the goof up...I just saw you wanted from query on... Everything else seems to work except for the count of rows....
  15. Okay thanks for your help.... The rest of the page is as follows: <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 while($rows=mysql_fetch_array($checkresults)) { echo $rows['player_number'] ; } $num_rows = mysql_num_rows($rsSinglesMatch); //$num_rows now contains the number of rows from the query echo $num_rows; if ($num_rows > 0 ) { echo $ssPlayerNumber; echo ("YEX"); } else { echo "ROWS"; } $myrow = mysql_fetch_row($rsSinglesMatch); //$rsSinglesMatches = mysql_fetch_assoc($rsSinglesMatch); print_r($myrow); // if (!($rsSinglesMatches==0) || !($rsSinglesMatches_BOF==1)) if ($myrow > 0) { echo $myrow; } else { echo "Rows not counted: "; } ?> <br> </body> </html>
×
×
  • 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.