I was wondering why is is possible not to have any error messages or echoed debugging statements come up even when you use:
error_reporting(E_ALL);
ini_set('display_errors', '1');
at the top of your script
With or without this i get no feedback about syntax issues. I am trying to test the following but cannot due to lack of feedback
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
include("include/session.php");
require_once('common_functions.php');
$_SESSION['form1_data']= $_POST;
$username = $_SESSION['username'];
include("connect.php");
// build main query from form
$sql = "INSERT INTO sp_profile SET spprofile_id = NULL ";
foreach ($_SESSION['form1_data'] as $col =>$val ){
if($col <> 'submit'){
if ($col=='subcat'){
//ignore and process later below for seperate table insert
}
elseif ($col=='location'){
//ignore and process later below for seperate table insert
}
elseif ($col=='industry'){
//ignore and process later below for seperate table insert
}
//////////////////////////////////
mysql_query($sql, $connection) or die(mysql_error());
//get last insert id
$sql ="select LAST_INSERT_ID() as id from sp_profile";
$result = mysql_query($sql, $connection) or die(mysql_error());
$row=mysql_fetch_array($result);
$id = $row['id'];
//update subcategory table
if($_SESSION['form1_data']['subcat']){
foreach($_SESSION['form1_data']['subcat'] as $fvalue){
$sql ="INSERT INTO sp_subcategory SET spsubcategory_id = NULL , spprofile_id = '$id', subcategory_id = '$fvalue' ";
mysql_query($sql, $connection) or die(mysql_error());
}
}
// update location table
if($_SESSION['form1_data']['location']){
foreach($_SESSION['form1_data']['location'] as $fvalue){
$sql ="INSERT INTO sp_location SET splocation_id = NULL , spprofile_id = '$id', location_id = '$fvalue' ";
mysql_query($sql, $connection) or die(mysql_error());
}
}
// update industry table
if($_SESSION['form1_data']['industry']){
foreach($_SESSION['form1_data']['industry'] as $fvalue){
$sql ="INSERT INTO sp_industry SET spindustry_id = NULL , spprofile_id = '$id', industry_id = '$fvalue' ";
mysql_query($sql, $connection) or die(mysql_error());
}
}
?>
Without error message feedback - even basic stuff like undefined errors or lack of ';' or '{' cannot be recognised.
Cany anyone tell me why?