Re: [PHP-DB] French and Spanish Accent Letters

2010-11-10 Thread Andrés G . Montañez
Hi Ron, you should use

CHARSET=utf8 COLLATE=utf8_unicode_ci

in your table for a wide option of languages.

Example:

CREATE TABLE  `t_my_table` (
  `row_id` int(10) unsigned NOT NULL,
  `row_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

Cheers.

-- 
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] big table / hadoop / map reduce

2010-10-30 Thread Andrés G . Montañez
Hi Artur,
in your IPs examples, lets supouse you have ten access log files (from
ten different servers),
there you already have the mapping part done.

Then you reduce each log into anonther new file, indicating the IP
address and the times it's repeated.
At this stage you have a reduced version of each log file; then you
need to map them into a new unique file,
this file will be the merge of all the reduced versions of the log files.
This this unique file, you will need to reduce it again, and there you
will have an unique file with all the
IPs address and the times they appear.

There is no limit on the times you can call map and reduce.

Cheers.

On 30 October 2010 15:51, Artur Ejsmont ejsmont.ar...@gmail.com wrote:
 sure that was a bit more helpful, thanks :)

 i was still wondering to what other use cases would that apply. This
 is a good article (best so far i guess):
 http://code.google.com/edu/parallel/mapreduce-tutorial.html

 The thing is that reduce has to aggregate data or it would be
 impractical. So i am trying to see more examples to fully understand
 the limitations of the method.

 Lets say i want to find top 10 IP addresses in an access log:
 - split log into small files
 - i take one fragment (one file)
 - worker maps to a list of ip, 1
 - before reduce is called data is sorted by ip
 - reduce makes ip, totalCountPerLogFileSample

 so i have a bunch of files with aggregated lists of IP,
 totalCountPerFile. But then would it not have to be merged across all
 results again? with another sort/reduce call? or to avoid that do i
 need initial data to be already clustered so one ip appears only in
 one chunk file?

 Does it make sense?

 As i said i am still trying to figure out how should it be applied and
 when ... also how to transform problems to make it still work : )

 I want to write some simple map reduce like the one above just to see
 it working and play around a bit :)

 cheers

 Art

 On 22 October 2010 16:49, Andrés G. Montañez andresmonta...@gmail.com wrote:
 Imagine you have to get track of some kind of traffic, for example,
 ad impressions;
 lets supose that you have millions of those hits; you will have to
 have a few servers to
 receive the notifications of the impression of an ad.

 After the end of the day, you will have that info across a bunch of
 servers; mostly you will have
 a record of each impression indicating the Identifier (id) of the Ad.

 To this info to become useful, you will have to agregate it; for
 example to know which is the Ad with most impressions.
 You will have to iterate over all servers and MAP the info into one
 place; now that you have all the info,
 you will have to REDUCE it; so you will have one record per Ad
 identifier indicating the TOTAL impressions of that day.

 That's the basic idea. It's like aftermath of Divide and Conquer.

 Hope this will be useful.

 Cheers.

 On 22 October 2010 13:27, Artur Ejsmont ejsmont.ar...@gmail.com wrote:
 hehe  sorry but this does not help :-) i can google for wikipedia
 definitions.

 I was hoping for some really good articles/examples that would put it
 into enough context. I would like to have good idea when it could be
 useful.

 So far had no luck with that. Its like with design patterns ... people
 who dont understand them should not write articles trying to explain
 them to others :P

 Art

 On 22 October 2010 15:29, Andrés G. Montañez andresmonta...@gmail.com 
 wrote:
 Hi Artur,

 Here is an article on wikipedia: http://en.wikipedia.org/wiki/MapReduce

 And here are the native implementations in php:
 http://www.php.net/manual/en/function.array-map.php
 http://www.php.net/manual/en/function.array-reduce.php

 The basic idea is to gather a lot of data, from several nodes, and
 map them togheter;
 then, assuming a lot of this data is repeated across the dataset, we
 reduce them.


 Cheers.

 On 22 October 2010 12:14, Artur Ejsmont ejsmont.ar...@gmail.com wrote:
 Hi there guys and girls

 Have anyone came across any reasonable explanation / articles on how
 hadoop and map reduce work in practice?

 i have read a few articles now and then and i must say i am puzzled
  am i stupid or they just cant find an easy way to explain it? :P

 What i would hope for is explanation on simple example of application
 with some code samples preferably.

 anyone good at it here?

 cheers

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





 --
 Andrés G. Montañez
 Zend Certified Engineer
 Montevideo - Uruguay




 --
 Visit me at:
 http://artur.ejsmont.org/blog/




 --
 Andrés G. Montañez
 Zend Certified Engineer
 Montevideo - Uruguay




 --
 Visit me at:
 http://artur.ejsmont.org/blog/




-- 
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Variable Assignment

2010-10-28 Thread Andrés G . Montañez
mysql SET @st=100;
mysql SELECT @st;
+--+
| @st  |
+--+
|  100 |
+--+

Cheers.

On 28 October 2010 19:10, Ethan Rosenberg eth...@earthlink.net wrote:
 Dear List -

 I cannot figure this one out:

 mysql $st=1000;
 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual
 that corresponds to your MySQL server version for the right syntax to use
 near '$st=1000' at line 1

 Ethan

 MySQL 5.1  PHP 5  Linux [Debian (sid)]


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Incrementing Primary Key

2010-10-27 Thread Andrés G . Montañez
Hi Ethan,
in this case, you should manage the keys by your application, and
store the used ids in aonther table,
similar to a sequence in Oracle or Postgresql.
Thats so if you want all the records un one table (a field for the
letter, and the other for the numeric part).

Otherwise, having a table for each site will be enough, as Jimmy suggests.

-- 
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Incrementing Primary Key

2010-10-27 Thread Andrés G . Montañez
Yes indeed, as Jimmy says, having a database for each site is
impractical and a waste of resources.


On 27 October 2010 11:23, Jimmy Sole jimmys...@gmail.com wrote:
 In my opinion, having a database for each site would require a lot of 
 unnecessary work, as you would have to connect to every database in order to 
 handle the sites.
 Having one database with tables for all the sites would be more productive as 
 you would not have to change the connection info for PHP every time you want 
 to use a different database.
 I use the PDO mysql adapter, what do you use?

 -Original Message-
 From: Andrés G. Montañez [mailto:andresmonta...@gmail.com]
 Sent: Wednesday, October 27, 2010 9:19 AM
 To: Ethan Rosenberg
 Cc: php-db-lists.php.net
 Subject: Re: [PHP-DB] Incrementing Primary Key

 Hi Ethan,
 in this case, you should manage the keys by your application, and store the 
 used ids in aonther table, similar to a sequence in Oracle or Postgresql.
 Thats so if you want all the records un one table (a field for the letter, 
 and the other for the numeric part).

 Otherwise, having a table for each site will be enough, as Jimmy suggests.

 --
 Andrés G. Montañez
 Zend Certified Engineer
 Montevideo - Uruguay

 --
 PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: 
 http://www.php.net/unsub.php






-- 
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Parsing Tab Delimited file

2010-10-24 Thread Andrés G . Montañez
Hi Ethan,

fist you need to read the file, you could use the file() function
which reads the file as an array, being each line an element;
the you have to navigate the array and exploding the lines into an array:

$data = file('myfile.txt');

foreach ($data AS $row) {
  $row = explode(\n, trim($row));
  var_dump($row);
}

And there you go.

Cheers.

On 24 October 2010 16:46, Ethan Rosenberg eth...@earthlink.net wrote:
 Dear list -

 Thanks for all your help.

 I have a tab delimited file which I wish to import into a data base.  In
 MySQL I can use the LOAD DATA command.  As far as I know, that command
 cannot be used in PHP as a mysqli_query.  As I understand, I have to parse
 the file and use the INSERT command.

 How do I do it?  Code samples, please.

 Thanks.

 Ethan



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] How to Sync MySQL with iPhone or Google Contacts

2010-10-23 Thread Andrés G . Montañez
Hi Ron, what's what you want to sync? Contacts? Or everything else?
You want to sync it over the internet? Or over wire?
You should research the iPhone API/SDK for sync;
and not focus with MySQL, wich is just an storage.

Cheers.

On 23 October 2010 03:09, Karl DeSaulniers k...@designdrumm.com wrote:
 I believe there is a MySQL for the iphone
 iMy?

 http://forums.mysql.com/read.php?58,249718,249718

 You'd probably want o use JASON or an equiv. to talk back and forth with
 your database and app.
 At least thats the consensus I'm finding on posts about it.

 HTH
 Karl

 On Oct 22, 2010, at 11:21 PM, listread wrote:

 Hey all!

 Does anyone know how to go about syncing a MySQL db with an iPhone over
 the internet?

 An alternative would be syncing with Google Contacts, which then could
 sync with the iPhone.  I think Google Contacts uses Exchange Server to sync
 with devices.

 Thanks!

 - Ron



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] How to Sync MySQL with iPhone or Google Contacts

2010-10-23 Thread Andrés G . Montañez
Hi Ron,
watchout with the jailbrake becaous it will void your warranty over
the iphone. If you want to sync the phone's contact with something,
you really should check the iphone API and build an iphone application
which hooks and listens for contact's change and then notify the
changes to your server.
I know building an iphone app is a pain, but I think its the right way
to do it, if not the only.
Is this need for a hobbie or you need to implement this for a public
application?

Cheers.

On 23 October 2010 13:57, listread listr...@cze.com wrote:
 Karl / Andrés

 Thanks for your replies.

 iMy appears to be only a client and I can already access servers with php on
 the iPhone web browser.

 I would like MySQL on my iPhone.  There was a way to make a jailbroke iPhone
 a MySQL server, but I'm not sure it is available any longer.

 My immediate desire is to sync the iPhone's native contacts and, perhaps,
 the calendar with our online server over the internet.  Preferably syncs
 would be pushed.

 With a Google Gmail account, you can already do just exactly that.  Once set
 up, if you update your Gmail contacts, a minute or two later your iPhone
 contacts will be sync'd.  It's supposed to work with the Google calendar,
 too, but I haven't tried it.  It appears that Google is using a MS Exchange
 Server or similar.  The setup in the iPhone uses the Exchange server
 settings.  See http://www.google.com/mobile/sync/

 The solution I'm looking for would be server side -- if not completely, in
 part.   Again, it would be best to sync directly to the iPhone, but if the
 server would sync with the Google calendar and Google sync'd with the
 iPhone, that would be an acceptable 2nd choice.

 Thanks again for your reply!

 - Ron




 On 10/23/2010 5:47 AM, Andrés G. Montañez wrote

 Hi Ron, what's what you want to sync? Contacts? Or everything else?
 You want to sync it over the internet? Or over wire?
 You should research the iPhone API/SDK for sync;
 and not focus with MySQL, wich is just an storage.

 Cheers.

 On 23 October 2010 03:09, Karl DeSaulniersk...@designdrumm.com  wrote:


 I believe there is a MySQL for the iphone
 iMy?

 http://forums.mysql.com/read.php?58,249718,249718

 You'd probably want o use JASON or an equiv. to talk back and forth with
 your database and app.
 At least thats the consensus I'm finding on posts about it.

 HTH
 Karl

 On Oct 22, 2010, at 11:21 PM, listread wrote:



 Hey all!

 Does anyone know how to go about syncing a MySQL db with an iPhone over
 the internet?

 An alternative would be syncing with Google Contacts, which then could
 sync with the iPhone.  I think Google Contacts uses Exchange Server to
 sync
 with devices.

 Thanks!

 - Ron



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php








 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] How to Sync MySQL with iPhone or Google Contacts

2010-10-23 Thread Andrés G . Montañez
Hi Ron,
yes,you should try to use Google as a gateway; the Google API is very
well documented,
I think all you need is just the user account (and password) and then
through the API you should access all data.

Cheers.

On 23 October 2010 19:10, listread listr...@cze.com wrote:
 Andrés,

 It would be tempting to build an app for this, but we don't have a single
 Mac in the place.

 Maybe syncing with Google is the way to go?  That would keep the iPhone out
 of the equation.  (This is not intended for the market.)

 Thanks,

 - Ron

 On 10/23/2010 2:16 PM, Andrés G. Montañez wrote:

 Hi Ron,
 watchout with the jailbrake becaous it will void your warranty over
 the iphone. If you want to sync the phone's contact with something,
 you really should check the iphone API and build an iphone application
 which hooks and listens for contact's change and then notify the
 changes to your server.
 I know building an iphone app is a pain, but I think its the right way
 to do it, if not the only.
 Is this need for a hobbie or you need to implement this for a public
 application?

 Cheers.

 On 23 October 2010 13:57, listreadlistr...@cze.com  wrote:


 Karl / Andrés

 Thanks for your replies.

 iMy appears to be only a client and I can already access servers with php
 on
 the iPhone web browser.

 I would like MySQL on my iPhone.  There was a way to make a jailbroke
 iPhone
 a MySQL server, but I'm not sure it is available any longer.

 My immediate desire is to sync the iPhone's native contacts and, perhaps,
 the calendar with our online server over the internet.  Preferably syncs
 would be pushed.

 With a Google Gmail account, you can already do just exactly that.  Once
 set
 up, if you update your Gmail contacts, a minute or two later your iPhone
 contacts will be sync'd.  It's supposed to work with the Google calendar,
 too, but I haven't tried it.  It appears that Google is using a MS
 Exchange
 Server or similar.  The setup in the iPhone uses the Exchange server
 settings.  See http://www.google.com/mobile/sync/

 The solution I'm looking for would be server side -- if not completely,
 in
 part.   Again, it would be best to sync directly to the iPhone, but if
 the
 server would sync with the Google calendar and Google sync'd with the
 iPhone, that would be an acceptable 2nd choice.

 Thanks again for your reply!

 - Ron




 On 10/23/2010 5:47 AM, Andrés G. Montañez wrote


 Hi Ron, what's what you want to sync? Contacts? Or everything else?
 You want to sync it over the internet? Or over wire?
 You should research the iPhone API/SDK for sync;
 and not focus with MySQL, wich is just an storage.

 Cheers.

 On 23 October 2010 03:09, Karl DeSaulniersk...@designdrumm.com
  wrote:



 I believe there is a MySQL for the iphone
 iMy?

 http://forums.mysql.com/read.php?58,249718,249718

 You'd probably want o use JASON or an equiv. to talk back and forth
 with
 your database and app.
 At least thats the consensus I'm finding on posts about it.

 HTH
 Karl

 On Oct 22, 2010, at 11:21 PM, listread wrote:




 Hey all!

 Does anyone know how to go about syncing a MySQL db with an iPhone
 over
 the internet?

 An alternative would be syncing with Google Contacts, which then could
 sync with the iPhone.  I think Google Contacts uses Exchange Server to
 sync
 with devices.

 Thanks!

 - Ron



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php








 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php








 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] big table / hadoop / map reduce

2010-10-22 Thread Andrés G . Montañez
Hi Artur,

Here is an article on wikipedia: http://en.wikipedia.org/wiki/MapReduce

And here are the native implementations in php:
http://www.php.net/manual/en/function.array-map.php
http://www.php.net/manual/en/function.array-reduce.php

The basic idea is to gather a lot of data, from several nodes, and
map them togheter;
then, assuming a lot of this data is repeated across the dataset, we
reduce them.


Cheers.

On 22 October 2010 12:14, Artur Ejsmont ejsmont.ar...@gmail.com wrote:
 Hi there guys and girls

 Have anyone came across any reasonable explanation / articles on how
 hadoop and map reduce work in practice?

 i have read a few articles now and then and i must say i am puzzled
  am i stupid or they just cant find an easy way to explain it? :P

 What i would hope for is explanation on simple example of application
 with some code samples preferably.

 anyone good at it here?

 cheers

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] big table / hadoop / map reduce

2010-10-22 Thread Andrés G . Montañez
Imagine you have to get track of some kind of traffic, for example,
ad impressions;
lets supose that you have millions of those hits; you will have to
have a few servers to
receive the notifications of the impression of an ad.

After the end of the day, you will have that info across a bunch of
servers; mostly you will have
a record of each impression indicating the Identifier (id) of the Ad.

To this info to become useful, you will have to agregate it; for
example to know which is the Ad with most impressions.
You will have to iterate over all servers and MAP the info into one
place; now that you have all the info,
you will have to REDUCE it; so you will have one record per Ad
identifier indicating the TOTAL impressions of that day.

That's the basic idea. It's like aftermath of Divide and Conquer.

Hope this will be useful.

Cheers.

On 22 October 2010 13:27, Artur Ejsmont ejsmont.ar...@gmail.com wrote:
 hehe  sorry but this does not help :-) i can google for wikipedia
 definitions.

 I was hoping for some really good articles/examples that would put it
 into enough context. I would like to have good idea when it could be
 useful.

 So far had no luck with that. Its like with design patterns ... people
 who dont understand them should not write articles trying to explain
 them to others :P

 Art

 On 22 October 2010 15:29, Andrés G. Montañez andresmonta...@gmail.com wrote:
 Hi Artur,

 Here is an article on wikipedia: http://en.wikipedia.org/wiki/MapReduce

 And here are the native implementations in php:
 http://www.php.net/manual/en/function.array-map.php
 http://www.php.net/manual/en/function.array-reduce.php

 The basic idea is to gather a lot of data, from several nodes, and
 map them togheter;
 then, assuming a lot of this data is repeated across the dataset, we
 reduce them.


 Cheers.

 On 22 October 2010 12:14, Artur Ejsmont ejsmont.ar...@gmail.com wrote:
 Hi there guys and girls

 Have anyone came across any reasonable explanation / articles on how
 hadoop and map reduce work in practice?

 i have read a few articles now and then and i must say i am puzzled
  am i stupid or they just cant find an easy way to explain it? :P

 What i would hope for is explanation on simple example of application
 with some code samples preferably.

 anyone good at it here?

 cheers

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





 --
 Andrés G. Montañez
 Zend Certified Engineer
 Montevideo - Uruguay




 --
 Visit me at:
 http://artur.ejsmont.org/blog/




-- 
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] NULL to 0

2010-07-17 Thread Andrés G . Montañez
SELECT
  IFNULL(SUM(`my_Bible_trivia_knowledge_questions_answered`.`score`),
0) AS total_score,
  IFNULL(`my_Bible_trivia_knowledge_profile`.`questions_answered`, 0)
AS questions_answered

In these cases you must use the IFNULL function, for testing the value.

--
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Is this Code Correct??

2010-02-11 Thread Andrés G . Montañez
echo 'Name: a href=' . $url . '' . $runrows['name'] . '/a';


On 11 February 2010 08:54, nagendra prasad nagendra802...@gmail.com wrote:
 Hi All,

 I want to link the actual file when the result is displayed.

 url = actual MP3 location
 Name = Name of the MP3

 Here is the code that I want to link with:

 echo  Name: .a herf='$url'.$runrows['name'];

 Is above code is correct ??

 Best,


 --
 Guru Prasad
 Ubuntu Voice GTK+ Forum




-- 
Atte, Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Is this Code Correct??

2010-02-11 Thread Andrés G . Montañez
Make sure your $url variable has the right value.

On 11 February 2010 09:06, nagendra prasad nagendra802...@gmail.com wrote:
 Thanks Buddy, its working but the linking is not working properly. Its
 taking me the same page address on which right now I am.

 http://localhost/searchengine/download.php?url=mj_bad_track01.mp3

 I want to connect the url directly to the MP3 file so that user can download
 the MP3.

 Best,



-- 
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] comparing stored timestamp with NOW()

2009-02-24 Thread Andrés G . Montañez
If your timestamps is an UNIX Timestamp,
and your DB is MySQL, this should do the trick

$days = 7;
$sql = 'SELECT (UNIX_TIMESTAMP() - ' . $timeStamp . ') = (3600*24*' .
$days . ');';

3600*24 is one day in seconds, so multiply it by the days limit (7 days).

Example Query:
mysql SELECT (UNIX_TIMESTAMP() - 1235861716) = (3600*24*7) AS valid FROM dual;
+---+
| valid |
+---+
| 1 |
+---+

Enjoy.

-- 
Atte, Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] resources and resource types

2008-03-31 Thread Andrés G. Montañez
The ID of the resource changes on every new resource.
There is no co-relation between resources and resources id.

The only thing you can get is the Type of the Resource, read:
* http://www.php.net/manual/en/language.types.resource.php
* http://www.php.net/manual/en/resource.php
* http://www.php.net/manual/en/function.get-resource-type.php


-- 
Atte, Andrés G. Montañez
PHP Senior
Técnico en Telecomunicaciones
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] md5() function

2008-01-14 Thread Andrés G. Montañez
MD5 is also known as an one-way crypt system; you can encryptit but
never unencrypted; only using brute force or a hash list you can
retrive a 'string' that it's hash is the one stored; but it is not
necesary the same original string; this is also known as a hash
collision.

So, in short... no, there isn't a unMd5().
If you need to retrive the original string, try GPG.


On 14/01/2008, Miguel Guirao [EMAIL PROTECTED] wrote:
 Hi!!

 I'm using the md5() function to encrypt a password and store it into a
 database. Now I want to retrieve that MD5 password and convert it into it's
 human readable condition.
 Is there a function opposite to md5()??

 Best Regards,

 M Guirao

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Pages not fully loading

2007-09-21 Thread Andrés G. Montañez

 Has anyone had this strange and frustrating experience?


Hopefuly no.
But, what session storage are you using? Maybe there is a problem
there (quota reached, etc), and the session fail is causing the page
fail.

Anyway, try to the help desk to review the Apache Logs, and see if
there is no inusual activity, like segmentations faults, etc.

Good luck.


-- 
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] widthheigh

2007-03-30 Thread Andrés G. Montañez

The HTML attributes must be encloesd in double quotes (at least in xHTML).

So, the code should be

td width=90 height=70
?php echo img src=\/album/img/\.$photoFileName[2].\ width=\90\
height=\70\ border=\0\ /; ?
/td

Note the \ for escaping the double quotes in the double quotes defined string.


--
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Postgres Bytea Field + Adodb

2005-06-14 Thread Andrés G . Montañez
Hi, someone can helpme with inserting a binary data (from a file) to a
Postgres Database with the ByteA field, i'm using the ADOdb class.

THX

-- 
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Newbie with mail problem

2005-06-07 Thread Andrés G . Montañez
Use a real hostname, not 'localhost'.-

-- 
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] How many rows for 100 questions?

2005-05-28 Thread Andrés G . Montañez
 I have a questionary that has 100 questions,
 
 Should I create 2 tables 1 with the user information and the second one
 with
 the 100 questions? What is your recommendation?

I recommend you the next table configuration:

1 table for users
1 table for the questions (so you can have more than 100)
IF the User can Input the Answer - 1 table with User ID, Questin ID
and the Answer
IF the User only selects a pre-defined Answer - 1 table Answer ID,
Questin ID, Answer
  
1 table User ID, Questin ID, Answer ID

IF the User can select a pre-defined answer OR input, a MIX of both solutions.

-- 
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] multiple queries, one transaction - REWORDED

2005-05-22 Thread Andrés G . Montañez
Crate an Array, where the Key is the ItemId, and the value is the ItemQty.
If the client want to delete an the item, unset the key, if the client
wont to add or remove an item quantity, just change the value.

Then when the items and quantities are correct, just 
start transaction
begin foreach
If (! (INSERT . (order, ItemID (the array key), ItemQty (the array
value of the key))...))
rollback transaction
break
end foreach
commit transaction

So if the insert is failed, you rollbackit.
No need for a DELETE

-- 
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] PHPMySQL left/substring etc problem

2005-04-19 Thread Andrés G . Montañez
 But when I tried, select left (loc1,3) from openart_table where..

Try without the space between 'left' and '(',
I mean... LEFT(loc1, 3)
where loc1 is the name of the column,
and 3 the characters you want to show.

-- 
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] stuck on module of apache

2005-04-17 Thread Andrés G . Montañez
Check for the slashes (/).
Even in Windows you must use UNIXish paths.

From the httpd.conf file

# NOTE: Where filenames are specified, you must use forward slashes
# instead of backslashes (e.g., c:/apache instead of c:\apache).
# If a drive letter is omitted, the drive on which Apache.exe is located
# will be used by default.  It is recommended that you always supply
# an explicit drive letter in absolute paths, however, to avoid
# confusion.

-- 
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] using POST data for a readfile

2005-04-13 Thread Andrés G . Montañez
 I didn't mean to offend or say your way was wrong.  I was just offering
 an alternative method.

Oh no, you didn't offended me in anyway!
I was saying that my example should not be used, because it do not work.

-- 
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] using POST data for a readfile

2005-04-12 Thread Andrés G . Montañez
I give the exaple just as an guide not a working one.

-- 
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] using POST data for a readfile

2005-04-11 Thread Andrés G . Montañez
You should use some JavaScript.
Try something like this:

form name=downloads medoth=post action=callFile.php
input type=hidden value=test.pdf
a href=# onclick=document.downloads.submit(); target=_blank
/form

-- 
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] DATETIME MySQL - using only month and date

2005-04-10 Thread Andrés G . Montañez
 $month_start : starting month
 $month_end : ending month
 
 $day_start : starting day
 $day_end : ending day

You could add something like this in the WHERE clause:

((MONTH(closing) = $month_start AND DAY(closing) = $day_start)
AND
(MONTH(closing) = $month_end AND DAY(closing) = $day_end))

-- 
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php