³õѧPHP,Êý¾Ý¼¯Ôõô´¦Àí³ÉÊý×é - PHP / »ù´¡±à³Ì
±ÈÈçÎҵIJéѯÓï¾äÊÇ"select username,sex,age from users"
ÎÒÔõôÄܰѲ鵽µÄ½á¹ûÓëÊý×é°ó¶¨
Çë¸ø³öÍêÕû´úÂë
$sql = "select username,sex,age from users";
$query= mysql_query($sql);
while($fetch=mysql_fetch_array($query)){
$array[] = array(
'sex' => $fetch['sex'],
'username' => $fetch['username'],
'age' => $fetch['age'],
);
}
PHP code:
$result = mysql_query($_sql, $this->m_database) ;
// »ñµÃ²éѯµÄ½á¹û´æÈëArray
$queryResult = array ();
while ( $row = mysql_fetch_assoc ( $result ) ) {
$queryResult [] = $row ;
}
// ÊÍ·Å
mysql_free_result ( $result );
// ²éѯµÄ½á¹û·µ»ØArray
return $queryResult;
ÆäÖÐ $_sqlÊÇÒªÖ´ÐеÄsqlÓï¾ä£¬$this->m_database ¿ÉÒÔÌæ»»³ÉÄãÒª²éѯµÄÊý¾Ý¿â×Ö·û´®
Ïà¹ØÎÊ´ð£º
ÇëÎÊÏÂÄܲ»ÄÜÔÙwindows϶¨ÆÚÇå¿ÕmysqlÒ»¸ö±íÖеÄÈ«²¿Êý¾Ý£¬ÓÃPHPʵÏÖ£¡
лл¸÷λÁË
¾Í±ÈÈçÒ»¸öÐÇÆÚÇå¿ÕÒ»´Î
±ÈÈçÿ¸öÐÇÆÚÁùÁãµãÇå¿ÕÒ»´Î£¡
ллÁË
¼Æ»®ÈÎÎñ...php....sql...truncate....OK
Äã¾ÍÕâ½ÓÔÚҳà ......
¹ýÍêÄêҪȥÎ人ÁË£¬ÏëÁ˽âÒ»ÏÂPHPÅàѵ±È½ÏÕý¹æ?
Ŷ ¶ÔÁË£¬»¹ÓУ¡PHPÊÖ²á±ØÐëµÃŪһ¸ö
àÅ ÌìÌìÔÚ¿´Ê¥¾£¨Ò»ÌìÒ²¾ÍÖ»ÄÜ¿´¸ö¶þʮҳ£©£¬PHP100ÊÓÆµ½Ì³Ì¿´ÁË33½²ÁË£¨Ò»ÌìÒ²Ö»¿´Ò»½²£©
ÎÒ»á¼á³Ö°ÑÕâ±¾ÊéºÍÊÓÆµ¸ã¶¨ ......
index.phpÄÚÈÝ£º
$smarty->assign('name',strtotime('-0'));
$smarty->display("index.html");
index.htmlÄÚÈÝ£º
{$name|date_format:'%Y-%m-%d'}<hr>
{$ ......