Jump to content

Archived

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

girlzz

[SOLVED] automatic display

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"));
				   

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

oh that means i had to change at the getvalue string from txthint to s_code??

Share this post


Link to post
Share on other sites

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;

Share this post


Link to post
Share on other sites

still s_code connot be null... arghhh so stuck!! huhuhuhh

Share this post


Link to post
Share on other sites

thanks a lot.. now i can try to make ajax using matric_no.. if i want to make using ajax,i still have to make new function or just create new ajax?

Share this post


Link to post
Share on other sites

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