Search found 212 matches

by chris
Wed Feb 09, 2011 8:19 pm
Forum: PHP
Topic: solved: split() is deprecated
Replies: 2
Views: 68844

Re: split() is deprecated

Yes, you should use explode().

It has the same syntax so it 's just renaming.

Code: Select all

array explode ( string $delimiter , string $string [, int $limit ] )

Code: Select all

array split ( string $pattern , string $string [, int $limit ] )
by chris
Mon Dec 27, 2010 6:42 pm
Forum: SQL
Topic: How do I load a csv file in MYSQL
Replies: 4
Views: 46929

Re: How do I load a csv file in MYSQL

The following line is a more complete command:

Code: Select all

LOAD DATA INFILE '/tmp/postcodes.csv' INTO TABLE i_city COLUMNS TERMINATED BY ';' ENCLOSED BY '"';
by chris
Sun Oct 03, 2010 12:42 am
Forum: General
Topic: Save webpage with firefox command line
Replies: 1
Views: 62320

Re: Save webpage with firefox command line

You can use something like Pearl Crescent Page Saver.

It is Firefox screen capture extension,
and when installed it can capture the page and save it as a image (PNG)

Full explanation can be found here:
http://www.zubrag.com/forum/index.php?topic=82.0
by chris
Wed Sep 22, 2010 12:10 pm
Forum: SQL
Topic: How do I load a csv file in MYSQL
Replies: 4
Views: 46929

Re: How do I load a csv file in MYSQL

MYSQL needs not only read access on the file, but also execution rights on directory.
It reads using the rights of the mysqld process (user: mysql)

You probably don't want your home-dir accessible by everyone.

So a quick solution it to copy the file to the /tmp -dir and load it from there.

LOAD ...
by chris
Thu Sep 16, 2010 10:40 pm
Forum: SQL
Topic: How do I load a csv file in MYSQL
Replies: 4
Views: 46929

Re: How do I load a csv file in MYSQL

You can login in mysql:

Code: Select all

mysql -u You -p database
and the you can use the LOAD DATA INFILE command

Code: Select all

LOAD DATA INFILE 'data.csv' INTO TABLE table
You can get the complete explanation here:
http://dev.mysql.com/doc/refman/5.0/en/load-data.html
by chris
Fri Sep 03, 2010 10:09 am
Forum: General
Topic: Solved: Remove the ^M Character
Replies: 2
Views: 68172

Re: Remove the ^M Character

When you move files from windows to (l)unix, you always have problems with white characters.
Thats because windows and linux handle with spaces differently.

Sed can be found on most linux/unix distributions.
sed s/\r// hello.txt > goodhello.txt

you can also do the same with perl:
perl -pie 's ...
by chris
Tue Aug 31, 2010 2:07 pm
Forum: General
Topic: How do i get columns out of text in shell
Replies: 1
Views: 58150

Re: How do i get columns out of text in shell

Hi,

you can do this with awk

For example:

Code: Select all

awk '{ print $2 }' list.txt
This gets the second column from the file list.txt
Standard the separation is space (" ")
With -F you can change this

Code: Select all

awk -F ";" '{ print $2 }' list.txt
You can also use gawk as an alternative.
by chris
Wed Aug 04, 2010 10:46 pm
Forum: PHP
Topic: update php on CentOS
Replies: 2
Views: 69173

Re: update php on CentOS

You can find a complete explanation here:
http://blog.famillecollet.com/pages/Config-en

In short:
You have to install EPEL:
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
rpm -Uvh epel-release-5*.rpm

Then set the Remi repository:
cd /etc/yum.repos.d
wget ...
by chris
Mon Jul 19, 2010 9:24 pm
Forum: PHP
Topic: PHP yesterday date
Replies: 1
Views: 56832

Re: PHP yesterday date

Hi,

mktime() works fine for me:

Code: Select all

$yesterday=date('Y-m-d', mktime(0, 0, 0, date("m") , date("d") - 1, date("Y")));
But you can also use the following code:

Code: Select all

$yesterday=date("Y-m-d", time()-86400);
The result should be the same.
by chris
Sun Jul 18, 2010 8:33 pm
Forum: PHP
Topic: SOLVED: How to send a HTML mail
Replies: 1
Views: 59750

Re: How to send a HTML mail

With PHP it is easily done.

You create the body of your message in html.
Don't forget <html><body></body></html>

and in the headers you tell it is a HTML-mail with the following line:
Content-type: text/html\r\n

So the complete code looks something like this:
$email='someone@somewhere.com ...