Hi,
i am wondering how i can select where the word start with the letter a for example?
select problem
Moderator: General Moderators
- potato
- Forum Contributor
- Posts: 192
- Joined: Tue Mar 16, 2004 8:30 am
- Location: my lovely trailer, next to the big tree
this is my query:
mysql_select_db($database_memberships, $memberships);
$query_Recordset1 = sprintf("SELECT * FROM users WHERE username like '%m%'");
$Recordset1 = mysql_query($query_Recordset1, $memberships) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1); ?>
and this i get as result:
Warning: sprintf(): Too few arguments in /home/httpd/vhosts/bevibed.be/httpdocs/TMPmw0dswcaeq.php on line 5
Query was empty
What did i wrong?
mysql_select_db($database_memberships, $memberships);
$query_Recordset1 = sprintf("SELECT * FROM users WHERE username like '%m%'");
$Recordset1 = mysql_query($query_Recordset1, $memberships) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1); ?>
and this i get as result:
Warning: sprintf(): Too few arguments in /home/httpd/vhosts/bevibed.be/httpdocs/TMPmw0dswcaeq.php on line 5
Query was empty
What did i wrong?
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
sprintf requires more than one argument because you passed it a special character % without escaping it. It appears that you want to set $query_Recordset1 to that string..
Code: Select all
$query_Recordset1 = "SELECT * FROM users WHERE username like '%m%'";