php数据库表输出到网页 php从数据库取数据输出

php查询数据库并在网页上输出结果$sql = 'SELECT COUNT( * ) FROM DAY WHERE id_u =1' ;
$resault = $db-getAll($sql);
//
function getAll($sql)
{
$res = $this-query($sql);
if ($res !== false)
{
$arr = array();
while ($row = mysql_fetch_assoc($res))
{
$arr[] = $row;
}
return $arr;
}
else
{
return false;
}
}
//
function query($sql, $type = '')
{
if ($this-link_id === NULL)
{
$this-connect($this-settings['dbhost'], $this-settings['dbuser'], $this-settings['dbpw'], $this-settings['dbname'], $this-settings['charset'], $this-settings['pconnect']);
$this-settings = array();
}
if ($this-queryCount++ = 99)
{
$this-queryLog[] = $sql;
}
if ($this-queryTime == '')
{
if (PHP_VERSION = '5.0.0')
{
$this-queryTime = microtime(true);
}
else
{
$this-queryTime = microtime();
}
}
/* 当当前的时间大于类初始化时间的时候,自动执行 ping 这个自动重新连接操作 */
if (PHP_VERSION = '4.3'time()$this-starttime + 1)
{
mysql_ping($this-link_id);
}
if (!($query = mysql_query($sql, $this-link_id))$type != 'SILENT')
{
$this-error_message[]['message'] = 'MySQL Query Error';
$this-error_message[]['sql'] = $sql;
$this-error_message[]['error'] = mysql_error($this-link_id);
$this-error_message[]['errno'] = mysql_errno($this-link_id);
$this-ErrorMsg();
return false;
}
if (defined('DEBUG_MODE')(DEBUG_MODE8) == 8)
{
$logfilename = $this-root_path . DATA_DIR . '/mysql_query_' . $this-dbhash . '_' . date('Y_m_d') . '.log';
$str = $sql . "\n\n";
if (PHP_VERSION = '5.0')
{
【php数据库表输出到网页 php从数据库取数据输出】file_put_contents($logfilename, $str, FILE_APPEND);
}
else
{
$fp = @fopen($logfilename, 'ab+');
if ($fp)
{
fwrite($fp, $str);
fclose($fp);
}
}
}
return $query;
}
php怎么能把数据库里的数据自动调用到网页上显示出来mysql_select_db($database);
要是
?php
$con = mysql_connect("localhost","root","");mysql_select_db($sql);
$result=mysql_query('select name from tag_cate where id=3');mysql_close($con);
?
还是无内容显示咋办php数据库表输出到网页?sql是数据库名 。

?php
$con = mysql_connect("localhost","root","");mysql_select_db($sql);
//$result是记过集好不好php数据库表输出到网页 , 还有php数据库表输出到网页你的输出呢?echo?
$result=mysql_query('select name from tag_cate where id=3') or die('ERROR : '.mysql_error());if($result){
if (mysql_num_rows($result) == 0) {
while($row = mysql_fetch_assoc($result)){echo $row['name'].'';
}
}
mysql_free_result($result);
}
mysql_close($con);
php网页中调用php脚本查询数据库结果输出到当前页面php数据库表输出到网页你要输出什么php数据库表输出到网页?php数据库表输出到网页我就假设两个条件是数字php数据库表输出到网页,选好条件提交后php数据库表输出到网页,显示条件1还是条件2吧 。
form action="" method="post"
label条件1:
select name="select1"
option value="https://www.04ip.com/post/0" selected="selected"选项1/option
option value="https://www.04ip.com/post/1"选项2/option
/select
/label
label 条件2:
select name="select2"
option value="https://www.04ip.com/post/0" selected="selected"选项1/option
option value="https://www.04ip.com/post/1"选项2option
option value="https://www.04ip.com/post/2"选项3/option
/select
/label

推荐阅读