Re: [PHP-DB] bindParam OR bindValue

2010-12-28 Thread Artur Ejsmont
i am not 100% sure but should you not remove ' from around the
variables to have (NULL, :f1, :l1 etc? prepared statements take care
of escaping and quoting.

http://www.php.net/manual/en/pdo.prepare.php

does it help?

art

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

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



Re: [PHP-DB] query help

2010-11-17 Thread Artur Ejsmont
well  i guess you could do that. but it gets complicated after a
while and there will be a lot of work and probably after a while you
will get into some problems. You have to handle escaping, special
types etc. Then what about performance? how to query the data ...
using similar approach or is it just for inserts? there is a bit of
work to make it really usable i guess.

I am not saying its wrong though, I have seen this approach twice ...
in general its possible.

Maybe better choice would be to try to use some orm ? there are plenty
of frameworks out there  the only problem is the learning curve
may be steep.

What others think?

art

On 17 November 2010 13:51, Vinay Kannan  wrote:
> Hello PHP Gurus,
>
> I need your help on an insert query.
>
> I wanted to know if there is way to insert an array of values into a DB. An
> eg would explain this better :
>
> If I have 2 tables in a DB, 1) users has 3 columns 2) hobbies = 5 columns
>
> I was thinking of having a single function which will perform the insert on
> any  insert which happens on the entire website.
>
> Eg : This function can be called with 2 parameters, the first parameter the
> table name, and the second parameter is an array of values which will be
> inserted into the table.
> eg : Users has these columns [1]ID [2] Name [3]Location
> so the function call would be something like *
> insert_into_tbale(users,array[user_values])*
> **
> Does this make sense ? Is this a good method to follow ?
>
> Thanks in advance !
>
> Vinay Kannan.
>



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

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



Re: [PHP-DB] Reading from file

2010-11-02 Thread Artur Ejsmont
"Return Values

If only two parameters were passed to this function, the values parsed
will be returned as an array. Otherwise, if optional parameters are
passed, the function will return the number of assigned values. The
optional parameters must be passed by reference."

http://php.net/manual/en/function.fscanf.php

so you should expect an array. print_r it to see what is inside.

art


On 2 November 2010 03:34, Ethan Rosenberg  wrote:
> Dear List -
>
> Thank you for all your help.  Here is another one.
>
> I have a file [/home/ethan/PHP/RecNum] which consists of the number 1005.
>  It also has been "1005".  No matter how I do it, it is only recognized as
> 1.
>
> Here is the code.  In this case, the file is "1005".
>
> $fptr1 = fopen("/home/ethan/PHP/RecNum", "r+");
> $recNum = (int)fscanf($fptr1,"%s");
> echo $recNum;  //which always is 1
>
> If I do not typecast $recNum to int, the value is Array.
>
> Thanks.
>
> 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
>
>



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

--
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 Artur Ejsmont
yeah i think that would make sense.

if you find more good examples from different areas let me know ... i
think i get the basic idea ... will try to apply it some time :)

cheers :)

art

On 30 October 2010 18:58, Andrés G. Montañez  wrote:
> 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  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 
>> - before reduce is called data is sorted by ip
>> - reduce makes 
>>
>> so i have a bunch of files with aggregated lists of > 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  
>> 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  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  
>>>> 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 

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

2010-10-30 Thread Artur Ejsmont
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 
- before reduce is called data is sorted by ip
- reduce makes 

so i have a bunch of files with aggregated lists of . 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  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  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  
>> 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  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/

--
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 Artur Ejsmont
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  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  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/

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



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

2010-10-22 Thread Artur Ejsmont
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



Re: [PHP-DB] Creating an INDEX on multiple tables?

2010-10-21 Thread Artur Ejsmont
I dont think you can create such index across tables.

If you are interested read up on sphinx. Im pretty sure you would be
able to create what you need.

Alternatively ... a super simplistic solution . create one extra
search table with copy of the data and create index there? ;P hehehe
+ would let you do what you need
- would require a lot more IO to support the extra writes (to keep copy in sync)

It would be cool if a fulltext index could be created on a view :)

Art

On 21 October 2010 09:43, Ron Piggott  wrote:
> Is it possible to create one index on multiple tables?  I am trying to create 
> a search function for my web site.  The data the user needs to be able to 
> search is stored in multiple tables.  I would like to be able to use "MATCH / 
> AGAINST", like the query below I found online.
>
> SELECT firstname, lastname,comments FROM users WHERE 
> MATCH(firstname,lastname,comments) AGAINST ('$searchterm')
>
> Ron

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



Re: [PHP-DB] Books

2010-10-18 Thread Artur Ejsmont
the only book i can really recommend in this area is high performance
mysql but its not for starters ..its excellent!

art

On 18 October 2010 15:06, Ethan Rosenberg  wrote:
> Dear List -
>
> I posted part of this question on the general list.  I am posting here just
> in case this list did not see the post.  This should NOT be taken as any
> type of negative reference to the general list, the members of which have
> furnished me excellent help.
>
> Question:
>
> What books would your recommend to learn HTML/CSS, MySQL and PHP?  The books
> should start from the basic level and proceed to the intermediate/advanced
> level.
>
> Thanks.
>
> Ethan
>
>
>
> --
> 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



Re: [PHP-DB] RE: [phpXperts] No Warping in results [1 Attachment]

2010-07-23 Thread Artur Ejsmont
I guess the html/css is wrong. If you print all links in new TD elements or
as nonbreakable test it will look like this. If you just use divs floating
left instead then links will fill the space and wrap around. Also getting
rid of it all together and simple list of a tags with some space between
would be enough. would behave same way.

code is unreadable so i am not sure how it works  link to sarecode like
gist would work better.

cheers

Art

On 23 July 2010 06:35, Chaitanya  wrote:

