Please look at the code and if you can find my mistake.
Please tell me why
customerid is saved with wrong value the workorder table
Instead of the correct value I get '0"
When I try to display the $customerid value before the querry
I have the correct value for example 1 but even that in the
database I still have 0.
Whats wrong???
Thanks
<?php
$addcustomer = "insert into addressindex(na me,address,city ,state,zipcode, email,phone,ss, cc,exp,notes) values ('$name','$addr ess','$city','$ state','$zipcod e','$email','$p hone','$ss','$c c','$exp','$not es')";
$addworkorder = "insert into workorder(custo merid,date,time ,service,due,sp ecial,extrawork ,due2,company,i nstaller,total) values ('$customerid', '$date','$time' ,'$service','$d ue','$special', '$extrawork','$ due2','$company ','$installer', '$total')";
$getdata = "select * from addressindex where name = '$name' or customerid = '$customerid'";
$rs = mysql_query($ge tdata);
if(( $rs ) && ( mysql_errno() == 0 )) {
// query was successful
if( mysql_num_rows( $rs ) > 0 ) {
$result2 = mysql_query($ad dworkorder);
if ($result2) {
include '../login/print.php';
} else {
include '../login/error-broken.php';}
} else {
$result = mysql_query($ad dcustomer);
echo $customerid;
$getid = "select customerid from addressindex where name = '$name'";
$sqgetid = mysql_query($ge tid);
$customerid = mysql_result($s qgetid,0);
echo $customerid;
//now i do a querry and even $customerid is 1 here now
it is saved under 0
$result2 = mysql_query($ad dworkorder);
if ($result && $result2) {
include '../login/print.php';
} else {
include '../login/error-broken.php';}
}
} else {
include '../login/error-broken.php';}
//Close connection with MySQL
MySQL_close()
?>
Please tell me why
customerid is saved with wrong value the workorder table
Instead of the correct value I get '0"
When I try to display the $customerid value before the querry
I have the correct value for example 1 but even that in the
database I still have 0.
Whats wrong???
Thanks
<?php
$addcustomer = "insert into addressindex(na me,address,city ,state,zipcode, email,phone,ss, cc,exp,notes) values ('$name','$addr ess','$city','$ state','$zipcod e','$email','$p hone','$ss','$c c','$exp','$not es')";
$addworkorder = "insert into workorder(custo merid,date,time ,service,due,sp ecial,extrawork ,due2,company,i nstaller,total) values ('$customerid', '$date','$time' ,'$service','$d ue','$special', '$extrawork','$ due2','$company ','$installer', '$total')";
$getdata = "select * from addressindex where name = '$name' or customerid = '$customerid'";
$rs = mysql_query($ge tdata);
if(( $rs ) && ( mysql_errno() == 0 )) {
// query was successful
if( mysql_num_rows( $rs ) > 0 ) {
$result2 = mysql_query($ad dworkorder);
if ($result2) {
include '../login/print.php';
} else {
include '../login/error-broken.php';}
} else {
$result = mysql_query($ad dcustomer);
echo $customerid;
$getid = "select customerid from addressindex where name = '$name'";
$sqgetid = mysql_query($ge tid);
$customerid = mysql_result($s qgetid,0);
echo $customerid;
//now i do a querry and even $customerid is 1 here now
it is saved under 0
$result2 = mysql_query($ad dworkorder);
if ($result && $result2) {
include '../login/print.php';
} else {
include '../login/error-broken.php';}
}
} else {
include '../login/error-broken.php';}
//Close connection with MySQL
MySQL_close()
?>
Comment