简体   繁体   English

Websql数据库将数据插入一个表中而不是另一个表中?

[英]Websql Database insert data into one table not another?

Hello Friend I Face a Strange Problem. 你好朋友,我面临一个奇怪的问题。 I developing the PHP Desktop Application, 我开发了PHP桌面应用程序,

And I am using the websql Database.When I submitted the Data into users table 我正在使用websql数据库。当我将数据提交到用户表时

Data Submitted Successfully.But When I submitted to another Table Data is not 数据已成功提交。但是当我提交到另一个表时,数据未提交

Submitted.table Structure is same.I don't Know what to do for this? Submitted.table结构相同。我不知道该怎么做?

Please help. 请帮忙。 Here is my code... 这是我的代码...

<?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";   
}   ?>

Try this code for copy all data :- 尝试使用此代码复制所有数据:

INSERT INTO tab1 SELECT * FROM tab2;

or this for copy selected data:- 或用于复制所选数据:-

INSERT INTO tab1
SELECT col1,
       col2,
       col3,
       NULL
  FROM tab2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM