|
Posted by michalkuls on 01/10/08 09:38
On 9 Sty, 20:28, NC <n...@iname.com> wrote:
> On Jan 9, 8:49 am, michalk...@o2.pl wrote:
>
>
>
> > The portal runs on apache/php/mysql. Php generates a query, and the
> > result returned is from a cache, not from the actual mysql db. The
> > data I receive is not up-to-date - to changes I make during this
> > time.
> > I have tried using mysql_unbuffered_query, but doesn't help.
> > I have finally come to the solution. At the end of list of fields
> > following SELECT statement, I entered rand() function which causes
> > that every query is different from the previous...
> > Looks like this: SELECT field1,field2,...,rand() FROM ...
>
> > But this solution is ugly and very unproffesional.
> > Do you have any better idea?
> > How to stop php/apache from buffering/caching mysql query results?
>
> Query caching is a MySQL-level setting; PHP and Apache have nothing to
> do with it.
>
> You have two options. One is to stop query caching entirely by
> setting query_cache_type = 0 or query_cache_type = OFF in MySQL's
> configuration file:
>
> http://dev.mysql.com/doc/refman/4.1/en/server-system-variables.html#o...
>
> If you have no access to MySQL's configuration file, you can add a
> SQL_NO_CACHE clause to your queries to request that MySQL run the
> query rather than return a cached result:
>
> SELECT SQL_NO_CACHE * FROM myTable;
>
> See MySQL documentation:
>
> http://dev.mysql.com/doc/refman/4.1/en/select.html
>
> Cheers,
> NC
Thanks, this helps!
Michal
[Back to original message]
|