RE: [PHP-DB] get all records but limit to 6

2004-06-13 Thread Marcjon
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

RE: [PHP-DB] get all records but limit to 6

2004-06-13 Thread Sunmaia
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

[PHP-DB] get all records but limit to 6

2004-06-13 Thread Gawie Marais
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

Re: [PHP-DB] MySQL persistent connections

2004-06-13 Thread Michael Gale
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

Re: [PHP-DB] Mysql not receiving the data

2004-06-13 Thread franciccio
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 "

[PHP-DB] creating a nested multidimensional array from a query

2004-06-13 Thread grahama
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

Re: [PHP-DB] Mysql not receiving the data

2004-06-13 Thread Hans Lellelid
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

RE: [PHP-DB] Mysql not receiving the data

2004-06-13 Thread Andrew Rothwell
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

[PHP-DB] Re: Problem in passing the necessary variable.

2004-06-13 Thread franciccio
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

Re: [PHP-DB] Mysql not receiving the data

2004-06-13 Thread franciccio
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\", >

RE: [PHP-DB] Mysql not receiving the data

2004-06-13 Thread Rich Hutchins
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

Re: [PHP-DB] Mysql not receiving the data

2004-06-13 Thread Lester Caine
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

RE: [PHP-DB] Mysql not receiving the data

2004-06-13 Thread Andrew Rothwell
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

Re: [PHP-DB] Mysql not receiving the data

2004-06-13 Thread Larry E . Ullman
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

[PHP-DB] Mysql not receiving the data

2004-06-13 Thread Andrew Rothwell
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

[PHP-DB] Re: how to reuse DB results

2004-06-13 Thread franciccio
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

Re: [PHP-DB] Re: HTTP header information

2004-06-13 Thread franciccio
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 >

[PHP-DB] Re: Retrieve data from a table, edit/add it and enter it in a new table

2004-06-13 Thread franciccio
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

[PHP-DB] Re: how to reuse DB results

2004-06-13 Thread franciccio
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

[PHP-DB] Re: mysql results, arrays, and for loops

2004-06-13 Thread franciccio
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