Foros del Web » Programando para Internet » PHP »

Campo null

Estas en el tema de Campo null en el foro de PHP en Foros del Web. que tal tengo un formulario y quiero dejar dos campos vacios y no puedo , el codigo es un poco complejo para mi que soy ...
  #1 (permalink)  
Antiguo 27/09/2011, 08:41
 
Fecha de Ingreso: junio-2010
Mensajes: 128
Antigüedad: 13 años, 10 meses
Puntos: 2
Campo null

que tal tengo un formulario y quiero dejar dos campos vacios y no puedo , el codigo es un poco complejo para mi que soy novato, alguien me podria ayudar?


education_start
education_end

estos son los campos que deseo que si los dejo vacio me cargue el registro igual

Código PHP:

<?



    
/*
    POSSIBLE NAVIGATION SECTIONS ...
    $section    = "home";
    $section    = "services";
    $section    = "jobseeker";
    $section    = "employer";
    $section    = "resources";
    $section    = "search";
    $section    = "contact";
    */



    
$section    "jobseeker";
    include(
"setting.php");
    include(
"jobseeker_check.php");
    


    
// set random passcode ...
    
$random_code             strtoupper(create_passcode(5));
    
$status_img_captcha        "no";
    
setcookie("cpasscode"$random_code);
    


    
$db_connect    mysql_connect($db_host$db_username$db_password);
    
mysql_select_db($db_name$db_connect) || die(mysql_error());



    
// get jobseeker details ...
    
$jobseeker                            $clogin_jobseeker;
    
$sql_query                          "SELECT * FROM jobseeker WHERE jobseeker_id = '$jobseeker'";
    
$result                                mysql_query($sql_query) or die(mysql_error());
    
$row                                 mysql_fetch_array($result);
    
$jobseeker_education_certification    $row[jobseeker_education_certification];




    
// get education ...
    
$i            0;
    
$sql_query    "
    SELECT * FROM jobseeker_education 
    WHERE 
    education_jobseeker  = '$jobseeker' AND
    education_start        != ''            AND
    education_end        != ''            AND
    education_school    != ''            
    ORDER BY education_start ASC
    "
;
    
$result        mysql_query($sql_query) or die(mysql_error());
    while (
$row    mysql_fetch_array($result)) {
    
        if ( 
$i == )    { $bg_color "FFFFFF"; } 
        else                 { 
$bg_color "EAF2FF"; }

        
$arr_jobseeker_education_counter[$i]        = $i 1;
        
$arr_jobseeker_education_id[$i]                = $row[education_id];
        
$arr_jobseeker_education_bgcolor[$i]        = $bg_color;
        
$arr_jobseeker_education_year_start[$i]        = $row[education_start];
        
$arr_jobseeker_education_year_end[$i]        = $row[education_end];
        
$arr_jobseeker_education_school[$i]            = $row[education_school];
        
$arr_jobseeker_education_qualification[$i]    = $row[education_qualification];
        
$arr_jobseeker_education_major[$i]            = $row[education_major];
        
$arr_jobseeker_education_gpa[$i]            = $row[education_gpa];
        
$i++;

    
    }
    
    
    
    
    
// create empty history boxes ...
    
for ($j=$i$j $row_jobseeker_education$j++) {

        if ( 
$j == )    { $bg_color "FFFFFF"; } 
        else                 { 
$bg_color "EAF2FF"; }

        
$arr_jobseeker_education_counter[$j]        = $j 1;
        
$arr_jobseeker_education_id[$j]                = $row[education_id];
        
$arr_jobseeker_education_bgcolor[$j]        = $bg_color;
        
$arr_jobseeker_education_year_start[$j]        = "";
        
$arr_jobseeker_education_year_end[$j]        = "";
        
$arr_jobseeker_education_school[$j]            = "";
        
$arr_jobseeker_education_qualification[$j]    = "";
        
$arr_jobseeker_education_major[$j]            = "";
        
$arr_jobseeker_education_gpa[$j]            = "";
    
    }
        

    
    
    
