Here's my code:
<?php
require '../config.php';
// Establish our connection and select our database
$link = mysql_connect($db_host, $db_user, $db_passwd) or die ("Could not connect to desired database.");
mysql_select_db($db_name) or die ("Could not select desired database.");
$sql = "
CREATE TABLE fab_cip_zg (id int(20) DEFAULT '0' NOT NULL AUTO_INCREMENT,
guid int(20),
cip_coins int(20),
cip_bijous int(20),
cip_primals int(20),
cip_common int(20),
cip_rares int(20),
cip_epics int(20),
PRIMARY KEY (id), UNIQUE id (id));";
if ($sql_debug_mode==1) { echo "<BR>SQL: $sql<BR>"; }
$result = mysql_query($sql);
if ($result == 1) {
echo "FAB_CIP_ZG Table Created Successfully!";
} else {
echo "Error creating fab_cip_zg table.";
}
for ($u = 1; $u <= 200; $u++) {
$base="INSERT INTO `fab_cip_zg` ";
$cols=" `id` , `guid` , `cip_coins` , `cip_bijous` , `cip_primals` , `cip_common` , `cip_rares` , `cip_epics`";
$vals= $u . ",'" . $u . "','" . $u . "','" . $u . "','" . $u . "','" . $u . "','" . $u . "','" . $u . "'";
$query = $base . "(" . $cols . ") VALUES (" . $vals . ")";
if ($sql_debug_mode==1) { echo "<BR>SQL: $query<BR>"; }
$queryresult = mysql_query($query);
}
?>
My table is creating fine but I'm having some problems with the insertion of the rows. I want to create 200 rows and insert the information in the following fashion:
1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2
3 3 3 3 3 3 3 3
...
...
200 200 200 200 200 200 200 200
From 1 to 200 basically.
Only with the code I created tonight, I'm getting all kinds of crazy insertions from some going to 0 to 54,000 rows and some showing 13,000 rows. I'm certain it's something easy that I may have missed.
Once again, any help would be appreciated and a thank you in advance to those who help assist me with this code.
Take care,