photoshop學習網站 壞狼php學習 計數器執行個體代碼

來源:互聯網
上載者:User
然後建立檔案如下,第1步驟連資料庫,然後寫,然後讀.

複製代碼 代碼如下:



$mysql_server_name = "localhost";
$mysql_username = "root";
$mysql_password = "";
$mysql_database = "db";
//抓ip
$ip = getenv ("REMOTE_ADDR");
//建立連線--透過(伺伺服器位置,使用者名稱,使用者密碼)
$conn = mysql_connect($mysql_server_name,$mysql_username,$mysql_password);
//準備好 sql文法 此文法為新增資料
$sql = "INSERT INTO `num` ( `name` ,`ip`, `new` ) VALUES ('badwolf','$ip','1');";
//選取你想要處理的資料庫
mysql_select_db($mysql_database,$conn);
//進行查詢
$result = mysql_query($sql);
//結果並且釋放連線
mysql_close($conn);
//------------------------------------------------------------------
//以下為印出資料
//建立連線 透過(伺伺服器位置,使用者名稱,使用者密碼)
$conn = mysql_connect($mysql_server_name,$mysql_username,$mysql_password);
//準備好 sql文法 此文法為讀取資料
$sql = "SELECT COUNT(*) FROM `num` WHERE name='badwolf' ";
//進行查詢
$result = mysql_db_query($mysql_database,$sql,$conn);
//將查詢後的結果 抓出
$row = mysql_fetch_row($result);
//印出該資料的所有欄位
//print_r($row);
//清除查詢後的結果
mysql_free_result($result);
?>



壞狼安全網php計數器




壞狼安全網php計數器


開站至今已經有人次





以上就介紹了photoshop學習網站 壞狼php學習 計數器執行個體代碼,包括了photoshop學習網站方面的內容,希望對PHP教程有興趣的朋友有所協助。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.