// smarty class ...
    
$smarty->assign("warning_verification_code"            $warning_verification_code            );

    
// smarty variables ...
    
$smarty->assign("jobseeker_education_id"            $arr_jobseeker_education_id                );
    
$smarty->assign("jobseeker_education_counter"        $arr_jobseeker_education_counter            );
    
$smarty->assign("jobseeker_education_bgcolor"        $arr_jobseeker_education_bgcolor            );
    
$smarty->assign("jobseeker_education_year_start"    $arr_jobseeker_education_year_start        );
    
$smarty->assign("jobseeker_education_year_end"        $arr_jobseeker_education_year_end            );
    
$smarty->assign("jobseeker_education_school"        $arr_jobseeker_education_school            );
    
$smarty->assign("jobseeker_education_qualification"    $arr_jobseeker_education_qualification    );
    
$smarty->assign("jobseeker_education_major"            $arr_jobseeker_education_major            );
    
$smarty->assign("jobseeker_education_gpa"            $arr_jobseeker_education_gpa                );
    
$smarty->assign("jobseeker_education_certification"    $jobseeker_education_certification        );
    
$smarty->assign("status_img_captcha"                $status_img_captcha                    );
    
$smarty->display('jobseeker_resume_step5.html');    



?>
  #2 (permalink)  
Antiguo 27/09/2011, 08:49
 
Fecha de Ingreso: agosto-2011
Ubicación: Viña del Mar, Chile
Mensajes: 311
Antigüedad: 12 años, 8 meses
Puntos: 50
Respuesta: Campo null

Cuál es el error que te arroja?
En la base de datos tienes como nulos los campos por defecto o NOT NULL?
saludos
  #3 (permalink)  
Antiguo 27/09/2011, 08:51
 
Fecha de Ingreso: enero-2011
Ubicación: DF
Mensajes: 898
Antigüedad: 13 años, 3 meses
Puntos: 155
Respuesta: Campo null

a ver si asi

ojo te recomiendo que revises bien el flujo de tu programa

