Jump to content

Recommended Posts

This code is in form.php. The id_number is added to customer_id column in the photos table when the form is submitted. The id_number is automaticaly generated.

<input name="photo[customer_id]" size="40" type="hidden" value="<?php echo $_POST['id_number']; ?>" />

Let's say 4P2792Q893421 was posted into the database.

 

This code is in index.php and checks the database customer _id column for a match from id_number. If found, exit;,  if not found, add the values to the database. 

As you can see, I manualy inserted the id_number into the code. It's checking the column customer_id and finds a match which in turn exits to index.php.

$same_number= mysql_query("select id from photos where customer_id= '4P2792Q893421'"); 
$duplicate = mysql_num_rows($same_number);
	if ($duplicate > 0)
	{
	header("Location: index.php");
	exit();
	}

 

I tried to POST the id_number in this example and it doesn't work. What's wrong?

$same_number= mysql_query("select id from photos where customer_id= ''$_POST[id_number]'"); 
$duplicate = mysql_num_rows($same_number);
	if ($duplicate > 0)
	{
	header("Location: index.php");
	exit();
	}

 

Link to comment
https://forums.phpfreaks.com/topic/159473-solved-dont-upload-image-more-than-once/
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.