Zoot
New Member
- Dec 23, 2012
- 18
- 2
Basicly here my code
i know it messy but im not a every good php coder
basicly what the code does it makes a random number and checks it with catalogue_items "tid" and then that number with the other uploading data is uploaded and it only upload once this all works correct when it comes to inserting it in to the furniture it upload it multiple times like 4000+ times does anyone one now why?
Code:
<?php
if ($_GET['get'] == "upload")
{
$id = mt_rand(0,961680);
$query = "SELECT * FROM catalogue_items";
$result = mysql_query($query) or die(mysql_error());
while($account = mysql_fetch_array($result)){
if ($id == $account['tid']){
$id = mt_rand(0,961680);
} else {
$sql="INSERT INTO catalogue_items (tid, catalogue_name, typeid, name_cct) VALUES ('$id', '$_POST[catalogue_name]','$_POST[typeid]','$_POST[name_cct]')";
sql1="INSERT INTO furniture (tid, ownerid) VALUES ('$id', ".$user->user("id").")";
mysql_query("$sql");
mysql_query("$sql1");
}
}
i know it messy but im not a every good php coder
basicly what the code does it makes a random number and checks it with catalogue_items "tid" and then that number with the other uploading data is uploaded and it only upload once this all works correct when it comes to inserting it in to the furniture it upload it multiple times like 4000+ times does anyone one now why?