I have an array with the values like
$array = array('T-106', 'T-125', 'anyname');
$imploade_id = implode(', ', $array);
I want to put these result into mysql
mysql_query("select * from table_name where userid in ($imploade_id)");
But I got an error with this query that is
Unknown column 'T' in 'where clause'
I also used
select * from table_name where userid in ( CONVERT ('T-106' USING urf8) )
It 开发者_开发知识库works fine for just one id but i don't know how to use with $implode_id
or with the set of ids.
Replace top 2 lines with this
$array = array('T-106', 'T-125', 'anyname');
$imploade_id = implode("','", $array);
$imploade_id="'$imploade_id'";
and try
If you want to put into a database you use INSERT
and not SELECT
.
Example:
mysql_query("INSERT INTO table_name (column) values ($imploade_id)");
精彩评论