insert-into

Inserting multiple values into a MySQL at once [duplicate]

…衆ロ難τιáo~ 提交于 2020-02-26 03:27:06
问题 This question already has an answer here : Syntax error due to using a reserved word as a table or column name in MySQL (1 answer) Closed 5 years ago . could anyone shed some light as to why this PHP / MySQL is not working? Basically I need to insert loads of rows at once from a form, so there will be multiple name fields, multiple short, med, long fields etc.. Im getting this error: Notice: Undefined variable: Short1 in C:\xampp\htdocs\process.php on line 95 You have an error in your SQL

insert span values in database with PHP Prepared Statements

这一生的挚爱 提交于 2020-01-16 19:36:48
问题 I have a contact form where I have some checkboxes. After the user submits the form I want to get their entries in the database. I can do this properly, but today I wanted to change my form to be responsive. I changed my simple checkboxes to span tags, but now I can not get the values in the database. It did not give me any error but also did not show anything in the database. <html> <body> <form action="" method="POST" > <section> <div class="wrapper-checkbox"> <div class="checkbox"> <div

SQL Server 2008: Sql Insert/Update into another table using insertion IDs output from another table

南楼画角 提交于 2020-01-15 03:32:28
问题 I have a procedure for insert in multiple dependent tables (update in case record exist). I have input parameters as comma separated string which I am reading in table. After 1st insertion I am getting InsertedIds in another table variable. I am struggling over how to do insert in 2nd table. I have following input parameters for 2nd table: Declare @IdsToBeUpdated table (primary key identity pkey, id int) -- values are 1,-1,3,-1 Declare @CommentsTobeInserted table( primary key identity pkey,

Insert data in mysql colum with spaces with php

Deadly 提交于 2020-01-07 09:31:53
问题 I've got a little question about my script, I'm trying to enter a lot of data in my MySQL database but I've got the next problem I can't enter the data with php because there is a space in one of my column names here is the code $qw1 = "voornaam, achternaam, straat, postcode, geboortejaar, telefoonnummer, email, ORDER DATE"; $qw2 = "'$vnaam', '$anaam','$straat', $code, $geboorte, $tel, '$email', '$dateandhour'"; mysql_query("INSERT INTO bestellingen ($qw1) VALUES ($qw2)"); I hope someone

Active Record Insert Into

时光毁灭记忆、已成空白 提交于 2020-01-05 10:26:53
问题 I am trying to allow my Rails App some advanced functionality in way of creating relationships. I am running MySQL as the back-end. The query below runs just fine in PHPMyAdmin, but upon attempted execution in rails, it does nothing, no errors and no database writes.... I use active record to create the relationships between Campaign and Location, and then the query below should work to build afterward in campaign_metros table: class CampaignLocation < ActiveRecord::Base belongs_to :campaign

Move row from one table to another?

时光毁灭记忆、已成空白 提交于 2019-12-29 04:36:10
问题 I have two tables with the same column definitions. I need to move (not copy) a row from one table to another. Before I go off and use INSERT INTO/DELETE (in a transaction), is there a smarter way? SQL Server 2005 回答1: for SQL Server 2005 and up, try the OUTPUT Clause (Transact-SQL) clause: DELETE OldTable OUTPUT DELETED.col1, DELETED.col2... INTO NewTable WHERE ID=... Working example: DECLARE @OldTable table(col1 int, col2 varchar(5), col3 char(5), col4 datetime) DECLARE @NewTable table(col1