Jump to content

Generate Random number each query?


Gayner

Recommended Posts

Can you post your table schema?

 

include(ROOT_PATH . 'includes/init.php');
global $DB, $settings, $user_info, $forum_info_arr, $language;
if ($user_arr['points'] >= 100)
$lol = "I have more then 100 FC!";
else
$lol = " I haveless then 100FC!";
echo $lol;
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 10000))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    if (file_exists("avatars/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
  $timestamp = date("D, M j Y, h:ia");
	 mysql_query("INSERT INTO `la_items_purchased` (`item_id`,`user_id` ,`points_spent` ,`purchase_date` ,`cimage`) VALUES (
  '". mysql_real_escape_string($_FILES["file"]["name"]) ."',
'". mysql_real_escape_string($user_info[user_id]) ."',
'". mysql_real_escape_string('100') ."',
'". mysql_real_escape_string($timestamp) ."',
  '". mysql_real_escape_string($_FILES["file"]["name"]) ."');
");		


      move_uploaded_file($_FILES["file"]["tmp_name"],
      "avatars/" . $_FILES["file"]["name"]);
      echo "Stored in: " . "avatars/" . $_FILES["file"]["name"];
      }
    }
  }
else
  {
  echo "Invalid file";
  }

 

 

 

15cef77.jpg6pw8d0.jpg

Link to comment
Share on other sites

Sorry but it looks like you got a real good understanding of database normalization, why are you generating  the item id like that...

 

Was you suppose to add a auto increment_id at the beginning of that database?

 

Just make no seance with that grate database structure.

 

actually thinking about it, if you make the field item_id UNIQUE, in the database, you could use mysql_insert_id() function, but i would take the below advise,might go wrong my idea mate.

 

sorry to go on but dam dam dam normalization for mysql is a hard subject on it own, don't get why your item_id looks this way please tell me lol.

Link to comment
Share on other sites

Sorry but it looks like you got a real good understanding of database normalization, why are you generating  the item id like that...

 

Was you suppose to add a auto increment_id at the beginning of that database?

 

Just make no seance with that grate database structure.

 

actually thinking about it, if you make the field item_id UNIQUE, in the database, you could use mysql_insert_id() function, but i would take the below advise,might go wrong my idea mate.

 

sorry to go on but dam dam dam normalization for mysql is a hard subject on it own, don't get why your item_id looks this way please tell me lol.

 

item_id joins with user_id which is joined table from forums.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.