close
Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
請問PHP資料庫
Jun 10th 2013, 02:59

$link = mysql_connect("localhost","root","root");

if (mysqli_connect_errno($link))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$db_selected=mysql_select_db("pd",$link);
if (mysql_errno($link))
{
echo "NO". mysql_error();
}
// Assign the query
$query = "select PD_Name,N1 from pd_realtime_status where PD_Name='PD01' " ;
// Execute the query
$result = mysql_query($query,$link);
if (!$result){
die ("Could not query the database: <br />". mysql_error());
}
?>
<table>
<tr>
<th></th>
</tr>
<?php

$x = $row["N1"];

if ($x=="0")
echo "!";
elseif ($x=="1")
echo "!!";
else
echo "!!!";

?>

請問各位大大我想要取pd_realtime_status裡面的PD01的N1哪個欄位的數值判斷
是1還是0我上面得語法有哪邊打錯嗎?或是需要修改的 我的程式成功執行只會出現"!"就算我資料庫內是0 PS.我資料庫PD_Name欄位有16個 每個都有4個小欄位

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers. Five Filters recommends: 'You Say What You Like, Because They Like What You Say' - http://www.medialens.org/index.php/alerts/alert-archive/alerts-2013/731-you-say-what-you-like-because-they-like-what-you-say.html

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜

    candycrushsaga3 發表在 痞客邦 留言(0) 人氣()