foreach

hi

i have a ID like : 411111

but when i submit it to DB i got olny 4 From My ID.
[php]<?php include('../Connections/sena_jobs.php'); ?>

<?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_gid = "-1"; if (isset($_GET['app_id'])) { $colname_gid = $_GET['app_id']; } mysql_select_db($database_sena_jobs, $sena_jobs); $query_gid = sprintf("SELECT app_id FROM applicant_basic WHERE app_id = %s", GetSQLValueString($colname_gid, "int")); $gid = mysql_query($query_gid, $sena_jobs) or die(mysql_error()); $row_gid = mysql_fetch_assoc($gid); $totalRows_gid = mysql_num_rows($gid); $app_id=$_POST['app_id']; $language=$_POST['language']; $speak=$_POST['speak']; $read=$_POST['read']; $write=$_POST['write']; $understand=$_POST['understand']; $counter=count($app_id); $counterIndex= 0; foreach ($language as $key ) { if($app_id) { $qryIns="INSERT INTO `applicant_language`(`app_id`, `language`, `speak`, `read`, `write`, `understand` ) VALUES ( '$app_id', '$language[$counterIndex]', '$speak[$counterIndex]', '$read[$counterIndex]', '$write[$counterIndex]', '$understand[$counterIndex]' )"; $qryExe=mysql_query($qryIns) or die(mysql_error()); $counterIndex=$counterIndex+1; } else { echo "Invalid User !. Please Login / Register"; } } $app_id=$_POST['app_id']; $appoint=$_POST['appoint']; $mdts=$_POST['mdts']; $from=$_POST['from']; $to=$_POST['to']; $reason=$_POST['reason']; $counter2=count($app_id); $counterIndex2=0; foreach ($from as $key ) { if($app_id) { $qryIns2="INSERT INTO `appliant_wxp_unit`(`app_id`, `appoint`, `mdts`, `from`, `to`, `reason` ) VALUES ( '$app_id[$counterIndex2]', '$appoint[$counterIndex2]', '$mdts[$counterIndex2]', '$from[$counterIndex2]', '$to[$counterIndex2]', '$reason[$counterIndex2]' )"; $qryExe2=mysql_query($qryIns2) or die(mysql_error()); if($qryExe2) { $updateGoTo = "cv_step5.php?app_id=" . $row_gid['app_id'] . ""; header(sprintf("Location: %s", $updateGoTo)); } } } ?> Untitled Document <?php mysql_free_result($gid); ?> [/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service