微信開發MySQL篇(二)

2021-08-03 05:43:27 字數 527 閱讀 5780

如何將頁面表單資料存入資料庫呢?

表單內資料可以提交到乙個php檔案中,然後通過post或者get方式我們可以獲取到這些資訊,然後通過資料庫操作進行儲存。

來乙個簡單的例子

<?php

$con=mysql_connect("localhost","root","password");

if(!$con){

die("cannot connect".mysql_error());

mysql_select_db("my_db",$con);

$sql="insert into persons(

firstname,lastname,age) values(

'$_post[firstname]','$_post[lastname]','$_post[age]'

if(!mysql_query($sql,$con)){

die('error'.mysql_error());

echo"成功新增";

mysql_close($con);

微信開發MySQL篇(一)

1mysql是一種資料庫,定義儲存資訊的結構。2mysql資料庫連線,並建立資料庫和資料庫表 步驟是 首先連線資料庫,然後建立資料庫 現在沒有考慮資料庫已存在,建立的是不存在的資料庫 然後選擇這個資料庫,目的是告訴程式在哪個資料庫中建立表,或者執行其他操作。一般先將操作儲存在乙個變數中,然後去將變數...

微信開發 二 微信選單建立

在下面的介面除錯中可以立即看到建立的選單。特別需要注意的是選單的url裡面一定不能包含空格不然選單會一直建立不成功,本人就是因為這個問題花了半天的時間。下面附上建立選單的 public static void createmenu string type throws unsupportedenco...

C 微信開發 微信會員卡(二)

如圖 點選啟用會員卡時,要跳轉到如下的 要實現這個功能,首先我們在建立會員卡後就操作如下 region 新增啟用時的自定義字段 string customfiled customfiled string customurl access token string resultcustom postw...