Jump to content

Error converting these codes to their mysqli counterpart.


Olaolu

Recommended Posts

I understand that this is very late and u should have done this since but it's never late than never.

I need help converting these codes "mysql" functions to their "mysqli" counterparts.

<?php

$db = mysql_connect("$dbhost", "$dbuser", "$dbpass")

or die("Could not connect."); if(!$db) die("no db");

if(!mysql_select_db("$dbname",$db))

die("No database selected.");

if(!get_magic_quotes_gpc())

{

$_GET = array_map('mysql_real_escape_string', $_GET);

$_POST = array_map('mysql_real_escape_string', $_POST);

$_COOKIE = array_map('mysql_real_escape_string', $_COOKIE);

}

else

{ $_GET = array_map('stripslashes', $_GET);

$_POST = array_map('stripslashes', $_POST);

$_COOKIE = array_map('stripslashes', $_COOKIE);

$_GET = array_map('mysql_real_escape_string', $_GET);

$_POST = array_map('mysql_real_escape_string', $_POST);

$_COOKIE = array_map('mysql_real_escape_string', $_COOKIE);

}

?>

 

Please just help rewrite the correct one. I have been trying this all day.

Link to comment
Share on other sites

99% of the code is plain nonsense, so trying to translate this word for word will be a major waste of time, and you may have to start all over again in a few years.

 

I recommend you learn PDO (mysqli sucks), try to understand the goal of the code and then reimplement it with the techniques of the 21st century.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.