|
 |
|
MIT app inventor 2 ส่งข้อมูลไปยัง database ของ xampp ไม่ได้อะค่ะ |
|
 |
|
|
 |
 |
|
ผมต้องการจะทำระบบสมัครสมาชิกค่ะ แต่พอส่งข้อมูลจาก app แล้วมันไม่ไปเข้าในdatabase อะค่ะ
นี่เป็นตัวอย่าง code app inventor ค่ะ

และนี่คือ code ในโปรแกรม Dreamweaver ค่ะ
Code (PHP)
<?php
DEFINE ("DBUSER", "root");
DEFINE ("DBPW", "pun10340");
DEFINE ("DBHOST", "localhost");
DEFINE ("DBNAME", "bike_user");
mysql_query("set NAMES utf8");
$dbc = mysqli_connect("localhost", "root", "pun10340","bike_user");
if(!$dbc){
die("Database connection failed: " .mysqli_error($dbc));
exit();
}
$dbs = mysqli_select_db($dbc, "bike_user");
if(!$dbs){
die("Database selection failed: " .mysqli_error($dbc));
exit();
}
$FirstName = mysqli_real_escape_string($dbc, $_GET['username']);
$Email = mysqli_real_escape_string($dbc, $_GET['userEmail']);
$Mobile = mysqli_real_escape_string($dbc, $_GET['UserMobile']);
$Address = mysqli_real_escape_string($dbc, $_GET['userAddress']);
mysqli_query = "INSERT INTO user (userName, userEmail, UserMobile, userAddress,) VALUES('$FirstName','$Email','$Mobile','$Address')";
if(mysqli_query($dbc, $query)){
echo "Records added successfully.";
} else {
echo "ERROR: Could not able to execute $query. " . mysqli_error($dbc);
}
mysqli_close($dbc);
?>
ขอความช่วยเหลือด้วยค่ะขอบคุณล่วงหน้านะคะ
Tag : PHP, MySQL, Android, XAMPP

|
ประวัติการแก้ไข 2018-04-05 18:27:11 2018-04-05 18:31:13 2018-04-05 19:03:24
|
 |
 |
 |
 |
Date :
2018-04-05 18:19:34 |
By :
pun10340 |
View :
3879 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พวกโพสต์โค้ดเป็นภาพอีกแล้ว.
|
 |
 |
 |
 |
Date :
2018-04-05 18:57:36 |
By :
mr.v |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มี Error หรือเปล่าครับ ลองดูวิธีการ Insert ด้วย mysqli ครับ
Code (PHP)
<?php
ini_set('display_errors', 1);
error_reporting(~0);
$serverName = "localhost";
$userName = "root";
$userPassword = "root";
$dbName = "mydatabase";
$conn = mysqli_connect($serverName,$userName,$userPassword,$dbName);
$sql = "INSERT INTO customer (CustomerID, Name, Email, CountryCode, Budget, Used)
VALUES ('".$_POST["txtCustomerID"]."','".$_POST["txtName"]."','".$_POST["txtEmail"]."'
,'".$_POST["txtCountryCode"]."','".$_POST["txtBudget"]."','".$_POST["txtUsed"]."')";
$query = mysqli_query($conn,$sql);
if($query) {
echo "Record add successfully";
}
mysqli_close($conn);
?>
|
 |
 |
 |
 |
Date :
2018-04-16 13:09:30 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|