关于PHP MYSQL的一个查询语句
SELECT * FROM count WHERE count LIKE '2,%' OR count LIKE '%,2' OR count LIKE '%,2,%'
ph
少了单引号:
$result1=mysql_query("S脚蛋顾思城相望组冲刚ELECT * FROM userinformation WHERE Accountname='".$a."'");
PHP mysql 查询语句求教
<?php
/**
*
*@author tanqing
*@date 2015年7月16日
*email itanqing@
*/
/*
* $str = file_get_contents('./a.txt');
* $str = preg_replace('/s/', '#', $str);
* $arr = explode('#', $str);
* print_r($arr);
* $data['riqi'] = $arr[0];
* $data['qihao'] = $arr[1];
*/
header("Content-type: /html; charset=utf-8");
$link = mysql_connect('127.0.0.1','root','123456');
$database = 'mytest';
$tab_1_sql= 'select * from tab_1';
$tab_1_result = mysql_db_query($database, $tab_1_sql);
while ($tab_1_row = mysql_fetch_assoc($tab_1_result)){
$tab1Result[$tab_1_row['pid']] = $tab_1_row['name'];
}
$query = 'select * from tab_2 ';
$result = mysql_db_query($database, $query);
$row=mysql_fetch_row($result);
while ($row=mysql_fetch_assoc($result))
{
$rowResult[$row['date']][$row['pid']] = $row['val'];
}
?>
<table>
<tr>
<td>日期</td>
<?php foreach ($tab1Result as $pid=>$pname){?>
<td><?php echo $pname;?></td>
<?php }?>
</tr>
<?php foreach ($rowResult as $date=>$val){?>
<tr>
<td><?php echo $date;?></td>
<?php foreach ($tab1Result as $pid=>$pname){?>
<td><?php if ($val[$pid]) {
echo $val[$pid];
}else{
echo 0;
} ?></td>
<?php }?>
</tr>
<?php }?>
</table>
打印结果