HDFilmMaker2112 Posted May 31, 2011 Share Posted May 31, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/237936-not-inserting-into-db/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 31, 2011 Share Posted May 31, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/237936-not-inserting-into-db/#findComment-1222666 Share on other sites More sharing options...
HDFilmMaker2112 Posted May 31, 2011 Author Share Posted May 31, 2011 Fixed the issue... missed a "," in the update query. Quote Link to comment https://forums.phpfreaks.com/topic/237936-not-inserting-into-db/#findComment-1222669 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.