Thread: Simple PHP MySQLi

Results 1 to 3 of 3
  1. #1 Simple PHP MySQLi 
    Webpage Designer & Developer
    Cody's Avatar
    Join Date
    Jun 2011
    Age
    25
    Posts
    262
    Thanks given
    64
    Thanks received
    40
    Rep Power
    32
    This class can Access MySQL database wrapper using MySQLi. It can:

    - Connect to a given MySQL server
    - Execute arbitrary SQL queries
    - Retrieve the number of query result rows, result columns and last inserted table identifier
    - Retrieve the query results in a single array
    - Escape a single string or an array of literal text values to use in queries
    - Determine if one value or an array of values contain common MySQL function calls
    - Check of a table exists
    - Check of a given table record exists
    - Return a query result that has just one row
    - Execute INSERT, UPDATE and DELETE queries from values that define tables, field names, field values and conditions
    - Truncate a table
    - Send email messages with MySQL access errors


    Example
    [Only registered and activated users can see links. ]

    Example Data
    [Only registered and activated users can see links. ]

    Class.db
    [Only registered and activated users can see links. ]


    Credits: Cody 100%

    I do not give permission to have this re-upolaoded/mirrored to any other website than Rune-Server.
    - Webpage Design - Web Application Development -
    - PHP, HTML, HTML5, CSS, CSS3, ASP, JAVA, MYSQL
    -
    --------------------------------------------------------------
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Aug 2008
    Posts
    2,420
    Thanks given
    721
    Thanks received
    594
    Rep Power
    1233
    Why not just put them in code tags or on pastebin? I really don't want to have to download a file just to see what it looks like.

    After downloading it and looking at it I'm wondering why you use the procedural within an object(mysqli_* functions)? That seems a bit odd since you're programming with objects.
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  3. #3  
    RealTalk
    Nour's Avatar
    Join Date
    May 2007
    Posts
    472
    Thanks given
    127
    Thanks received
    61
    Rep Power
    569
    Is this an attempt to make mysqli object oriented? Mysqli can already do this.

    Code:
    <?php
    $mysqli = new mysqli("localhost", "my_user", "my_password", "world");
    
    /* check connection */
    if ($mysqli->connect_errno) {
        printf("Connect failed: %s\n", $mysqli->connect_error);
        exit();
    }
    
    /* Create table doesn't return a resultset */
    if ($mysqli->query("CREATE TEMPORARY TABLE myCity LIKE City") === TRUE) {
        printf("Table myCity successfully created.\n");
    }
    
    /* Select queries return a resultset */
    if ($result = $mysqli->query("SELECT Name FROM City LIMIT 10")) {
        printf("Select returned %d rows.\n", $result->num_rows);
    
        /* free result set */
        $result->close();
    }
    
    /* If we have to retrieve large amount of data we use MYSQLI_USE_RESULT */
    if ($result = $mysqli->query("SELECT * FROM City", MYSQLI_USE_RESULT)) {
    
        /* Note, that we can't execute any functions which interact with the
           server until result set was closed. All calls will return an
           'out of sync' error */
        if (!$mysqli->query("SET @a:='this will not work'")) {
            printf("Error: %s\n", $mysqli->error);
        }
        $result->close();
    }
    
    $mysqli->close();
    ?>
    Are there any perks of using this wrapper?
    RIP Emps-scape 2006-2013.
    [SPOIL]
    [/SPOIL]

    i need 2 herd sum bots
    i need 2 steal sum zombies
    i need 2 open many slots
    to hold my ****in zombies
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 01-06-2013, 10:40 PM
  2. Simple Average program, simple error?
    By Sieg in forum Tutorials
    Replies: 6
    Last Post: 01-02-2011, 02:50 PM
  3. Simple....
    By Daeyalt in forum Show-off
    Replies: 12
    Last Post: 06-20-2009, 04:14 PM
  4. A simple question requires a simple answer!
    By Matt_ in forum RS2 Server
    Replies: 2
    Last Post: 12-23-2007, 12:10 AM
  5. Replies: 14
    Last Post: 12-13-2007, 12:39 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
  •