I think the problem is he wants to limit after he's sorted them. The
only way I know of to do that is to do the whole query without a limit
clause, then run through the results but only do whatever you have to do
with the first 6.
--
Marcjon
--
PHP Database Mailing List (http://www.php.net/)
T
select * from table order by datetime_field desc limit 0,6
Peter
> -Original Message-
> From: Gawie Marais [mailto:[EMAIL PROTECTED]
> Sent: 14 June 2004 07:20
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] get all records but limit to 6
>
>
> hi,
>
> i need to get only the first 6 record
hi,
i need to get only the first 6 records sorted by datetime from the thousands
of records in existance. how do i do that ?
thus, only the latest 6 records added to the database should be displayed
and this can be done with the datetime field in the database. can anyone
help with the php code pl
Hello,
I am no expert but I believe more information is required, like what
would be the average return of a mysql operation ? How many different
DB's are you accessing ? How many different usernames and passwords for
mysql are you using ??
I believe persistent connections are only useful
Some of the reason to have "register_global" on is to easly use variables
sent by post, get, cookie method of a form.
Ex.
in your code at the page "anypage.php" you will have available the
variables:
$get_var==1 and $text_post=="Hello World"
if "register_global=TRUE "
Hi :)
I am on my second week of php so be gentle
I am creating an XML file out of a mysql query with nested arrays.
Currently I can get 1 element and 1 child with a properly formatted XML
file with the below script .
My question is: How do I add 3 to 4 more child elements to the below
'playlis
Hi Andrew,
Andrew Rothwell wrote:
Thank you everybody that responded so quickly -
I used the suggestion of Franciccio - and the data is now gow into the db
Thank you very much - I really appreciate the help.
Another question - with this fix in place - do I still need the
register_globals = On ?
Or
Thank you everybody that responded so quickly -
I used the suggestion of Franciccio - and the data is now gow into the db
Thank you very much - I really appreciate the help.
Another question - with this fix in place - do I still need the
register_globals = On ?
Or can I now turn it off?
Thank you
Ciao..hi, i would suggest to embed the html code in php like this:
";
?>
If it works let me know , bye
Francesco Basile
__
"Alessandro Folghera" <[EMAIL PROTECTED]> ha scritto nel messaggio
news:[EMAIL PROTECTED]
> Hi,
>
> I ha
I agree, the slashes are killing the query. I would suggets doing this:
$add = "INSERT INTO movies SET
> movie_name=\"$movie_name\",
> genre=\"$genre\",
> director=\"$director\",
> star1=\"$star1\",
> star2=\"$star2\",
> star3=\"$star3\",
>
The apostrophe (') in your data is, most likely, killing the SQL statement
when it is sent to the server. Use addslashes() around all of your form data
to prevent this and also to help guard against SQL injection attacks.
Ex:
$add = "INSERT INTO movies SET
movie_name='".addslashes($movie
Andrew Rothwell wrote:
Hi Larry, Thank you very much for the very quick response, I set my php.ini
file (located /etc/php.ini ) for the register_globals = On (it was off by
default)
Now however I get an error
Error adding entry: You have an error in your SQL syntax near 's spanish
driver is found
Hi Larry, Thank you very much for the very quick response, I set my php.ini
file (located /etc/php.ini ) for the register_globals = On (it was off by
default)
Now however I get an error
Error adding entry: You have an error in your SQL syntax near 's spanish
driver is found shot dead, Inspector J
Online I could see everything, and the pages gave the appearance of
working,
however when I went into the DB using PHPMYADMIN to check the status
of the
new data entered, all I found was blank rows ( for the new data since
the
rebuild, all the old data was there) There were the correct number of
Good day list,
I was running a Mysql/PHP DB/Webpage that was hosted on Redhat 8.0
It was a simple DB - only 1 table, and the php page connected and fed data
to it.
Last weekend I rebuilt the server to Fedora Core 2 - using the default
PHP/Mysql/apache installs.
I setup the databases, and importe
Hi here is my logic, i haven't tested but it should work (i hope)!!!
i'm not sure if it works only on php5...!?! Let me know if it is a complete
crap i've just started learning php.
Bye
$recordset=mysql_query($query); // whatever query is
$obj_array=new ArrayObject($recordset);
// get the iterato
You may try with this:
// then here is all the html for that page
Bye
Basile Francesco
"Philip Thompson" <[EMAIL PROTECTED]> ha scritto nel messaggio
news:[EMAIL PROTECTED]
>
> On Jun 10, 2004, at 9:44 AM, Torsten Roehr wrote:
>
> > "Philip Thompson" <[EMAIL PROTECTED]> wrote in message
>
I see one bug in your code , that is you never "rewind" the pointer of
mysql_fetch_array($result), so at the end of the first cycle ...while
($r=mysq...)... the pointer is at the end of the query resource. You should
use mysql_data_seek($result,0) to rewind before doing another while cycle.
Hope it
Sorry for mystakes, (shame on me, i said i was new) using Object array,
here is a working version (tested) with use of array.
Bye
$recordset=mysql_query('SELECT * FROM my_tabella'); // or whatever query is
/* define an array with fields to be shown on top of page. Attention
...values name mu
Hi, here is my solution (one of the possible) it is tested so it should work
fine:
\n";
$record= mysql_fetch_array($recordset, MYSQL_ASSOC);
foreach ($record as $k =>$val)
{
echo "$k\n"; // print the field name in the first row of
the table
for ($i=0;$i<$num_righe;$i++)
{
echo
20 matches
Mail list logo