Olaolu Posted March 4, 2017 Share Posted March 4, 2017 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. Quote Link to comment https://forums.phpfreaks.com/topic/303350-error-converting-these-codes-to-their-mysqli-counterpart/ Share on other sites More sharing options...
Jacques1 Posted March 4, 2017 Share Posted March 4, 2017 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. Quote Link to comment https://forums.phpfreaks.com/topic/303350-error-converting-these-codes-to-their-mysqli-counterpart/#findComment-1543752 Share on other sites More sharing options...
Olaolu Posted March 4, 2017 Author Share Posted March 4, 2017 Man. Just help rewrite in the best way you can. I will learn pdo but I need this now, very urgent. Help rewrite procedurarily(if there is a word like that). Please!! Quote Link to comment https://forums.phpfreaks.com/topic/303350-error-converting-these-codes-to-their-mysqli-counterpart/#findComment-1543759 Share on other sites More sharing options...
Jacques1 Posted March 4, 2017 Share Posted March 4, 2017 No, kid, I'm not going to do your homework, and, no, this is not urgent for me. If you urgently need to get a job done, we have the jobs section. Shall I move your thread? Quote Link to comment https://forums.phpfreaks.com/topic/303350-error-converting-these-codes-to-their-mysqli-counterpart/#findComment-1543760 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.