Linked Questions

Popular Questions

I Have the following function that I used in a few projects that was a mysql query I am trying to convert it to mysqli the code is as follows

<?php
 function jay_cms($database,$connection,$group,$id,$table="ps3_contents",$groupColumn=     "ContentGroup",$IDColumn="ContentRefID",$valueColumn="ContentValue")  {
   mysql_select_db($database, $connection);
   $query_CMSContent = "SELECT * FROM $table WHERE $groupColumn = '$group' AND $IDColumn      = '$id'";
   $CMSContent = mysql_query($query_CMSContent, $connection) or die(mysql_error());
   $row_CMSContent = mysql_fetch_assoc($CMSContent);
   $totalRows_CMSContent = mysql_num_rows($CMSContent);
   mysql_free_result($CMSContent);
   return $row_CMSContent[$valueColumn];
 }
?>

I was then selecting the values by names from my database as follows

<?php 
 echo jay_cms($database_localhost, $localhost, 'Footer Pages' , 'Privacy    Policy'); 
?>

my connection file was

    <?php
    # FileName="Connection_php_mysql.htm"
    # Type="MYSQL"
    # HTTP="true"
    $hostname_localhost = "localhost";
    $database_localhost = "milehigh_milehighdata$";
     $username_localhost = "root";
     $password_localhost = "root";
    $localhost = mysql_pconnect($hostname_localhost, $username_localhost,             $password_localhost) or trigger_error(mysql_error(),E_USER_ERROR); 
    ?>

i would like to use the new connection mysqli file here

    <?php
  # FileName="WADYN_MYSQLI_CONN.htm"
  # Type="MYSQL"
   # HTTP="true"
   $hostname_localhost_i = "localhost";
   $database_localhost_i = "milehighdata";
   $username_localhost_i = "root";
   $password_localhost_i = "root";
   @session_start();

   $localhost_i = new mysqli($hostname_localhost_i, $username_localhost_i,        $password_localhost_i, $database_localhost_i);
   $localhost_i->set_charset('utf8');
   ?>

Related Questions