Código PHP:
Ver original
  1. <?
  2.  
  3.  
  4.  
  5.     /*
  6.     POSSIBLE NAVIGATION SECTIONS ...
  7.     $section    = "home";
  8.     $section    = "services";
  9.     $section    = "jobseeker";
  10.     $section    = "employer";
  11.     $section    = "resources";
  12.     $section    = "search";
  13.     $section    = "contact";
  14.     */
  15.  
  16.  
  17.  
  18.     $section    = "jobseeker";
  19.     include("setting.php");
  20.     include("jobseeker_check.php");
  21.    
  22.  
  23.  
  24.     // set random passcode ...
  25.     $random_code             = strtoupper(create_passcode(5));
  26.     $status_img_captcha        = "no";
  27.     setcookie("cpasscode", $random_code);
  28.    
  29.  
  30.  
  31.     $db_connect    = mysql_connect($db_host, $db_username, $db_password);
  32.     mysql_select_db($db_name, $db_connect) || die(mysql_error());
  33.  
  34.  
  35.  
  36.     // get jobseeker details ...
  37.     $jobseeker                            = $clogin_jobseeker;
  38.     $sql_query                          = "SELECT * FROM jobseeker WHERE jobseeker_id = '$jobseeker'";
  39.     $result                                = mysql_query($sql_query) or die(mysql_error());
  40.     $row                                 = mysql_fetch_array($result);
  41.     $jobseeker_education_certification    = $row[jobseeker_education_certification];
  42.  
  43.  
  44.  
  45.  
  46.     // get education ...
  47.     $i            = 0;
  48.     $sql_query    = "
  49.    SELECT * FROM jobseeker_education
  50.    WHERE
  51.    education_jobseeker  = '$jobseeker' AND
  52.    education_start        != ''            AND
  53.    education_end        != ''            AND
  54.    education_school    != ''            
  55.    ORDER BY education_start ASC
  56.    ";
  57.     $result        = mysql_query($sql_query) or die(mysql_error());
  58.     while ($row    = mysql_fetch_array($result)) {
  59.    
  60.         if ( $i % 2 == 0 )    { $bg_color = "FFFFFF"; }
  61.         else                 { $bg_color = "EAF2FF"; }
  62.  
  63.         $arr_jobseeker_education_counter[$i]        = $i + 1;
  64.         $arr_jobseeker_education_id[$i]                = $row[education_id];
  65.         $arr_jobseeker_education_bgcolor[$i]        = $bg_color;
  66.         $arr_jobseeker_education_year_start[$i]        = "";
  67.         $arr_jobseeker_education_year_end[$i]        = "";
  68.         $arr_jobseeker_education_school[$i]            = $row[education_school];
  69.         $arr_jobseeker_education_qualification[$i]    = $row[education_qualification];
  70.         $arr_jobseeker_education_major[$i]            = $row[education_major];
  71.         $arr_jobseeker_education_gpa[$i]            = $row[education_gpa];
  72.         $i++;
  73.  
  74.    
  75.     }
  76.    
  77.    
  78.    
  79.    
  80.     // create empty history boxes ...
  81.     for ($j=$i; $j < $row_jobseeker_education; $j++) {
  82.  
  83.         if ( $j % 2 == 0 )    { $bg_color = "FFFFFF"; }
  84.         else                 { $bg_color = "EAF2FF"; }
  85.  
  86.         $arr_jobseeker_education_counter[$j]        = $j + 1;
  87.         $arr_jobseeker_education_id[$j]                = $row[education_id];
  88.         $arr_jobseeker_education_bgcolor[$j]        = $bg_color;
  89.         $arr_jobseeker_education_year_start[$j]        = "";
  90.         $arr_jobseeker_education_year_end[$j]        = "";
  91.         $arr_jobseeker_education_school[$j]            = "";
  92.         $arr_jobseeker_education_qualification[$j]    = "";
  93.         $arr_jobseeker_education_major[$j]            = "";
  94.         $arr_jobseeker_education_gpa[$j]            = "";
  95.    
  96.     }
  97.        
  98.  
  99.    
  100.    
  101.     // smarty class ...
  102.     $smarty->assign("warning_verification_code"            , $warning_verification_code            );
  103.  
  104.     // smarty variables ...
  105.     $smarty->assign("jobseeker_education_id"            , $arr_jobseeker_education_id                );
  106.     $smarty->assign("jobseeker_education_counter"        , $arr_jobseeker_education_counter            );
  107.     $smarty->assign("jobseeker_education_bgcolor"        , $arr_jobseeker_education_bgcolor            );
  108.     $smarty->assign("jobseeker_education_year_start"    , $arr_jobseeker_education_year_start        );
  109.     $smarty->assign("jobseeker_education_year_end"        , $arr_jobseeker_education_year_end            );
  110.     $smarty->assign("jobseeker_education_school"        , $arr_jobseeker_education_school            );
  111.     $smarty->assign("jobseeker_education_qualification"    , $arr_jobseeker_education_qualification    );
  112.     $smarty->assign("jobseeker_education_major"            , $arr_jobseeker_education_major            );
  113.     $smarty->assign("jobseeker_education_gpa"            , $arr_jobseeker_education_gpa                );
  114.     $smarty->assign("jobseeker_education_certification"    , $jobseeker_education_certification        );
  115.     $smarty->assign("status_img_captcha"                , $status_img_captcha                    );
  116.     $smarty->display('jobseeker_resume_step5.html');    
  117.  
  118.  
  119.  
  120. ?>
__________________
No me interesan ni las gracias ni los karmas , pero si que se genere conocimiento, si se dio con la respuesta por favor confirmalo

Etiquetas: html, mysql, null, registro, sql, variables, campos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:40.