你好朋友我面临一个奇怪的问题。我正在开发PHP桌面应用程序,
我正在使用websql Database。当我将数据提交到用户表
时数据成功提交。但是当我提交到另一个表时数据不是
Submitted.table结构是一样的。我不知道该怎么办?
请帮忙。这是我的代码......
<?php
session_start();
//$WindowUser = getenv('username');
//$myPDO = new PDO("sqlite:C:/Users/".$WindowUser."/Desktop/barber_shop/webcache/databases/http_127.0.0.1_51915/2");
include("../sqlitePhpDatabase/sqlitePhpDatabase.php");
$store_name = $_POST['store_name'];
$street = $_POST['street'];
$status = $_POST['status'];
$location_id = $_POST['location_id'];
$sth = $myPDO->exec("INSERT INTO bs_stores(store_name,street, status,location_id)VALUES('store_name','$street','$status','$location_id')");
//$sth = $myPDO->exec("INSERT INTO bs_locations(city)VALUES('rere')");
if(isset($sth) && !empty($sth))
{
echo "done";
}
else
{
echo "data is not submiting";
} ?>
答案 0 :(得分:0)
尝试使用此代码复制所有数据: -
INSERT INTO tab1 SELECT * FROM tab2;
或复制所选数据: -
INSERT INTO tab1
SELECT col1,
col2,
col3,
NULL
FROM tab2