Insert hyphens in JavaScript

Quickest way would be with some regex: Where n is the number n.replace(/(\d{3})(\d{3})(\d{4})/, “$1-$2-$3”); Example: http://jsfiddle.net/jasongennaro/yXD7g/ var n = “1234567899”; console.log(n.replace(/(\d{3})(\d{3})(\d{4})/, “$1-$2-$3”));

PHP mySQL – Insert new record into table with auto-increment on primary key

Use the DEFAULT keyword: $query = “INSERT INTO myTable VALUES (DEFAULT,’Fname’, ‘Lname’, ‘Website’)”; Also, you can specify the columns, (which is better practice): $query = “INSERT INTO myTable (fname, lname, website) VALUES (‘fname’, ‘lname’, ‘website’)”; Reference: http://dev.mysql.com/doc/refman/5.6/en/data-type-defaults.html

What is an efficient way of inserting thousands of records into an SQLite table using Django?

You want to check out django.db.transaction.commit_manually. http://docs.djangoproject.com/en/dev/topics/db/transactions/#django-db-transaction-commit-manually So it would be something like: from django.db import transaction @transaction.commit_manually def viewfunc(request): … for item in items: entry = Entry(a1=item.a1, a2=item.a2) entry.save() transaction.commit() Which will only commit once, instead at each save(). In django 1.3 context managers were introduced. So now you can use transaction.commit_on_success() in a … Read more