Jump to content

AlMch

New Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by AlMch

  1. Hi, I'm by no means an expert in php but I use and continually try and figure out how to update some very old soccer stats scripts that break from time to time when newer versions of php are released. Anyway, I would appreciate any pointers with this error please: Warning: mysqli_query() expects parameter 3 to be integer, object given in /blah/blah/blah.php on line 81 The code is: 79 - mysqli_query($connection,"INSERT INTO seasons SET 80 - SeasonID = '$seasonid', 81 - SeasonPlayerID = '$player_id'",$connection) 82 - or die(mysqli_error($connection)); Server is running php 7.2.28 Thanks in advance.
  2. Barand - awesome. The ?? method has worked perfectly. There we go - I've learnt a bit more today, thank you!
  3. Yep session_start is called. Looks like I missed out a ! so I now have this... if(!isset($_SESSION['defaultseasonid_']) || ($_SESSION['defaultmatchtypeid_']) || ($_SESSION['defaultlanguage_'])) So, and excuse my ignorance, but I think that's saying use the defaultseasonid_ from the database if there isn't one already in the session? Now we're getting somewhere as this is working and bringing in a list of players for the current (default) season. However, a little later on in the script I have a couple of drop-downs to select from the list of available seasons and another with a list of matchtypes. Both these worked prior to adding the ! but now only the season drop-down is working. EDIT - posted this before seeing your last reply.
  4. And I've also tried that: if(isset($SESSION['defaultseasonid_']) || ($SESSION['defaultmatchtypeid_']) || ($SESSION['defaultlanguage_'])) But it doesn't seem to be pulling those default values into the session. PhpStorm says all the syntax is ok but it doesn't pull the required default values into the session.
  5. Yes I've looked at that but as far as I can see, it doesn't actually explain what to use instead. But thanks for your rather curt reply, here's me thinking I'd posted in the PHP Help forum. What a way to make newcomers feel welcome.
  6. Hi, I'm trying to make an old php script (won't work on anything over 5.3) run on php7. I'm not a coder by any means but get along by adapting examples I find on the web. I'm doing OK for the most part but am stuck finding what to replace session_is_registered with. This is what it is currently: $pref = mysql_query("SELECT * FROM preferences WHERE ID = '0'",$connection) or die(mysql_error()); $pdata = mysql_fetch_array($pref); mysql_free_result($pref); // I've already changed the above to: // // pref = mysqli_query($connection,"SELECT * FROM preferences WHERE ID = '0'") // or die(mysqli_error($connection)); // $pdata = mysqli_fetch_array($pref); // mysqli_free_result($pref); // // Just wanted to show you the whole section in its orignal state. // It's this line below that I'm not sure about... if(!session_is_registered('defaultseasonid_') || !session_is_registered('defaultmatchtypeid_') || !session_is_registered('defaultlanguage_')) { $_SESSION['defaultseasonid_'] = $pdata['DefaultSeasonID']; $_SESSION['defaultmatchtypeid_'] = $pdata['DefaultMatchTypeID']; $_SESSION['defaultlanguage_'] = $pdata['DefaultLanguage']; $defaultseasonid = $_SESSION['defaultseasonid_']; $defaultmatchtypeid = $_SESSION['defaultmatchtypeid_']; $defaultlanguage = $_SESSION['defaultlanguage_']; } else { $defaultseasonid = $_SESSION['defaultseasonid_']; $defaultmatchtypeid = $_SESSION['defaultmatchtypeid_']; $defaultlanguage = $_SESSION['defaultlanguage_']; } session_unset(); Any pointers anybody can give me would be much appreciated. TIA
×
×
  • 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.