Jump to content

[SOLVED] automatic display


girlzz

Recommended Posts

matric_no------>varchar

name-------->text

year---------->varchar

group-------------> int

session---------> varchar

id---------> int

i had made changes in my code but it return to this error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'block 2,, 2)' at line 1

 

$insertSQL2 = sprintf("INSERT INTO medic_registered_course (matric_no, name, sessi, `year`,`s_code`, `group`) VALUES ( %s, %s, %s, %s,%s, %s)",
                       GetSQLValueString($_GET['matric'], "varchar"),
                       GetSQLValueString($_GET['name'], "text"),
                       GetSQLValueString($_GET['sessi'], "varchar"),
                       GetSQLValueString($_GET['year'], "varchar"),
			        GetSQLValueString($_GET['txtHint'], "varchar"),
                       GetSQLValueString($_GET['group'], "int"));
				   

where is the field for s_code?

 

also in your sql statement, you should not have ' around year, s_code or group.

 

infact... where is your stuff for s_code. i only see it in one spot in the sql statement.  you have no GetSQLValueString for it

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}

 

you have no 

 

case"varchar":
$theValue = other code
break;

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.