+ Reply to Thread
Results 1 to 5 of 5

Thread: Dose any one know mysqli?

  1. #1
    moneynetworkgroup39's Avatar
    moneynetworkgroup39 is offline x10Hosting Member moneynetworkgroup39 is an unknown quantity at this point
    Join Date
    Aug 2010
    Location
    In my dreams
    Posts
    90

    Dose any one know mysqli?

    Hi,
    I have found a nice thing. An automatic search suggestion just like apple from here [url]http://www.marcofolio.net/webdesign/...uggestion.html[/utl]. Buy my problem is the code in php written for mysqli and I can not figure out where to edit I am giving the code here . Can any one tell me how to modify it for mysql please.
    Code:
    <p id="searchresults">
    <?php
        // PHP5 Implementation - uses MySQLi.
        // mysqli('localhost', 'yourUsername', 'yourPassword', 'yourDatabase');
        $db = mysql_connect('localhost', 'newdbusr', 'newdbusrpassword', 'mynewdb');
        
        if(!$db) {
            // Show error if we cannot connect.
            echo 'ERROR: Could not connect to the database.';
        } else {
            // Is there a posted query string?
            if(isset($_POST['queryString'])) {
                $queryString = $db->real_escape_string($_POST['queryString']);
                
                // Is the string length greater than 0?
                if(strlen($queryString) >0) {
                    $query = $db->query("SELECT * FROM search s INNER JOIN categories c ON s.cat_id = c.cid WHERE name LIKE '%" . $queryString . "%' ORDER BY cat_id LIMIT 8");
                    
                    if($query) {
                        // While there are results loop through them - fetching an Object.
                        
                        // Store the category id
                        $catid = 0;
                        while ($result = $query ->fetch_object()) {
                            if($result->cat_id != $catid) { // check if the category changed
                                echo '<span class="category">'.$result->cat_name.'</span>';
                                $catid = $result->cat_id;
                            }
                             echo '<a href="'.$result->url.'">';
                             echo '<img src="search_images/'.$result->img.'" alt="" />';
                             
                             $name = $result->name;
                             if(strlen($name) > 35) { 
                                 $name = substr($name, 0, 35) . "...";
                             }                         
                             echo '<span class="searchheading">'.$name.'</span>';
                             
                             $description = $result->desc;
                             if(strlen($description) > 80) { 
                                 $description = substr($description, 0, 80) . "...";
                             }
                             
                             echo '<span>'.$description.'</span></a>';
                         }
                         echo '<span class="seperator"><a href="http://www.marcofolio.net/sitemap.html" title="Sitemap">Nothing interesting here? Try the sitemap.</a></span><br class="break" />';
                    } else {
                        echo 'ERROR: There was a problem with the query.';
                    }
                } else {
                    // Dont do anything.
                } // There is a queryString.
            } else {
                echo 'There should be no direct access to this script!';
            }
        }
    ?>
    </p>
    

  2. #2
    lemon-tree's Avatar
    lemon-tree is offline x10 Minion lemon-tree has a spectacular aura about
    Join Date
    Nov 2007
    Posts
    1,420

    Re: Dose any one know mysqli?

    I can't imagine anyone is going to be willing to do this for you. Why you may ask...? Mysql_ is way out of date, insecure and slow, so changing this script from mysqli would be a massive backwards step and downgrade. What I suggest is that you learn mysqli rather than always trying to rely on mysql_

  3. #3
    moneynetworkgroup39's Avatar
    moneynetworkgroup39 is offline x10Hosting Member moneynetworkgroup39 is an unknown quantity at this point
    Join Date
    Aug 2010
    Location
    In my dreams
    Posts
    90

    Re: Dose any one know mysqli?

    I do not want to use mysqli I want use this script. I do not know any thing about mysqli So, I asked any one can tell em what change and where I have to do to use this script. As far as I know x10hosting dose not provide mysqli services so there is no options for using mysqli.
    I just want to know what change I have to make on this script.

    ---------- Post added at 06:04 AM ---------- Previous post was at 06:01 AM ----------

    I do not want to use mysqli I want use this script. I do not know any thing about mysqli So, I asked any one can tell em what change and where I have to do to use this script. As far as I know x10hosting dose not provide mysqli services so there is no options for using mysqli.
    I just want to know what change I have to make on this script.

  4. #4
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Dose any one know mysqli?

    mysqli is just another DB driver to interface PHP scripts with MyQSL. As long as the extension is part of the local PHP install, it will work just as well (if not better; it has greater functionality) than the outdated mysql driver. If you want to know more, read the manual.
    Last edited by misson; 01-12-2011 at 01:55 AM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  5. #5
    callumacrae's Avatar
    callumacrae is offline not alex mac callumacrae is just really nice
    Join Date
    Dec 2007
    Location
    Wellesbourne, England
    Posts
    5,162

    Re: Dose any one know mysqli?

    /me waves a watch about

    You want to use MySQLi

    ~Callum
    I can customise your phpBB board. Send me a PM.
    lynxphp - info, tutorials and scripts
    "A forum post should be like a skirt; long enough to cover the subject but short enough to keep things interesting."

+ Reply to Thread

Similar Threads

  1. what dose this mean?
    By luciotan in forum Free Hosting
    Replies: 1
    Last Post: 09-23-2007, 11:20 PM
  2. FTP dose not upload...
    By MicrotechXP in forum Free Hosting
    Replies: 7
    Last Post: 09-12-2005, 05:39 AM
  3. What dose this mean?!?!?!
    By Skyline4life in forum Off Topic
    Replies: 5
    Last Post: 07-30-2005, 10:51 PM
  4. wtf dose this mean?
    By Skyline4life in forum Off Topic
    Replies: 3
    Last Post: 05-22-2005, 05:58 AM
  5. Dose this hosting come with a...
    By M.K.L. in forum Off Topic
    Replies: 7
    Last Post: 02-01-2005, 10:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers