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

  • SEARCH
  • Home
  • 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 8555125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:03:04+00:00 2026-06-11T15:03:04+00:00

I have a script that inserts users in the database. It used to work

  • 0

I have a script that inserts users in the database. It used to work with MYISAM, but since I changed to INNODB, it only inserts the 1st row, then it stops.

This is the script. It basicaly gets all facebook friends and checks if the users are in the database. If it ain’t, it’ll create a new “unregistered” user. Since I changed to INNODB, it only inserts the first user. I’ll also post the table creation code. Any tips?

$data = explode(";", $_POST['data']);
for($i=0; $i<count($data); $i++){
    $user = explode("^", $data[$i]);
    $fname = $user[0];
    $lname = $user[1];
    $face_uid = $user[2];
    $birthday = $user[3];
    $gender = $user[4];

    $temp_birth = explode("/", $birthday);
        if(count($temp_birth)!=3){
            $birthday="0000-00-00";
        } else {
            $birthday = $temp_birth[2]."-".$temp_birth[0]."-".$temp_birth[1];
        }

        if(ctype_alnum(str_replace(" ", "", $fname)) && ctype_alnum(str_replace(" ", "", $lname))){
            $result = mysql_query("SELECT * FROM popguest.user WHERE face_uid='$face_uid'");
            $row=mysql_fetch_array($result);
            if(mysql_num_rows($result)==0){

                $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";  
                $size = strlen( $chars );
                $verify=0;
                while($verify==0){
                    $username='';
                    for($j = 0; $j < 10; $j++) {
                        $username .= $chars[ rand( 0, $size - 1 ) ];
                    }
                    $result2 = mysql_query("SELECT * FROM popguest.user WHERE username='$username'");
                    if(mysql_num_rows($result2)!=0){
                        $verify=0;
                    }else{
                        $verify=1;
                    }
                }

                $result = mysql_query("INSERT INTO popguest.user (face_uid, username, fname, lname, birthday, gender, registered) VALUES ('$face_uid', '$username', '$fname', '$lname', '$birthday', '$gender', '0')");

                echo $fname." ".$lname.";".$face_uid.";".$birthday.";".$gender."\n";

            } else {

            }
        } else {

        }
}
CREATE TABLE `user` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `username` varchar(10) COLLATE latin1_general_ci NOT NULL,
 `face_uid` varchar(15) COLLATE latin1_general_ci NOT NULL,
 `fname` varchar(25) COLLATE latin1_general_ci NOT NULL,
 `lname` varchar(25) COLLATE latin1_general_ci NOT NULL,
 `email` varchar(50) COLLATE latin1_general_ci NOT NULL,
 `gender` varchar(6) COLLATE latin1_general_ci NOT NULL,
 `birthday` date NOT NULL,
 `type` int(1) NOT NULL,
 `registered` int(1) NOT NULL,
 `phone` varchar(15) COLLATE latin1_general_ci NOT NULL,
 PRIMARY KEY (`id`),
 UNIQUE KEY `username` (`username`),
 UNIQUE KEY `face_uid` (`face_uid`),
 UNIQUE KEY `email` (`email`)
) ENGINE=INNODB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
  • 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-11T15:03:05+00:00Added an answer on June 11, 2026 at 3:03 pm

    There are a couple of things I would look at:

    • You don’t mention if you get an error, your code isn’t made for trapping one either, so I would start with adding debug to the script and check for mysql errors, e.g $error=mysql_errno($link) , trigger_error($error, E_USER_WARNING) kind.
    • You seem to be using latin1 collation, I wonder what happens if you happen to import a user with a username not belonging to that char set. I would use utf8 all the way for this. If the second user has that sort of data in there, my first suggestion would tell you why.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this script that only lets users enter a single tag but I
I have a script that, inserts into the database e.g. 20,000 users with email
I have a python script that makes about ten INSERTs into a MySQL database.
I basically have a script that lets users post comments but I have it
I have a php script that inserts data from an Android app into a
I have a VBA script that inserts long strings into Excel cells. In some
I have a Greasemonkey script that dynamically inserts an HTML form into some web
First let me explain that I have this script that should let users enter
I have an odd issue. I have one PHP script that is used for
I have an install script that sets up a MySQL user + database +

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.