I have an sql query like this
if (isset($_POST['no_peserta_mhs_2015'])) {
$colname_rec_mhs_2015 = $_POST['no_peserta_mhs_2015'];
}
mysql_select_db($database_connect, $connect);
$query_rec_mhs_2015 = sprintf("SELECT * FROM mhs_2015 WHERE no_peserta_mhs_2015 = %s or nama_mhs_2015 like %s ", GetSQLValueString($colname_rec_mhs_2015, "text"));
But I get this error
Warning: sprintf(): Too few arguments in C:\xampp\htdocs\gugus_2015\index.php on line 39 Query was empty
I don't know what's wrong.
You have two %s items in the string but only one parameter supplied after the string. For each '%' item in the format string it expects a matching parameter after the string to use to find in the value.
like this:
sprintf("item 1: %s, item 2: %s", "item1", "item2");
what you have is like:
sprintf("item 1: %s, item 2: %s", "item1");
so there is no entry for the item 2 string to match
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With