Jump to content

mysqli vs mysql


anneb

Recommended Posts

Hello. I am fairly new to php. I wrote some code using mysqli coding and it failed. Someone helped me rewrite it with mysql. I have two questions:

 

1. Is mysqli better to use? What are the differences?

2. How do I install mysqli if I should be using it? I've seen a little info on the internet about installing it, but all of the instructions assume some knowledge I don't seem to have. I guess I need some more detailed instructions.

Link to comment
Share on other sites

1. Is mysqli better to use? What are the differences?

 

MySQLi is short for "MySQL improved", so yes, it's better to use than the old mysql extension. It "was developed to take advantage of new features found in MySQL systems versions 4.1.3 and newer" and it is "strongly recommended" that you use it if you use MySQL 4.1.3+ (source: http://php.net/manual/en/mysqli.overview.php)

 

2. How do I install mysqli if I should be using it? I've seen a little info on the internet about installing it, but all of the instructions assume some knowledge I don't seem to have. I guess I need some more detailed instructions.

 

Installation instructions are available here: http://php.net/manual/en/mysqli.installation.php

 

On Windows you essentially just need to uncomment the line in php.ini corresponding to that extension.

Link to comment
Share on other sites

You can create a file like this:

<?php
phpinfo();
?>

and run that file via a web browser. If you can find mysqli in that file then it's installed. Otherwise you'll probably have to talk to your host. If you administrate the server then there is likely a package available for your specific distro. On Gentoo you'll have to add the mysqli use flag for the dev-lang/php package for instance.

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.