PHP OScommerce trying to select mysql db getting parameter error

200 Views Asked by At

New to php, using http://www.oscommerce.com and trying to connect to mysql db- I am getting the following error

Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in C:\xampp\htdocs\public_html\walton\includes\functions\database.php on line 24

Php Code - database.php

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2007 osCommerce

  Released under the GNU General Public License
*/

  function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {
    global $$link;


    if (USE_PCONNECT == 'true') {
      $$link = mysqli_pconnect($server, $username, $password);
    } else {
      $$link = mysqli_connect($server, $username, $password);
    }

 Line 24:   if ($$link) mysqli_select_db($database);

    return $$link;
  }

Can someone advise?

1

There are 1 best solutions below

8
Luis Cadena On

Final issue here was incompatible PHP and Oscommerce version. mysqli_select_db() expects 2 parameters link(mysqli link) and database name(string). Also mysqli_pconnect() is deprecated use mysqli_connect().

Line 24: if ($$link)  mysqli_select_db($link,$database);