validation for existing?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
jayson.ph
Forum Contributor
Posts: 165
Joined: Mon Jan 02, 2012 9:20 am
Location: MP
Contact:

validation for existing?

Post by jayson.ph »

Hi all,

i just wondering, why i cant get in from this [header('Location:in_function/yourrequest.php');] below.

Code: Select all

	$pingsql = ("SELECT * FROM tbl_update_request WHERE id = id");
				$pingresult = mysql_query($pingsql) or die('query error. $pingsql' .mysql_error());

				if(mysql_num_rows($pingresult) > 0 )
					{
						header('Location:in_function/yourrequest.php');
					}
				if((empty($varre_qty)) || (!(ctype_digit($varre_qty))))
					{
						header('Location:error_function/error82.php');	
					}
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: validation for existing?

Post by Celauran »

Are you sure you didn't mean

Code: Select all

... WHERE id = $id
or something similar?
User avatar
jayson.ph
Forum Contributor
Posts: 165
Joined: Mon Jan 02, 2012 9:20 am
Location: MP
Contact:

Re: validation for existing?

Post by jayson.ph »

even if i change into

Code: Select all

$pingsql = ("SELECT * FROM tbl_update_request WHERE id = '$id'");
it same.. what should i do this.

here is this the whole code:

Code: Select all

	if(isset($_POST['valrequest']))
		{
				$pingsql = "SELECT id FROM tbl_update_request WHERE id = '$varid'";
					$pingresult = mysql_query($pingsql) or die('query error. $pingsql' .mysql_error());

				if(mysql_num_rows($pingresult) > 0)
				{
					echo 'file already exist';
				}
				if((empty($varre_qty)) || (!(ctype_digit($varre_qty))))
					{
						header('Location:error_function/error82.php');
					}
					
				$pingsql = ("INSERT INTO tbl_update_request(id,uid,cat_name,tbl_brnch_name,product_name,product_model,rec_on,return_on,sold,balancs,re_qty,dt_nwo,commnt)
														VALUES('$varid',
															'$vauid',
															'$varcat_name',
															'$varbrnch',
															'$varproduct_name',
															'$varproduct_model',
															'$varrec_on',
															'$varreturn_on',
															'$varsold',
															'$varbalancs',
															'$varre_qty',
															'$vardt_nwo',
															'$varcommnt')");
						$pingresult = mysql_query($pingsql) or die('Server error. $pingsql' .mysql_error());
						
				if(($pingresult))
					{
						header('Location:in_function/resquest_inn.php');
					}
				
		}
Post Reply