Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8431941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:59:23+00:00 2026-06-10T05:59:23+00:00

So as MYSQL is deprecated and eveyone keeps telling me to update, I thought

  • 0

So as MYSQL is deprecated and eveyone keeps telling me to update, I thought it was about time I did.

But as I’m not used to mysqli_*, it seems alien to me. And it’s not a simple edit when I have a whole site coded in Mysql.

So I’m wondering: How would I transform the below code into Mysqli? Just to give me and anyone else a good starting point when dealing with querying the database.

$sql_follows="SELECT * FROM friends WHERE user1_id=".$_SESSION['id']." AND status=2 OR user2_id=".$_SESSION['id']." AND status=2";
$query_follows=mysql_query($sql_follows) or die("Error finding friendships");
if($query_follows>0){
}

EDIT: On reading up and editing my whole site the above code converted to MYSQLI_ would go something like this..

 $Your_SQL_query_variable= mysqli_query($connectionvariable,"SELECT * FROM friends WHERE user1_id=".$_SESSION['id']." AND status=2 OR user2_id=".$_SESSION['id']." AND status=2")) {
        printf("Error: %s\n", $mysqli->error);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:59:25+00:00Added an answer on June 10, 2026 at 5:59 am

    You can download a converter tool from here:

    https://github.com/philip/MySQLConverterTool

    The code it generates is pretty gross, mainly because of the way it implements the default database link argument with a $GLOBAL variable. (This also makes it easy to recognize when someone is using code that’s gone through the converter.)

    There’s also a MySQL Shim Library located here:

    https://github.com/dshafik/php7-mysql-shim

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to successfully rewrite old mysql-php code with deprecated mysql_* functions? I
I have just changed my mysql settings to use innodb but i keep getting
I am trying to setup a mysql database, but I am getting this error
To extract a week from a date in MySQL, there are several options, but
I work with DbSimple in my site-engine. Everything worked fine but some time ago
I need to drop a deprecated, empty table from my MySQL Database. The table
I know that mysql_escape_string is deprecated from 5.3 but what was the actual difference
MYSQL I want to filter "orders" according to their items within a form's checkboxes.
Mysql supports prepared statements in this way: http://dev.mysql.com/doc/refman/5.0/en/sql-syntax-prepared-statements.html Is there a support for it
Mysql query question How to count as 1 if is 1,2 or 5 for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.