Jump to content

Not inserting into DB


Recommended Posts

elseif($_GET['rma']=="issue"){
session_start();
$rma_id=$_GET['id'];
$_SESSION['rma_id']=$rma_id;
$rma_issued=$_POST['rma_issued'];
if($rma_issued=="y"){
$length = 2;
$characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$string= microtime(true);
for ($p = 0; $p < $length; $p++) {
$string .= $characters[mt_rand(0, strlen($characters))];
}
for ($p = 0; $p < $length; $p++) {
$string2 .= $characters[mt_rand(0, strlen($characters))];
}
$string="".$string2."".$string;
$string=explode(".",$string);
$string=$string[0].$string[1];
$rma_number=$string;
date_default_timezone_set('US/Eastern');
$rma_date_issued = date("F j, Y, g:i A T");
$rma_month_issued = date("m");
$rma_year_issued = date("Y");

$sql2000000="UPDATE $tbl_name4 SET rma_number='$rma_number', rma_issued='$rma_issued', rma_date_issued='$rma_date_issued', rma_month_issued='$rma_month_issued', rma_year_issued='$rma_year_issued', returned='n' WHERE rma_id = $rma_id";
mysql_query($sql2000000);
header("Location: ./acp_admincp.php?rma=issued");
}

 

The above isn't inserting anything into the DB... not even the Date information.

Link to comment
Share on other sites

Your code has no error checking and error reporting/logging logic in it, so you will never know if a query error is occurring or not.

 

Your code also has no indentation, making it hard for you, or anyone who might help you, see what the logic is doing.

 

You are also using variable names, such as $sql2000000, that are error prone and reduce the chance of someone trying to help you with code that has more than one or two variables in it named like that. Use names that indicate the purpose of the variable.

 

That's also an update query, not an insert query. What exactly are you trying to do, insert a row or update an existing row?

Link to comment
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.