php - Could not enter data: You have an error in your SQL syntax; -
can me out problem? here php code stuck error:
could not enter data: have error in sql syntax; check manual corresponds mariadb server version right syntax use near ')' @ line 1
how fix it?
$sql = "insert pemohon2(p_id,k_nom_siri,p_jenis_aset,p_pengguna_terakhir,p_tarikh_rosak) select p_id,k_nom_siri,p_jenis_aset,p_pengguna_terakhir,p_tarikh_rosak pemohon )"; mysql_select_db('kenderaan'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('could not enter data: ' . mysql_error()); } mysql_close($conn);
first of all, please use mysqli instead mysql deprecated. instance,
$con=mysqli_connect("localhost","my_user","my_password","my_db");
second, missing word "values" inside query.
$sql = "insert pemohon2 values(p_id,k_nom_siri,p_jenis_aset,p_pengguna_terakhir,p_tarikh_rosak) ;
lastly, variable reference not assign inside php. instance,
$p_id=p_id; $k_nom_siri=k_nom_siri; $sql = "insert pemohon2($p_id,$k_nom_siri)";
Comments
Post a Comment