I now have the form working sucessfully, but but when the ID trying to be search doesnt exisit it results with
---------------------------------
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in D:\xampp\htdocs\foc\snsearchprint.php on line 49
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in D:\xampp\htdocs\foc\snsearchprint.php on line 50
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in D:\xampp\htdocs\foc\snsearchprint.php on line 51
ETC
----------------------------------------------
in the posting the page did a If check which im having diffulty trying to replicate which looked like this
Note: I tired to incorporate the "mysql_real_escape_string(strip_tags)" into the post code but allways resulted in the error pages showing so iv had to remove it till I also work that one out but other wise the posting into the DB is fine with the error checking
----------------------------------------------
$CNA=$_POST['CNA'];
$sql = "insert into `$tbl_name` (`cna`, `phone`, `mobile`, `f_name`, `s_name`, `address`, `suburb`, `p_code`, `state`, `country`, `focdate`, `agent`, `model`, `serial`, `dop`, `product_desc`, `part_no_1`, `part_qty_1`, `part_desc_1`, `part_no_2`, `part_qty_2`, `part_desc_2`, `message`, `mgr`, `status`)
values ('$cna', '$phone', '$mobile', '$f_name', '$s_name', '$address', '$suburb', '$p_code', '$state', '$country', '$focdate', '$agent', '$model', '$serial', '$dop', '$product_desc', '$part_no_1', '$part_qty_1', '$part_desc_1', '$part_no_2', '$part_qty_2', '$part_desc_2', '$message', '$mgr', '$status')";
//$result=mysql_query($sql)or die("test");
$result=mysql_query($sql)or header("location:fail.php");
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
//Register $cna and redirect to file "success.php"
session_register("cna");
}
else {
$focid = mysql_real_escape_string(strip_tags($_GET["focid"]));
$sql = 'SELECT * FROM ' . $tbl_name . ' WHERE cna="' . $cna . '"';
$result = mysql_query($sql);
$output_focid = mysql_result($result,0,"focid");
?>
<html>
<link href="../style.css" rel="stylesheet" type="text/css">
<script language="javascript">
--------------------------------------------
Trying to replicate the above into this is where im having issues.
--------------------------------------------
$sndata = mysql_real_escape_string(strip_tags($_POST['sndata']));
$focid = mysql_real_escape_string(strip_tags($_GET["focid"]));
$cna = mysql_real_escape_string(strip_tags($_GET["cna"]));
$phone = mysql_real_escape_string(strip_tags($_GET["phone"]));
$mobile = mysql_real_escape_string(strip_tags($_GET["mobile"]));
$sql = 'SELECT * FROM ' . $tbl_name . ' WHERE serial="' . $sndata . '"';
$result = mysql_query($sql);
$output_cna = mysql_result($result,0,"cna");
$output_focid = mysql_result($result,0,"focid");
$output_phone = mysql_result($result,0,"phone");
$output_mobile = mysql_result($result,0,"mobile");
?>
<html>
<link href="../style.css" rel="stylesheet" type="text/css">
<script language="javascript">
--------------------------------
Iv tried to add the --> or header("location:fail.php"); <-- to the end of the $result = mysql_query($sql); string then running some If statements but it either page errors or doesnt acknoledge the if statement.
Any Idea's ? hopfully the above is understandable.