[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: ?php $recordset=mysql_query($query); $num_righe=mysql_num_rows($recordset); // here starts the dinamyc table echo TABLE align=\left\ border=\1\ cellspacing=\2\ cellpadding=\2\ width=\80%\\ntr; $record=

[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

[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

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

2004-06-13 Thread franciccio
You may try with this: ?php ob_start();/* buffer the output so no header is sent until the script is complete*/ session_start(); if (!session_is_registered('_isLoggedIn')) { header (Location:viewer.php?type=login); } else { // do the stuff to submit a problem if they have // logged in and have

[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

[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

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

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

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 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

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\,

[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: ?php $_your_variable=$row[imgid]; echo a href=\../images/image.php?img=$_your_variable\ target=\_blank\ onClick=\window.open(this.href, this.target, \'width=200,height=250\'); return false;\img

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

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

[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

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. form name=form1 method=post action=anypage.php?get_var=1 input type=text name=text_post value=Hello World input type=submit name=Submit value=Submit /form in your code at

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