bluebutterflyofyourmind Posted July 31, 2008 Share Posted July 31, 2008 so from phpmyadmin, look at the table medic_registered_course and tell me what types you assigned to which fields Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604151 Share on other sites More sharing options...
girlzz Posted July 31, 2008 Author Share Posted July 31, 2008 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")); Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604157 Share on other sites More sharing options...
bluebutterflyofyourmind Posted July 31, 2008 Share Posted July 31, 2008 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 Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604159 Share on other sites More sharing options...
girlzz Posted July 31, 2008 Author Share Posted July 31, 2008 s_code is retrive from ajax which id="txtHint" Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604164 Share on other sites More sharing options...
bluebutterflyofyourmind Posted July 31, 2008 Share Posted July 31, 2008 yes but you need a field for s_code to be stored in the database. correct? Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604165 Share on other sites More sharing options...
girlzz Posted July 31, 2008 Author Share Posted July 31, 2008 oh that means i had to change at the getvalue string from txthint to s_code?? Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604167 Share on other sites More sharing options...
bluebutterflyofyourmind Posted July 31, 2008 Share Posted July 31, 2008 k in your database......in your table.....do you have a field called s_code? Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604172 Share on other sites More sharing options...
girlzz Posted July 31, 2008 Author Share Posted July 31, 2008 yup... in table medic_registered_course Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604174 Share on other sites More sharing options...
bluebutterflyofyourmind Posted July 31, 2008 Share Posted July 31, 2008 is it's type varchar? Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604176 Share on other sites More sharing options...
bluebutterflyofyourmind Posted July 31, 2008 Share Posted July 31, 2008 and in your GetSQLValueString you have no case for varchar Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604178 Share on other sites More sharing options...
girlzz Posted July 31, 2008 Author Share Posted July 31, 2008 yup... no case for varchar??? explain please Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604179 Share on other sites More sharing options...
bluebutterflyofyourmind Posted July 31, 2008 Share Posted July 31, 2008 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; Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604182 Share on other sites More sharing options...
girlzz Posted July 31, 2008 Author Share Posted July 31, 2008 still s_code connot be null... arghhh so stuck!! huhuhuhh Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604193 Share on other sites More sharing options...
girlzz Posted July 31, 2008 Author Share Posted July 31, 2008 finally.... it's work!!!! yeaaahhhhh!! thanksss!!!!!!! Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604194 Share on other sites More sharing options...
bluebutterflyofyourmind Posted July 31, 2008 Share Posted July 31, 2008 excellent. not sure if anything i said helped but glad you got it working! do'nt forget to mark this topic as solved at the bottom of this thread. seee ya! -Grant Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604195 Share on other sites More sharing options...
girlzz Posted July 31, 2008 Author Share Posted July 31, 2008 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? Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604200 Share on other sites More sharing options...
bluebutterflyofyourmind Posted July 31, 2008 Share Posted July 31, 2008 depends on how you set up your ajax function. i'd say you should make a new AJAX function for each new request. Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604201 Share on other sites More sharing options...
girlzz Posted July 31, 2008 Author Share Posted July 31, 2008 ok thanks.. Link to comment https://forums.phpfreaks.com/topic/117009-solved-automatic-display/page/2/#findComment-604209 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.