All Entries Tagged With: "insert"
Retrieving a database insert Index ID using DBI
#!/usr/bin/perl
use DBI;
use strict;
my $username = "dbuser";
my $password = "dbpassword";
my $dsn = "dbi:mysql:goo:192.168.1.10";
my $dbh = DBI->connect($dsn,$username,$password)
or die "Cannot connect to database: $DBI::errstr";
my $sth = $dbh->prepare("INSERT INTO urls VALUES
(”,’http://www.w3mentor.com/’,'tutorials’,unix_timestamp(),’query words’)");
$sth->execute() or die "Cannot execute sth: $DBI::errstr";
my $insertid = $dbh->{’mysql_insertid’};
print "$insertid\n";
$dbh->disconnect();
Inserting into a database using DBI
#!/usr/bin/perl
use DBI;
use strict;
my $username = "dbuser";
my $password = "dbpassword";
my $dsn = "dbi:mysql:goo:192.168.1.10";
my $dbh = DBI->connect($dsn,$username,$password)
or die "Cannot connect to database: $DBI::errstr";
my $sth = $dbh->prepare("INSERT INTO urls VALUES
(”,’http://www.w3mentor.com/’,'tutorials’,unix_timestamp(),’query words’)");
$sth->execute() or die "Cannot execute sth: $DBI::errstr";
$dbh->disconnect();
Adding Objects to Arraylist Collection in C#
The c-sharp ArrayList class can hold unordered objects of any type. There are two methods that the ArrayList class supports for adding items into the collection named Add and AddRange. The Add method allows the addition of a single object of any type to the collection.
Example code:
ArrayList alcollect = new ArrayList();
// Add individual items to [...]
Upload and store files in Mysql using PHP : Part 2 – PHP file processing
To store uploaded files to MySQL database, you can use the normal INSERT statement as shown in the php example listed below:
<?php
$con = mysql_connect("localhost", "", "");
mysql_select_db("w3m");
$error = $_FILES[’w3img’][’error’];
$tmp_name = $_FILES[’w3img’][’tmp_name’];
$size = $_FILES[’w3img’][’size’];
$name = $_FILES[’w3img’][’name’];
$type = $_FILES[’w3img’][’type’];
print("\n");
if ($error [...]