FAQ Database Discussion Community


Insert into Database using OleDbConnection

asp.net,vb.net,insert,sql-update,oledbcommand
I am almost finished with my code but never inserted data into the database before. So far my SQL statement works fine but the final execution of the code I don't know how to do. The new record doesn't show up in my database so I think I am missing...

insert data from 3 tables with the same fields into 1 table

mysql,sql,insert,insert-into
I have 3 tables (accnt, jobcost, and servic15). all with the same fields (code, jno, ven, date). I need to insert the data from these tables into another table called dummy with the same fields, in one query. how do I do this? i have used 3 separate insert into...

How to Insert auto increment ID where column not auot_increment

sql,insert,auto-increment
I am trying to insert some Data in a Table where the ID is int. The Id is unique and I have no idea why the developer of this software have not set this field to auto_increment So normaly this would work, because with auto_increment I would exlude the ID...

time complexity of randomized array insertion

arrays,algorithm,random,insert,time-complexity
So I had to insert N elements in random order into a size-N array, but I am not sure about the time complexity of the program the program is basically: for (i = 0 -> n-1){ index = random (0, n); (n is exclusive) while (array[index] != null) index =...

Update inserted record on a trigger

sql-server,triggers,insert,sql-update
I'm having troubles while trying to update a record when it is being inserted into a database via external application. I need the record being inserted from the users in the application takes a value MinimumStock from a table AERO_LOCATIONSTOCKMIN on which are the parent location and the asset type...

Schedule a SQL INSERT from a live table to another table with a group function in Oracle

sql,oracle,insert
I am trying to query data from 2 tables using this SQL: SELECT m.site, round(avg(s.resptm),2) AS Avg_Response, TO_DATE(TO_CHAR(s.starttm, 'YYYY-MM-DD HH24:')||TRUNC(TO_NUMBER(TO_CHAR(s.starttm,'MI'))/30,0)*30||':00', 'YYYY-MM-DD HH24:MI:SS') endtm FROM s LEFT OUTER JOIN m ON s.KEY = m.KEY WHERE s.starttm >= sysdate - 1 GROUP BY m.site, TO_DATE(TO_CHAR(s.starttm, 'YYYY-MM-DD HH24:')||TRUNC(TO_NUMBER(TO_CHAR(s.starttm,'MI'))/30,0)*30||':00', 'YYYY-MM-DD HH24:MI:SS'); This issue is...

Pass array on to sql and insert it in link table with one value

sql,sql-server,table,select,insert
I've found ways to pass an array to a stored procedure and ways to insert a table into another table. But I want to insert my array in a table as column2 with one other value I have as the value for column1: INSERT INTO Table1 (column1, column2) VALUES (SELECT...

INSERT INTO mysqli not working

php,mysql,insert
I cannot seem to get this inserting. nothing inserts at all. I have tried this a couple of ways now but neither work. the connection to the db is there but no insert. $insert = "INSERT INTO friendshipTable ( user_a_memberID , user_b_memberID ) VALUES ($member_id,$addFriendID)"; $resultx = mysqli_query($connExt, $insert); JSfiddle...

Textarea each line is a new value in the db

php,database,insert,textarea
I'm wondering how I could use the textarea in order to make each line a new value in my database. So for example, I'd put this in a text area: 1 2 3 And then each value (1,2,3) would come up as different values. How can I proceed doing this?...

INSERT + SELECT + ON DUPLICATE KEY with column aliases in SELECT clause

mysql,select,insert,sql-update
I'm hitting a rather surprising roadblock when attempting to chain together INSERT, SELECT and ON DUPLICATE KEY in a query where the SELECT clause has column aliases. For example, consider the following situation: Tables: CREATE TABLE source ( id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, v INT NOT NULL );...

update data in a table from a FK referenced table

postgresql,insert
I have two tables device_test_results and devices. device_test_results - id - device_id (FK) - brand - model - serial_number devices - id - brand - model - serial_number device_test_results has a foreign key - device_id that references to the devices table It's been a while since I've used this setup...

Simple Insert Variable PHP into MySQL

php,mysql,variables,insert
I have a simple bit of code that I can't get working. <?php $mysqli_connection = new MySQLi('localhost', 'root', 'secret', 'edgeserver'); if ($mysqli_connection->connect_error) { echo "Not connected, error: " . $mysqli_connection->connect_error; $username = 'Eddie'; $username = mysql_real_escape_string($username); $email = '[email protected]'; $email = mysql_real_escape_string($email); $sql = "INSERT INTO `users` (`username`, `email`) VALUES...

SQL Server insert number with commas

sql-server,insert,numbers,comma
I created a database table: I run this query INSERT INTO dbo.Stats (Date_of_Record, Rack_Code, Total_MB, Schools_MB, Percent_Schools, Central_MB, Percent_Central) VALUES (CAST(GETDATE() AS DATE), '78Q425', 45, 297, 1, 361, 0, 12, 0) and I get an error Msg 110, Level 15, State 1, Line 1 There are fewer columns in the...

How to insert N rows of default values into a table

sql,sql-server,tsql,insert
I have a table containing an identity column as well as a column representing the creation date: CREATE TABLE dbo.OrderStatus ( OrderStatusId int IDENTITY(1, 1) NOT NULL, CreationDate datetime NOT NULL default GETDATE(), CONSTRAINT PK_OrderStatus PRIMARY KEY(OrderStatusId) ) Since the identity column generates a value by itself and the CreationDate...

JPA persit creates new existing entity in many to one relation

java,hibernate,jpa,insert
I'm new in JPA and I have de following Entities in my project : Animal entity : package com.shop.model; import java.io.Serializable; import javax.persistence.*; @Entity @NamedQueries({ @NamedQuery(name="Animal.findAll", query="SELECT a FROM Animal a"), @NamedQuery(name="Animal.findAllByTypeId", query="SELECT a FROM Animal a WHERE a.type.id = :id"), }) public class Animal implements Serializable { private static...

Pentaho: Insert a set of dynamic records into a database

insert,pentaho,kettle,pdi
Using Pentaho, I would like to SELECT a number of records from a database and INSERT them into another one. I have no problem with the first part and using Input Table step, I have selected my desired records. But I have no idea about how to develop a step...

Insert a row when create a user in wordpress

insert,wordpress-plugin,user-registration
I want to INSERT a row in a custom table when Admin will create an user from admin panel. I have written a function for this but it is not working. <?php add_action( 'user_register', 'myplugin_registration_save', 10, 1 ); function myplugin_registration_save( $user_id ) { global $wpdb; $user_info = get_userdata($user_id); $admin_id =...

Insert a value in a Mysql database using Python

python,mysql,input,insert,value
I am trying to insert values typed from me to a MySQL database. I am using python 3.4 and mysql.connector. Here is the part of the script: Value = int(input("Type a number between 1 and 10: ")) cursor.execute("""INSERT INTO test VALUES ('Number', Value )""") I am actually trying to find...

Radgrid insert with dropdown gets null value when I insert

c#,asp.net,insert,telerik,radgrid
I am using asp.net C# with telerik. I have radgrid and a button add new record. I press it and fill up the informations but the problem is when I press insert it says that ParentDist and RankLevel can not be null. In other words I can get the value...

How to INSERT INTO a MySQL database using a HTML Select [closed]

php,mysql,database,insert
I'm not sure why my code is not working, i have moderate knowledge of HTML but little to know knowledge of PHP or MySQL databases. If anyone could point me in the right direction that would be awesome. Thanks in advance <body> <form method="POST" action=''> <input type="submit" name="button1" value="My Button">...

codeigniter: how to put the value of the array into a specific table column?

php,mysql,sql,codeigniter,insert
I have an array like this array(12) { [0]=> string(1) "3" [1]=> string(1) "3" [2]=> string(1) "5" [3]=> string(1) "3" [4]=> string(1) "4" [5]=> string(1) "3" [6]=> string(1) "3" [7]=> string(1) "3" [8]=> string(1) "2" [9]=> string(1) "3" [10]=> string(1) "2" [11]=> string(1) "3" } the array is dynamic, so,...

SQL INSERT from two tables

c#,mysql,sql,sql-server,insert
I have 3 tables: Employee(Employee_ID, First_Name, Last_Name) Project(Project_ID, Project_Name) Task(Employee_ID, Project_ID, Assigned_Project_Task) I want to insert Employee_ID from Employee to Task when I give the first and last name to the respective id (ex. Employee_ID=1 First_Name=ABC Last_Name=XYZ and I give ABC as first name and XYZ as last name, 1...

Inserting with WHERE and AND, Error Code: 1241. Operand should contain 1 column(s)

mysql,sql,insert,insert-select
Getting an error saying: Error Code: 1241. Operand should contain 1 column(s) INSERT INTO TBL_TESTER_INFO2 ( board_id, tester_name, board_name, config, operating_system, log_created ) VALUES ( (SELECT bl.id as 'board_id', bl.tester_type, bl.board_name FROM TesterDeviceMatrix.TBL_BOARD_LIST bl WHERE bl.tester_type = 'UFLEX' AND bl.board_name = 'HSD-U' ), 'tester', 'board', 'slot', 'windows', '2015-06-10 16:08:42' );...

Basic cron job issue

javascript,html,insert,cron,jobs
I have a particular script in my HTML file that I want to run every 24 hours using a cron job. My question is what path do I enter into my hostinger (host) command. Do I enter php /path/to/index.php because won't that run my whole code every 24 hours, I...

Mongoose Insert many to one

node.js,mongodb,insert,mongoose
I need to help! I'm creating a website with nodejs and mongo for learning. I have a problem that I know the best way to do it. I have two collections codes and tag into table codes I have the tags field is array of tags. CodeModel: var CodeSchema =...

Insert object element into array in ordered position, without using sort algorithm in Java

java,arrays,algorithm,sorting,insert
I have programming projectת I have it almost finished, but I am struggling on inserting a new object made from the console into the array at the correct position. I can make the object, insert at either the beginning or end, delete object, etc. but the array needs to be...

PL/SQL can't put value into index by table

table,indexing,plsql,insert,value
I can't put my value of v_emp into my emp_table. It is all going wrong at this line: emp_table(counter) := v_emp; The error that i get is: invalid use of type name of subtype name I can't see what the problem is.. CREATE OR REPLACE PROCEDURE laatste_emp IS v_emp employees%ROWTYPE;...

SQLite INSERT with SELECT

sqlite,insert,insert-into
I have a problem with INSERT Query. I want to insert some fixed values as a name but as well some calculated values. A simple example: INSERT INTO Players VALUES('Name', 10.0, SELECT COUNT(*) AS Amount FROM Stack7 WHERE Name LIKE '%Name%', 1.0) Table Players: CREATE TABLE `Players` ( `Name` TEXT,...

Data type mismatch when inserting record

sql,vb.net,ms-access,parameters,insert
I've this piece of code for inserting records into an Access table. LastUpdated field is defined as Date/Time at database level. It fails when inserting giving the error Data type mismatch in criteria expression I'm using parameterized query which avoid problems with formatting values and it's very weird because I've...

Add string in a specific part of text file Javascript

javascript,string,node.js,file,insert
At the moment I have a text file looking like this: function NAME(){ } I would like to insert a string in the parenthesis after NAME, I have been researching for hours and have not been able to find a good enough explanation for this problem. Any hep will be...

Why do I keep getting this error message when I try to insert something into a table

sql,sql-server,triggers,insert
Here is the question that I have to answer: Create a trigger named Products_INSERT that inserts the current date for the DateAdded column of the Products table if the value for that column is null. Test this trigger with an appropriate INSERT statement. Here is the code that I have:...

PHP / MySQL: How to return info if record already exists (without update)

php,mysql,ajax,insert,duplicates
I am using the below to insert a new row into a MySQL db. The query for this is stored in a PHP file (ajax.php) and the input values are passed to this via an Ajax call in jQuery. Everything works as intended but I would like to return a...

Going through and inserting data to std vectors

c++,c++11,vector,insert,iterator
I am strugling with this problem for a longer while now. I never had this kind of problems when using QVector, but unfortunetally I cannot use qt in this one... What I am trying to do is to go through 2 vectors which contains points X and Y as doubles....

How to do a multiple insert using LAST_INSERT_ID() MySQL?

php,mysql,sql,insert
I have 3 tables: customer email phone Everyone of them with its own AUTO_INCREMENT id (id_customer, id_email, id_phone) and I have 2 more tables to relate them: customer_email customer_phone These tables contain the others's tables ids as foreign keys. How can I relate them in a single SQL statement using...

Insert into List of Class C++

c++,list,class,visual-c++,insert
can someone tell me how can i add data into my list of class with C++ please ? #include <string> class Person { private: std::string Name; public: Person(); ~Person(); std::string GetName() { return Name; } std::string SetName(std::string name) { name = Name; return name; } }; void main() { list<Person>...

Select insert with sequence and distinct

sql,oracle,select,insert,distinct
I'm trying to perform a select insert where I need to use a sequence and a distinct clause. I know we can't use sequences with distinct so, I've nested a subquery inside the FROM, like this: INSERT INTO SchemaName.XXSON_ST_B2B_CTR_PRICING (SEQ_NO,SEEB_KEY,MESSAGE_ID,MESSAGE_TYPE,CREATE_DTIME,CHANGE_DTIME,STATUS) SELECT XXSON.XXSON_B2B_CTR_PRICING_SEQ.NEXTVAL AS SEQ_NO, 'SESS_NO' AS SEEB_KEY, srp.ITEM AS MESSAGE_ID,...

Inserting lines of text between different lines of text

batch-file,cmd,insert,windows-7-x64
I want to insert lines of text between different lines of text, For example: I am Running on Windows 7 x64. I have a file called Lines2Insert.txt, this file contains thousands of lines of text that look like the following: WRAITH_CAPITALBATTLESHIP WRAITH_CAPITALCARRIER WRAITH_CAPITALCOLONY WRAITH_CAPITALSIEGE WRAITH_CAPITALSUPPORT WRAITH_CAPITALTRANSPORT WRAITH_CRUISERANTIMODULE I want to...

Insert transaction if not exists in SQL Server

sql,sql-server,insert,transactions,procedures
I want to insert in the table only if I do not have the specific column it is a track table with different titles and I want to add different titles with one procedure I did the try catch and I have problem in my where not exists condition, I...

pandas python: adding blank columns to df

python,pandas,insert,dataframes,col
I'm trying to add x number of blank columns to a dataframe. Here is my function: def fill_with_bars(df, number=10): ''' Add blank, empty columns to dataframe, at position 0 ''' numofcols = len(df.columns) while numofcols < number: whitespace = '' df.insert(0, whitespace, whitespace, allow_duplicates=True) whitespace += whitespace return df but...

How to insert record into two mysql table using php?

php,mysql,insert
I have to two tables in my database one is "test1" and the second is "test2". and the field for test 1 is "id","survey_no","lastname" and for the field of test i have "id","survey_no","address" the id for test1 and test2 are primary key and set to auto-increment..what i want here is...

Codeigniter Select JSON, Insert JSON

json,codeigniter,select,insert,routing
I have very simple users database: user_id, user_name, user_email My model this: class Users extends CI_Model { private $table; private $table_fields; private $table_fields_join; function __construct() { parent::__construct(); $this->table = 'users'; $this->table_fields = array( $this->table.'.user_id', $this->table.'.user_name', $this->table.'.user_email' ); $this->table_fields_join = array(); } function select(){ $this->db->select(implode(', ', array_merge($this->table_fields, $this->table_fields_join)));...

java mysql input NULL

java,mysql,insert,null
I am using MySQL Server 5.6, Tomcat 8.0. I can create an SQL input statement that is successful in putting hard coded values into my table but if I try to use a variable instead, it appears as NULL in the table. I have println statements immediately before the SQL...

Compare arrays from mysql-colums then insert something in each row with same colum-array

php,mysql,arrays,sorting,insert
The situation: A mysql-table has three columns Name, Areas and Type Name contains one customer Areas contains an array of locations (area1,area2,area3...) Type is empty for now If helpfull or needed: All names(count: can vary) and areas(count: 50) are known, but the composition is unknown and can vary for each...

Insert Statement into same table causes inconsistent bottlenecking

insert,sql-server-2008-r2
I'm currently having an issue with a particular SQL Server table used within a database, I cannot run an insert statement on this table when the records I'm selecting are coming from itself. Here's the statement: insert into [Custom Work] ([Description], [Price], [Cost], [Labour Cost], [Made In Material], [Bought Out...

Codeigniter dynamic insert

database,codeigniter,dynamic,insert
I am new to CodeIgniter. I've already created the required program, but I want to make it smaller and more effective. I have a database with 10+ tables, where I just insert/update into almost the same rows (+/- 2 rows). I would like to make a controller which inserts all...

C++ List Insert

c++,list,insert
I'm trying to insert objects into a list in an ordered manner, based on the objects data member family_id The first object created skips this function, so there will be at least one object in the list named 'families' before this function is executed. Running into some trouble with the...

Inserting arguments into string

php,string,insert,printf
In PHP, inserting variables into a string can be done by using sprintf. If I have two string variables $a and $b, they can be inserted into another string like this: $string = sprintf("String containing %s two other strings %s", $a, $b); Is there a function such that the string...

Recursively insert at the end of doubly linked list

java,recursion,insert,linked-list,doubly-linked-list
I have a doubly linked list, and I want to insert an element at the end of the list recursively. I have a method now that does this without recursion, and it works. I just can't seem to understand how to do it with recursion. Inserting at the end of...

Insert element into nested array in Mongodb

c#,mongodb,insert,driver
I have this : { "_id" : ObjectId("4fb4fd04b748611ca8da0d48"), "Name" : "Categories", "categories" : [{ "_id" : ObjectId("4fb4fd04b748611ca8da0d46"), "name" : "SubCategory", "sub-categories" : [{ "_id" : ObjectId("4fb4fd04b748611ca8da0d47"), "name" : "SubSubCategory", "standards" : [] }] }] } I would like to add a new SubCategory using the C# driver. Is there an...

Stack Overflow in binary tree insertion

insert,stack-overflow,binary-search-tree
PROCEDURE CreateNode (info: CHAR): BST; VAR bst : BST; BEGIN NEW(bst); bst^.elem := info; bst^.left := NIL; bst^.right := NIL; RETURN bst; END CreateNode; PROCEDURE Insert (info: CHAR; VAR t: BST); BEGIN IF t = NIL THEN t := CreateNode(info); ELSIF Compare(info, t^.elem) = greater THEN Insert(info, t^.right); ELSIF Compare(info,...

jquery form inserting with php

php,jquery-mobile,mysqli,insert
please help find the sourse of my codes issue...when I click request the page just refreshes with all the data gone but nothing is inserted into the db... here is the image of the db and the code! what do I need to change to be able to insert the...

Insert query takes more time to execute as compared to select query

sql,oracle,select,insert,remote-access
I have strange question for which i did not found the solution. I have the below query which takesmore than 5 minutes to execute. The query performance is very slow even i have few records which will get inserted. If i remove the insert statement and runs only select query...

Python insert into list faster than O(N)?

python,list,insert
Is this possible to do? I have a sorted list L and I have a binary search for determining where in the list to insert an element such that the resulting list will still be in order. However L.insert(index,object) needs O(N) time complexity. Is there another data structure for L...

How to insert key and value to map that is inside another map in cpp?

c++,insert,mapping,iteration
I have this map : std::map<std::string, std::map<std::string, std::string> > objects; As far as I know, when I write objects[key] it will replace the value of the key already exists, but here I want it to add to the second map if the pair doesn't exist. Example: Current MAP :("key1",map(<"key_a","value_a">,<"key_c","value_d">)) input:...

MySQLI Update set +1 the correct form and symbols

php,mysql,database,mysqli,insert
EDIT; there is no error and all other things work but updating I just get no +1 :( nothing gets updated- Maybe because I am using wrong quotes? I am looking on internet some people uses the following kind of query UPDATE `attempts` SET `fails` = fails+1 WHERE id='3'" I...

Event is happening at Create time and not START time

mysql,events,insert,truncate
My Create EVENT headline is below. The creation executes properly, but the insert happens at the Create execution and not the STARTS time. Then, the TRUNCATEs happen at START time. I want the TRUNCATE to happen at START time first, and then the INSERT. I've done all the rearranging I...

php - Insert an array inside a multidimensionnal array

php,arrays,multidimensional-array,insert
I have a multidimensional array where I want to insert an other array inside it with a var array. My aim is to insert some element array with if statement. In fact I want to build a kind of conditionnal array. Here an example $inserted_array[] = array( 'name' => 'name',...

Update table if two columns exist in table and insert if one of the two columns are different

mysql,table,insert
I have a table computer, which has the following columns: computer(computer_id(pk), office_id, computer_name, login, date, time) I am trying to create a mysql statement that will update a row if the office_id and the computer_name already exist and will insert a new row if it does not exist. I want...

how to know the date of insertion of record in SQL

mysql,sql,date,insert,phpmyadmin
I am using phpMyAdmin for my project and I have a table without date/datetime field. I am wondering if there's a way to know when I inserted each record on the database...

Priority Queue using a Max-Heap Data Structure

python,insert,heap,priority-queue,max-heap
I am implementing a priority queue using a max-heap data structure in Python. I'm using several names that have numbers associated with them as their priority (9 being the highest and 1 being the lowest). The issue I am facing is that when I dequeue an item from the priority...

mongoldb insert does the property order matters?

mongodb,insert,geojson,2dsphere
I have a collection with the following indices. [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "bs.locations" }, { "v" : 1, "key" : { "location" : "2dsphere" }, "name" : "location_2dsphere", "ns" : "bs.locations", "2dsphereIndexVersion" : 2 } ] I...

Wordpress: insert post-format in post using wp_insert_post()

wordpress,insert
as I can insert my php post using the format of a post ( example : post -format- quote ) using wp_insert_post (). $my_post = array( 'post_type' => 'post', // "post" para una entrada, "page" para p√°ginas, "libro" para el custom post type libro... 'post_status' => 'publish', // "draft" para...

How to add element in Python to the end of list using list.insert?

python,list,insert
There is a list, for example, a=[1,2,3,4] I can use a.append(some_value) to add element at the end of list, and a.insert(exact_position, some_value) to insert element on any other position in list but not at the end as a.insert(-1, 5) will return [1,2,3,5,4]. So how to add an element to the...

CakePHP Unable to insert to database (datetime format)

database,datetime,cakephp,insert
I was new to Cakephp and I actually following the tutorial of the Blog tutorial however I didn't follow their database and try my own. Currently my database: My Model: class FypCakephp extends AppModel { //Table Name public $useTable = 'Report'; public $primaryKey = 'report_id';} My Controller: public function add()...

What is more efficent: several insert vs single insert with union

performance,postgresql,insert
I have a large table (~6M rows, 41 cols) in Postgresql as follows: id | answer1 | answer2 | answer3 | ... | answer40 1 | xxx | yyy | null | ... | null 2 | xxx | null | null | ... | null 3 | xxx |...

PHP MySQL delete row not working

php,mysql,forms,insert
I really can't seem to figure out why this code is breaking at the relevant sections for the delete button code. Can anyone take a swing at what I'm doing wrong here? I'm hoping it's just syntax but if it's fundamental understanding I'd appreciate some input, because I also need...

Adding modify and delete to insert trigger

sql-server,triggers,insert,delete,dml
Good morning everyone, I've been tasked with pushing records from one table (T1) to another (T2). I have the insert portion complete as follows: CREATE TRIGGER [dbo].[CP_to_TW2] ON [dbo].[TEST_PROJ] FOR INSERT AS BEGIN INSERT INTO dbo.TEST_TW (PROJECT_ID,PROJECT_DESC,PROJECT_MANAGER) SELECT PROJ_ID,PROJ_ID+PROJ_NAME,PROJECT_MANAGER FROM inserted END TEST_PROJ is T1 and TEST_TW is T2. The...

Why does insertBefore delete the reference node here?

javascript,xml,insert
Edit: Found the problem somewhere else, sorry, false alarm!

insert a group of rows to a table in PostgreSQL

postgresql,insert,group,rows
i have a table with a lot of rows and i want to create a new table and copy just a bunch of rows (like 30) in my new table.... - the table name is account (code,code_activation,email,password) and i'm using PostgreSQL. and thanks in advance.

C# Sorted list without LINQ and SORT

c#,string,list,insert,sorted
My question is that is it possible to create a list that sorts the objects in it upon these object being placed in them? After not getting anywhere, I made a new linked list. The only task is to make this list ordered by the string field of the objects...

Insert 1 bit in number c#

c#,insert,numbers,bits
I have problem with inserting a bit in number. I have a position where to insert this 1 bit. For example if i have a number 186 (represent in bits: 1011 1010) and I have a position 4. It will looks 1 0111 1010. And my second problem is almost...

Form data not inserting in Wordpress database even though hard coded data gets inserted

database,wordpress,forms,insert
I'm trying to build a form in Wordpress and inserting data from the form into the database. When I use hard coded data it works fine but if I change that to use variables from the form it is not inserting data at all. Any help would be much appreciated....

How can I map keys in Insert mode that contains Carriage Return in it?

vim,text,insert,editor,vi
How can I map ctrl + enter to go to new line from anywhere in the current line in vim ? I just want to do it for insert mode. I tried :set <C-<CR>> <Esc>o but that doesn't seem to work....

What is wrong with this INSERT MAX+1 query?

mysql,insert,syntax-error
I'm having problem with this query: INSERT INTO invoices(invuid, linenumber) VALUES (?, SELECT(SELECT max(linenumber)+1 FROM invoices WHERE invuid=?)) It keeps saying: "General error: 1093 You can't specify target table 'invoices' for update"...

Fewer Columns In INSERT Statement Than In Values Clause

sql-server,insert,transactions,identity
I have a table in SQL Server with 34 columns. The identity column is an auto-incremented primary key and thus, not included in the INSERT statement. Therefore, I have 33 parameters in my INSERT statement. After checking, double-checking, and cross-checking my INSERT statement and the table, I keep getting the...

PHP Check if Username Exists

php,mysql,sql,select,insert
Ok so when i login on the page i get this error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a1982502/public_html/test3/register.php on line 55 This is the PHP <?php if(isset($_POST['submit'])) { $servername = "mysql10.000webhost.com"; $username = "a1982502_test"; $password = ""; $dbname = "a1982502_test"; $password1 = $_POST['password1'];...

Prevent Duplicate Insert

php,mysql,mysqli,insert
I have a page which is doing an insert. The DB table has a unique column called "order" that auto increments upon adding a new row. I am executing the insert in this way: $insert = <<<SQL INSERT INTO `order` (name, email, team, project, startdate, enddate, comment, server) VALUES (?,?,?,?,?,?,?,?);...

Linux: How to insert a line at a specific line number in a file?

linux,insert
I'd like to add a specific line to a file in a specific line number (second) without over-writing the data which is already there. I've tried this: sed -i '2i - jstat' FILE But this just over-writes the second line with "- jstat". Instead, I want to add a new...

Vim: copy a word any number of words away

vim,insert,copy,editor,keyboard-shortcuts
Just supposing the cursor is at the underscore '_': line one function Abracadabrabrabra() = { line two stuff _ line three more longWordIdoNotWantToType } And I want to insert Abracadabrabrabra, or maybe longWordIdoNotWantToType, or both, is there some way I can do it like this: execute a magic key command,...

Mysql insert text statement with quotation marks in the content

php,mysql,insert
$title = Hello my name is "Title"; $DB->Execute('INSERT INTO page (title) VALUES (?)', array($title)); I'm inserting more than one field, but I've removed them just to simplify the example. I'm running this SQL in my PHP file but I end up with the title being saved as: Hello my name...

Insert row into table with only one column, primary key and identity

sql-server,tsql,insert
Here is a table definition: CREATE TABLE dbo.TableOnlyPK ( Id tinyint PRIMARY KEY IDENTITY (1, 1) ) Now I need to insert row into that table through T-SQL statements: I've tried few solutions, but no one worked. INSERT INTO dbo.TableOnlyPK () VALUES () -- not worked ...

error in checkout page using PHP

php,insert
I creating a site for online shopping cart using PHP. I did everything but my question is when i checkout the items, only one item will stored in database. But i need to store all selected items records This is my checkout.php code <?php //Pay success insert into databace if(isset($_POST['pay_success']))...

Write value of checkboxes into database table in mysql/php [closed]

php,mysql,checkbox,insert,value
I'm currently working on a subscription form where you can select 3 different message boards. My database table looks like this: subID - INT dest - varchar sub1 - tinyint sub2 - tinyint sub3 -tinyint When you check a checkbox it should write a 1 in the database and when...

summing from two tables then preforming an operation with the 2 sums

sql-server,insert,sum,sql-update
I am using sql server and I have a table called accnt with the fields ven1 and amnt1 and a table called acc1167 with fields ven, job#, and amnt. for this example these tables look like this accnt acc1167 ven1 amnt1 ven job# amnt 1167 100 1167 1 200 1152...

How to optimize the times of execute when to insert data with pdo?

php,arrays,sqlite,pdo,insert
There is a huge two dimensional array which contain 500k sub one dimension arrays, every sub array contain 5 elements. Now it is my job to insert all the data into a sqlite database. function insert_data($array){ Global $db; $dbh=new PDO("sqlite:{$db}"); $sql = "INSERT INTO quote (f1,f2,f3,f4,f5) VALUES (?,?,?,?,?)"; $query =...

How to insert data into sql server database when the primary key column already set default identity(1, 1)

c#,table,insert
I'm trying to insert two data columns into my SQL Server database but I get an error at the code line -> cmd.ExecuteNonQuery(); Cannot insert the value NULL into column OrderID, table RestaurantApp.dbo.Junc_Order; column does not allow nulls. INSERT fails. The OrderID column is actually the primary key in my...

Java MySQL bulk insert vs normal

java,mysql,insert,bulk
I tried to make the insert to mysql faster, so I werote a code with bulk insert. The problem is that when I run the following code, results are the same (Time elapsed: 2min, or 173sec) for both methods. Any comment on the matter is welcome. MySQLConn mysqlconn = new...

If numeric then Insert numeric else Insert non-numeric

tsql,insert,sql-server-2014
I have table source SRC such as: *Column1* First Second 45 Fouth Now I want to insert these data into table DEST (ID, NAME) with this logic: If row is numeric, insert into (ID, NAME) VAUES (45, 'TBD'). If the row is not numeric, generate ID and insert into (ID,...

Use PHP in Array and Title For Wordpress Term Creation

php,wordpress,insert,user,category
So I'm trying to create two categories when the user logs in. I need the category names to be the username of the user who is logging in. I'm fairly new to PHP and I've been looking through the Codex and I know how to get the user information but...

Insert character inside a string of random letters but maintain possibility to become word, is it possible without immense data-structure?

java,string,search,insert,character
I have a dictionary (approx 200k words) which is in alphabetical order. I only need to know if a string of letters can still become a word after a character has been inserted anywhere in the string. In other words: I need to know which characters inserted at a specific...

How to insert string before last line?

php,insert,line
I saw using fseek to insert string before last line this question, but this isn't solving my problem. I not use "?>" tag. Php version PHP 5.4 example line1 example line2 //i need insert here lastline $eg}; My code is working but this is adding empty lines after all lines...

Update or Insert on a Table based on a column value

insert,plsql,cursors
I have two tables BASE and DAILY as shown below: BASE Cust ID IP address 1 10.5.5.5 2 10.5.5.50 3 10.5.5.6 DAILY Cust ID IP address 1 10.5.5.5 2 10.5.5.70 4 10.5.5.67 The table DAILY is periodically refreshed every 24 hours. Now for every Cust Id in BASE I have...

insert data to database mysql from netbeans

java,mysql,swing,netbeans,insert
I have stack in my register form. I don't get it where the error this is my connection: package login; import java.sql.*; import java.text.SimpleDateFormat; import javax.swing.*; public class register extends javax.swing.JFrame { public PreparedStatement pst; public Connection cn; public Statement st; public register() { initComponents(); try { Class.forName("com.mysql.jdbc.Driver"); cn=DriverManager.getConnection("jdbc:mysql://localhost:3306/tugas?zeroDateTimeBehavior=convertToNull","root",""); st=cn.createStatement();...

Can I put this INSERT and DELETE query into a single INSERT query

sql,postgresql,insert,duplicate-removal
How can I put this into one query, the key point is that when grouping artist by name I need to consider all rows in artist, but I don't want to keep rows in artist_nodup table if it already is in mbartist_discogsartist table. (I'm using Postgres 9.3) INSERT INTO artist_nodup...

Meteor / MongoDB: insert integer instead of string on form submit

forms,mongodb,meteor,insert,submit
I'm working through David's tutorial on Meteor at http://meteortips.com/. How do I insert an integer instead of string on form submit? I think the following line needs to clarify that it's an integer, but I'm not sure how. var playerScoreVar = event.target.playerScore.value; Here's my whole code. Template.addPlayerForm.events({ 'submit form': function(event){...

Add multiple rows from a query php mysql

php,mysql,insert
I am trying to add the results of a query to a new empty table, the table already exists.. Here is my code so far, no errors come up but it's not inserting either, Any help would be good.. <?php require_once('../Connections/OASDB.php'); mysql_select_db($database_OASDB, $OASDB); $sql = "SELECT SnPf, InvoiceNo, CustomerName FROM...

mySQL moving rows from 2 tables to other tables

mysql,sql,insert,inner-join
hello i can't seem to figure out why this sql statement doesn't work? i am trying to move rows from table1 and table2 into table3 and table4. i thought the easiest approach to this was by selecting the rows with inner join and then making 2 INSERT INTO. BEGIN; INSERT...

Add rows, duplicate workbook, import data and format

vba,excel-vba,insert,code-formatting,inventory-management
I am trying to create an Excel document for inventory management. I have already created a workbook where "daily sales" and "deliveries" are added and the sheet maintains an updated inventory, calculates income and net profit. This is all done in traditional Excel; However, this sheet has some problems, namely...

Error INSERT INTO in PHP [duplicate]

php,insert
This question already has an answer here: PHP Parse/Syntax Errors; and How to solve them? 10 answers When I try to insert a new row it gives me this error: Parse error: syntax error, unexpected ';' When I execute the query, what I am doing wrong? // Selecting Database...

Is There an Alternative to insert and then sort

c++,sorting,insert,merge,stl-algorithm
If I have vector<int> foo and vector<int> bar both of which are sorted, and I want to merge them into foo such that the final result is sorted, does the standard provide me a method for doing this? Obviously I can do: foo.insert(foo.end(), bar.begin(), bar.end()); sort(foo.begin(), foo.end()); But I was...