> Guru,
>
> Why do you want to show all page  numbers within the page. You can apply a
> break and use like Prev and Next links after showing 10th link which is
> similar to  1,2,3,4,5,6,7, .. , etc. There are many scripts
> availabe on net on pagination functions. You can google on it.
>
> Chaitanya.
>
>
> --
> Thanks,
> Chaitanya.
>
>
>  _
>
> From: phpexpe...@yahoogroups.com [mailto:phpexpe...@yahoogroups.com] On
> Behalf Of nagendra prasad
> Sent: Thursday, July 22, 2010 8:14 PM
> To: phpexpe...@yahoogroups.com; PHP DB; php-wind...@lists.php.net; php
> mysql
> Subject: [phpXperts] No Warping in results [1 Attachment]
>
>
>
> [Attachment(s) <>  from nagendra prasad included below]
>
> Hi All,
>
> I have a code which will shows the mysql data in a page. When the data is
> less its working fine however when the data is huge let say more then 10
> thousand the page numbers are not warping. Its going beyond the page.  I
> have attached the result page image as well.
> Below is the code of page navigation.
>
>
>
> 
> *
>
> 
>
>  {
> ?>
>  cellpadding="4">
> 
>  1) { ?>
> << Prev 
> 
>   global $pagerange;
>
>  if ($pagecount > 1) {
>
>  if ($pagecount % $pagerange != 0) {
>$rangecount = intval($pagecount / $pagerange) + 1;
>  }
>  else {
>$rangecount = intval($pagecount / $pagerange);
>  }
>  for ($i = 1; $i < $rangecount + 1; $i++) {
>$startpage = (($i - 1) * $pagerange) + 1;
>$count = min($i * $pagerange, $pagecount);
>
>if ((($page >= $startpage) && ($page <= ($i * $pagerange {
>  for ($j = $startpage; $j < $count + 1; $j++) {
>if ($j == $page) {
> ?>
> 
> 
> 
> 
>  .."..." .$count ?>
> 
> 
>  Next >> 
> 
> 
> 
> 
>
>  {
> ?>
> 
> 
>
>  0) { ?>
>
> 
>
> 
> 
> 
> 
> 
>
> **
>
> Please help me with this.
>
> Best,
> Guru.
>
>
> __._,_.___
> Attachment(s) from nagendra prasad
>
> 1 of 1 Photo(s)
>
>
> <
> http://groups.yahoo.com/group/phpexperts/attachments/folder/692554198/item/
> 17124914/view> result page.jpg
> result
> <
> http://groups.yahoo.com/group/phpexperts/attachments/folder/692554198/item/
> 17124914/view> page.jpg
> Reply to  
> sender | Reply to   in
> results> group | Reply
> <
> http://groups.yahoo.com/group/phpexperts/post;_ylc=X3oDMTJyYWF2b2hvBF9TAzk3
>
> MzU5NzE0BGdycElkAzEzODc3MTg3BGdycHNwSWQDMTcwNTAwNjc2NARtc2dJZAMxMzczNQRzZWMD
> ZnRyBHNsawNycGx5BHN0aW1lAzEyNzk4MTM2MTM-?act=reply&messageNum=13735> via
> web
> post | Start
> <
> http://groups.yahoo.com/group/phpexperts/post;_ylc=X3oDMTJmMnA0ZnM1BF9TAzk3
>
> MzU5NzE0BGdycElkAzEzODc3MTg3BGdycHNwSWQDMTcwNTAwNjc2NARzZWMDZnRyBHNsawNudHBj
> BHN0aW1lAzEyNzk4MTM2MTM-> a New Topic
> Messages
> <
> http://groups.yahoo.com/group/phpexperts/message/13735;_ylc=X3oDMTM3YjVwczJ
>
> 0BF9TAzk3MzU5NzE0BGdycElkAzEzODc3MTg3BGdycHNwSWQDMTcwNTAwNjc2NARtc2dJZAMxMzc
> zNQRzZWMDZnRyBHNsawN2dHBjBHN0aW1lAzEyNzk4MTM2MTMEdHBjSWQDMTM3MzU-> in this
> topic (1)
> Recent Activity:
>
> *   New
> <
> http://groups.yahoo.com/group/phpexperts/members;_ylc=X3oDMTJncnRkN25pBF9TA
>
> zk3MzU5NzE0BGdycElkAzEzODc3MTg3BGdycHNwSWQDMTcwNTAwNjc2NARzZWMDdnRsBHNsawN2b
> WJycwRzdGltZQMxMjc5ODEzNjEz?o=6> Members 2
>
> Visit
> <
> http://groups.yahoo.com/group/phpexperts;_ylc=X3oDMTJmdDhjbmRnBF9TAzk3MzU5N
>
> zE0BGdycElkAzEzODc3MTg3BGdycHNwSWQDMTcwNTAwNjc2NARzZWMDdnRsBHNsawN2Z2hwBHN0a
> W1lAzEyNzk4MTM2MTM-> Your Group
> Visit phpXperts website at www.phpxperts.net
> MARKETPLACE
>
> Stay
> <
> http://us.ard.yahoo.com/SIG=15op7n7nt/M=493064.13983314.14041046.13298430/D
>
> =groups/S=1705006764:MKP1/Y=YAHOO/EXP=1279820814/L=5a480dea-95a8-11df-a5ee-e
>
> ff6624bf90c/B=LTh5AmKImiI-/J=1279813614619203/K=f7T7XCPBVioM6wGkNaT5Vw/A=606
> 0255/R=0/SIG=1194m4keh/*http://us.toolbar.yahoo.com/?.cpdl=grpj> on top of
> your group activity without leaving the page you're on - Get the Yahoo!
> Toolbar now.
>
>
>  _
>
>
> Get
> <
> http://us.ard.yahoo.com/SIG=15osa2cre/M=493064.13814537.14041040.10835568/D
>
> =groups/S=1705006764:MKP1/Y=YAHOO/EXP=1279820814/L=5a480dea-95a8-11df-a5ee-e
>
> ff6624bf90c/B=Ljh5AmKImiI-/J=1279813614619203/K=f7T7XCPBVioM6wGkNaT5Vw/A=607
> 8812/R=0/SIG=114ae4ln1/*http://dogandcatanswers.yahoo.com/> great advice
> about dogs and cats. Visit the Dog & Cat Answers Center.
>

[PHP-DB] anyone has experience with pgslq Cybercluster 2 ?

2010-06-01 Thread Artur Ejsmont
Hi there i just noticed announcement of cybercluster 2 release for postgres.

http://www.cybertec.at/en/postgresql_news

they say its open source but did not find downloads on their site ; )

Anyone has experinece with it? i loved postgres and used to work with it for
a long time but lack of easy and reliable replication forced me to move back
to mysql. To be honest did not look at postgres for a few years now  : /

Anyone could share some tips on php-pgsql-replication experiences?

cheers

art


Re: [PHP-DB] MySQL: Creating a database with

2010-05-18 Thread Artur Ejsmont
You probably miss the mysql extension or have different one than you are
calling.

Please call


in script to see what extensions are loaded. if there is some other module
supporting mysql just use different way to run sql.

otherwise you need to look into php.ini and see if module is available and
activate it. If you dont have one and you are on debian like system you
might be able to install it from a system package.

Art

On 18 May 2010 09:18, Alexander Schunk  wrote:

> Hello,
>
> i want to create a database with php.
>
> A look in the php manual says that you need a special 4.x MySQL
> version for using
> mysql_create_db().
>
> I am getting error message: Call to undefined function mysql_create_db().
>
> When is this function defined and in what version of MySQL?
>
> yours sincerly
>
> Alexander Schunk
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP-DB] Need Help in error msg

2010-05-18 Thread Artur Ejsmont
May also be granted rights to login from '%' which will resolve to any host
name except localhost.

On 18 May 2010 08:24, "Peter Lind"  wrote:

On 18 May 2010 09:19, nagendra prasad  wrote:
> Hi All,
>
> I am getting t...
It means that either the password you're using is wrong or the user
doesn't have access to the DB server (the user doesn't exist or
doesn't have the proper rights).

Regards
Peter

--

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


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


Re: [PHP-DB] Help with mysql data sorting using php

2010-05-17 Thread Artur Ejsmont
Hehe. Then a method: ) just make a query builder method like 'findSongs'
with all the params ( optional or mandatory ) like page, limit, sortby,
filters etc. then inside build SQL based on args.  Just be careful - SQL
injection is your enemy here. From app pass all the args from get/ post and
that's it. Good luck.

On 17 May 2010 08:18, "nagendra prasad"  wrote:

DB is like more then 500MB

and it will grow day by day :)





On Mon, May 17, 2010 at 12:46 PM, Artur Ejsmont 
wrote:
>
> If the DB i...


Re: [PHP-DB] Session start

2010-05-14 Thread Artur Ejsmont
id also suggest to revisit the entire login script that you have attached,
its a bit overly complicated. Keep amount of if statements to the minimum
and you will not get lost. Try to keep it simple.

Session is not a problem for you, just make a very simple set of rules when
user is logging in, logging out and how to check if he is logged in.

i guess its worth having a look at some open source apps or frameworks and
see how they do it, good luck

art

On 14 May 2010 18:24, Luiz Alberto  wrote:

> Barry,
>
> Did you try to use setcookie with expiry date in the past? You could
> use
> setcookie before header function of the following manner.
>
> session_start();
> if (!(isset($_SESSION['username']) && $_SESSION['username'] != '')) {
> setcookie("session","session id", 1);
> header ("Location: login.html");
> }
>
> Best regards,
> Luiz Alberto
>
>
>
> On Fri, 2010-05-14 at 17:47 +0100, Barry Zimmerman wrote:
>
> > I have a problem with my system, not sure how I can fix this one. A user
> has
> > a log in page and takes them to different pages, now each of these pages
> has
> > a check to make sure they are logged in with the following code:
> >
> > session_start();
> > if (!(isset($_SESSION['username']) && $_SESSION['username'] != '')) {
> > header ("Location: login.html");
> > exit;
> > }
> >
> > So if they are not logged in it redirects them to the log in page. No
> > problems there.
> >
> > Now if a user is not logged in and comes back to that page, it starts the
> > session so giving them a session id and redirects them back to thge login
> > page. The problem I have is I do NOT want the session to start, I need
> them
> > to hit the log in page with no sessions there. I have tried all sorts but
> > just cannot get this to work.
> >
> > I have tried adding this to the code.
> >
> > session_start();
> > if (!(isset($_SESSION['username']) && $_SESSION['username'] != '')) {
> > *session_destroy();*
> > header ("Location: login.html");
> > exit;
> > }
> >
> > But that did not work? Please I am stuck for ideas?
>