Re: e-mail to mysql database?
| From: | Jome | Date: | Mon, 12 Aug 2002 15:11:06 +0000 |
| Subject: | Re: e-mail to mysql database? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-112145@lists.php.net to get a copy of this message | ||
> In Short: What I need is a php script that reads an email file and split
its
> data to a mysql file.
> A bit longer if you are still interested....
>
> For the following project:
> http://www.crossing-africa.com, a journey I am going to make on
> a bike.
> What are the plans:
>
> I am taking a satilite phone and SMS my possition with GPS coordinates
like:
> N50.34.234 E006.45.34 on 23-feb-2003
> I already have a script that translates that sms to an e-mail that looks
the
> same.
> Then what:
> This e-mail needs to be split up like this:
> N50.34.234
> E006.45.34
> 23-feb-2003
> and then be insterted into a mysql database.
> The result then is that my exact location is know everyday and will be
> plotted on the web.
>
> The website runs on a cobalt server
>
> As my php knowledge is very limited and I searched the web for a script to
> do so I havent found it, could any of you help, as it must be out there!
> Thanks for any helpfull contribution.
Hi Frank,
if you got the above in a string, your best shoot is to use explode, for
example like below:
<?
$string = "N50.34.234 E006.45.34 on 23-feb-2003";
$data = explode(" ",$string);
mysql_query("INSERT INTO table (n,e,this_date)
VALUES('".$data[0]."','".$data[1]."','".$data[3]."')");
?>
Read more on php.net/explode, there's also plenty of other string functions
there that may help.
Regards,
Jome