May 31st, 2011
// Enter multiple query string
$query_str = "
-- Update table
UPDATE t SET id = id + 1;
-- Insert into table
INSERT INTO example (name, age) VALUES('John Doe', '23' );
";
// Explode string into separate queries
$query = explode(';',$query_str);
// Loop through exploded queries and execute
foreach($query as $index => $sql) {
$result = mysql_query($sql,$conn2) or userDisplayMessage(mysql_error().' '.__FILE__.':'.__LINE__);
}
Or, you can use mysqli (MySQL Improved extension), which has a mysqli_multi_query function.
Posted in Programming, Web | Comments Off
May 16th, 2011
https://encrypted.google.com/
If you want to search Google securely, over an encrypted connection, use the above link.
This prevents your search from being seen by anyone but you and Google, that includes your ISP.
Resources:
Posted in Networking, Web | Comments Off
March 26th, 2011
Open Terminal (/Applications/Utilities/Terminal)
zip -d file.zip \*.DS_Store
That will remove all .DS_Store files from the zip archive.
Posted in OSX | Comments Off
January 20th, 2011
This works for generating CSR files required by GoDaddy SSL certificates. This will work with more than just GoDaddy SSL certificates, you can even sign your own certificates.
$ openssl genrsa -des3 -out domain.key 2048
You will now have to enter a passphrase
$ openssl req -new -key domain.key -out domain.csr
You will now have to re-enter your passphrase to confirm, and then you will be prompted to enter all your information.
Enter the domain name you are registering this certificate for when it prompts you:
Common Name (eg, YOUR name) []
You will now have the CSR file you need to send to the signing authority to issue you your certificate.
Here is the code to generate the CRT file ( if you’re not using GoDaddy and you want to sign your own )
openssl x509 -req -days 365 -in domain.csr -signkey domain.key -out domain.crt
Posted in Networking, Web | Comments Off
December 8th, 2010
INSERT INTO `table` (`col1`, `col2`, `col3`, `col4`) SELECT `col1`, `col2`, `col3`, `col4` FROM `table` WHERE `id`=1;
`id` can be anything unique.
Posted in Networking | Comments Off