Page 1 of 1

validation for existing?

Posted: Sat Jul 07, 2012 4:17 am
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');	
					}

Re: validation for existing?

Posted: Sat Jul 07, 2012 6:27 am
by Celauran
Are you sure you didn't mean

Code: Select all

... WHERE id = $id
or something similar?

Re: validation for existing?

Posted: Sat Jul 07, 2012 6:47 am
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');
					}
				
		}