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 6618301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:48:51+00:00 2026-05-25T20:48:51+00:00

function cpanel_populate_database($dbname) { // populate database $sql = file_get_contents(dirname(__FILE__) . ‘/PHP-Point-Of-Sale/database/database.sql’); $mysqli->multi_query($sql); $mysqli->close(); }

  • 0
function cpanel_populate_database($dbname) 
{ 
     // populate database
     $sql = file_get_contents(dirname(__FILE__) . '/PHP-Point-Of-Sale/database/database.sql');
     $mysqli->multi_query($sql);

     $mysqli->close();
 }

The sql file is a direct export from phpMyAdmin and about 95% of the time runs without issue and all the tables are created and data is inserted. (I am creating a database from scratch)

The other 5% only the first table or sometimes the first 4 tables are created, but none of the other tables are created (there are 30 tables).

I have decided to NOT use multi_query because it seems buggy and see if the the bug occurs by using just mysql_query on each line after semi-colon. Has anyone ran into issue’s like this?

  • 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-05-25T20:48:52+00:00Added an answer on May 25, 2026 at 8:48 pm

    I’ve seen similar issues when using multi_query with queries that can create or alter tables. In particular, I tend to get InnoDB 1005 errors that seem to be related to foreign keys; it’s like MySQL doesn’t completely finish one statement before moving on to the next, so the foreign keys lack a proper referent.

    In one system, I split the problematic statements into their own files. In another, I have indeed run each command separately, splitting on semicolons:

    function load_sql_file($basename, $db) {
        // Todo: Trim comments from the end of a line
        log_upgrade("Attempting to run the `$basename` upgrade.");
    
        $filename = dirname(__FILE__)."/sql/$basename.sql";
        if (!file_exists($filename)) {
            log_upgrade("Upgrade file `$filename` does not exist.");
            return false;
        }
    
        $file_content = file($filename);
        $query = '';
        foreach ($file_content as $sql_line) {
            $tsl = trim($sql_line);
            if ($sql_line and (substr($tsl, 0, 2) != '--') and (substr($tsl, 0, 1) != '#')) {
                $query .= $sql_line;
                if (substr($tsl, -1) == ';') {
                    set_time_limit(300);
                    $sql = trim($query, "\0.. ;");
                    $result = $db->execute($sql);
                    if (!$result) {
                        log_upgrade("Failure in `$basename` upgrade:\n$sql");
                        if ($error = $db->lastError()) {
                            log_upgrade("$error");
                        }
    
                        return false;
                    }
    
                    $query = '';
                }
            }
        }
    
        $remainder = trim($query);
        if ($remainder) {
            log_upgrade("Trailing text in `$basename` upgrade:\n$remainder");
            if (DEBUG) trigger_error('Trailing text in upgrade script: '.$remainder, E_USER_WARNING);
            return false;
        }
    
        log_upgrade("`$basename` upgrade successful.");
        return true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

function holiday_hitlist($tablename, $hit_user){ global $host, $user, $pass, $dbname; $link = mysql_connect($host, $user, $pass, $dbname);
function get_total_adults() { $sql = SELECT SUM(number_adults_attending) as number_of_adults FROM is_nfo_rsvp; $result = mysql_query($sql)
function check(id){ var _id = document.getElementById(id); url = test.php?check=1&id= + _id; } i want
function(char* name) { char sql[50]; sprintf(sql, select %s;, name); } What's the best way
function example(){ var quantity = http://www.example.com/index.php?brandid=b%123&quantity=20; quantity = quantity.replace(-what regular expression should i user-,
I have a function code to make subdomain dynamically by php.Code is below <?php
function contentDisp() { $.ajax({ url : a2.php, success : function (data) { $(#contentArea).html(data); }
function show_destination(country_id,airport_id){ $.ajax({ type: POST, url: function.php, data: country_id=+country_id+&airport_id=+airport_id+&action=destination, beforeSend: function() { $(#loader_destination).html(''); },
I am using php copy() function and am getting strange results which made me
I am having the following problem: Warning: include_once() [function.include]: Failed opening 'Mail_Mime/mime.php' for inclusion

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.