[PHP] Re: mysql_fetch_array
Eduardo Vizcarra wrote: I have a WHILE sentence to retrieve all records from a SELECT query in a database and am using mysql_fetch_array to store them in a matrix, the sentence is like this: while($row=mysql_fetch_array($fotos)) { $fotos_mostrar[] = $row; } $fotos contains all records found in a db table, the SELECT statement is retrieving 2 columns from a table, how do I store all records in a 2 dimention table so I can use it later ? this WHILE sentence seems to only store the last record only Regards Are you sure your query is returning > 1 row ? Because from the looks of the code you posted it should do exactly what you expect it to. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Generating HTML table from MySQL table based on some criteria
Wolf wrote: Sudheer, Post the code you are using and we'll better be able to point you in the right direction to get your code working. Thanks Jim Lucas, Wolf and Jay Blanchard for your suggestions. Here is the code I am using [code] print ''; $result = mysql_query("SELECT * FROM users where status=1 AND picture <> '' ORDER BY created DESC limit 20"); while ($user_info = mysql_fetch_object($result)) { $output .= ' http://example.com/'.$user_info->picture.'" height="90" > ' .''. $user_info->name .''; } print $output; print ''; [/code] The above code prints the pictures of last twenty users who have uploaded their pictures. Each picture is printed in an HTML table cell. The table has only one row. I want to split the HTML table into 4 rows each containing 5 cells. Each table cell should contain one user picture. How can I do this? PS: The DB column names are slightly different than I mentioned in my previous message. Wolf Sudheer Satyanarayana <[EMAIL PROTECTED]> wrote: Hello, I have a MySQL table with four columns - userid, created_date, username and path_to_picture. path_to_picture column contains the path to the image files of those users who have uploaded pictures. An example path stored in path_to_picture column is picture/username.png. There are some users that don't have their pictures uploaded. The column contains nothing for these usernames. I want to generate an HTML table with 20 recent users who have uploaded their pictures. Each row in the HTML table should contain 5 columns. Thus the HTML table would contain 4 rows. How can I accomplish this? I hope I have provided enough information to describe my problem. I would be glad to provide more details if required. I tried few permutations and combinations with ORDER BY and LIMIT clauses to no avail. I have been scratching my head from few hours to get this to work. Any help would be greatly appreciated. -- With Warm Regards, Sudheer. S http://www.binaryvibes.co.in -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- With Warm Regards, Sudheer. S http://www.binaryvibes.co.in -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Page cannot be displayed error in IE6
On 11/3/07, tanzeem <[EMAIL PROTECTED]> wrote: > > > i have 3 php files pag1.php,page2.php,page3.php > I posted to page2.php from page1.php > Then again posted from page2.php to page3.php > But when i click th back button from page3.php in IE 6.0 it displays > a page cannot be displayed error. > When i tried the same with Firefox it displayed the page2.php correctly. > Can anyone suggest a solution to thsi problem im surprised you dont get a warning in firefox as well. when you send a request to the server via HTTP POST, subsequent retransmission of the same request causes browsers to generate an warning. the reason is because HTTP POST is designed for requests that will alerter, add, or destroy data on the server; typically in a database these days, whereas a get request is just for viewing a resource. think of a site where you make a purchase. on the last page of the checkout process, your sensitive data is posted to the server, then if you try pressing back the warning is raised by the browser. this is so your card is not accidentally billed twice, and usually you will see messages on the page that say dont press back or dont send this page twice. so if youre pages constitute a request that inovokes a change in the data on the server, they are probly fine already. otherwise switch the request method to get, and youll be able to use the back button w/o warning. -nathan
[PHP] $_POST superglobal empty, while readfile("php://input") does return data.
Hey all! Im trying to submit a very basic form to phpinfo(): readfile: '; readfile("php://input") phpinfo(); ?> When i use the button to submit the form and it loads the new page I get: var_dump: array(0) { } readfile: foo=bar I would expect the $_POST var to be filled cause the readfile does work. Also, get requests, cookies and sessions do work... all cept for the POST data. I couldn't find any errors in the apache error_log. I think it's not browser related because I tested it another server and it did work using FF and IE7. Im using PHP Version 5.2.4_p20070914-pl2-gentoo, with suhosin and the ZendOptimizer on Linux AMD64. I've also set the max_post and max_upload to 1024M for testing... Nothing works... :( Does anyone have a direction for me? Been using php for years but have never seen anything like this... Thanks! -Mackatack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST superglobal empty, while readfile("php://input") does return data.
On 11/3/07, Mackatack <[EMAIL PROTECTED]> wrote: > > Hey all! > > Im trying to submit a very basic form to phpinfo(): > > > > > > error_reporting(E_ALL); > echo 'var_dump: '; > var_dump($_POST); > echo 'readfile: '; > readfile("php://input") > > phpinfo(); > ?> > > When i use the button to submit the form and it loads the new page I get: > > var_dump: array(0) { } > readfile: foo=bar > > I would expect the $_POST var to be filled cause the readfile does work. > Also, get requests, cookies and sessions do work... all cept for the > POST data. I couldn't find any errors in the apache error_log. > > I think it's not browser related because I tested it another server and > it did work using FF and IE7. > > Im using PHP Version 5.2.4_p20070914-pl2-gentoo, with suhosin and the > ZendOptimizer on Linux AMD64. I've also set the max_post and max_upload > to 1024M for testing... Nothing works... :( > > Does anyone have a direction for me? Been using php for years but have > never seen anything like this... is this a new box? have you tried w/o suhosin and / or zend optimizer? did the other box you tested on have suhosin? -nathan
[PHP] Rendering problem (IE browser on windows + php on linux host)
Hi All, If someone has seen this before it would greatly help me. I have done a php site at work on my windows server. The site renders perfectly in both Firefox & IE. Transferred my site to my home server which is a ubuntu server. Site renders perfect in Firefox but goes wacky in IE. Thought this might be an apache/php config problem on my ubuntu server so I tried to compare both my php.ini + apache config file and nothing works so far. Any Ideas? Erick P. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Rendering problem (IE browser on windows + php on linux host)
Hi All, If someone has seen this before it would greatly help me. I have done a php site at work on my windows server. The site renders perfectly in both Firefox & IE. Transferred my site to my home server which is a ubuntu server. Site renders perfect in Firefox but goes wacky in IE. Thought this might be an apache/php config problem on my ubuntu server so I tried to compare both my php.ini + apache config file and nothing works so far. Any Ideas? Erick P. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST superglobal empty, while readfile("php://input") does return data.
Nathan Nobbe schreef: On 11/3/07, Mackatack <[EMAIL PROTECTED]> wrote: Hey all! Im trying to submit a very basic form to phpinfo(): readfile: '; readfile("php://input") phpinfo(); ?> When i use the button to submit the form and it loads the new page I get: var_dump: array(0) { } readfile: foo=bar I would expect the $_POST var to be filled cause the readfile does work. Also, get requests, cookies and sessions do work... all cept for the POST data. I couldn't find any errors in the apache error_log. I think it's not browser related because I tested it another server and it did work using FF and IE7. Im using PHP Version 5.2.4_p20070914-pl2-gentoo, with suhosin and the ZendOptimizer on Linux AMD64. I've also set the max_post and max_upload to 1024M for testing... Nothing works... :( Does anyone have a direction for me? Been using php for years but have never seen anything like this... is this a new box? have you tried w/o suhosin and / or zend optimizer? did the other box you tested on have suhosin? -nathan Yes, this is a new box, but i did try without suhosin and the ZendOptimizer. No dice. -Mackatack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Generating HTML table from MySQL table based on some criteria
Sudheer Satyanarayana wrote: Wolf wrote: Sudheer, Post the code you are using and we'll better be able to point you in the right direction to get your code working. Thanks Jim Lucas, Wolf and Jay Blanchard for your suggestions. Here is the code I am using [code] print ''; $result = mysql_query("SELECT * FROM users where status=1 AND picture <> '' ORDER BY created DESC limit 20"); while ($user_info = mysql_fetch_object($result)) { $output .= ' http://example.com/'.$user_info->picture.'" height="90" > ' .''. $user_info->name .''; } print $output; print ''; [/code] The above code prints the pictures of last twenty users who have uploaded their pictures. Each picture is printed in an HTML table cell. The table has only one row. I want to split the HTML table into 4 rows each containing 5 cells. Each table cell should contain one user picture. How can I do this? PS: The DB column names are slightly different than I mentioned in my previous message. You forgot your ... html tags. This will break it up into different rows Wolf Sudheer Satyanarayana <[EMAIL PROTECTED]> wrote: Hello, I have a MySQL table with four columns - userid, created_date, username and path_to_picture. path_to_picture column contains the path to the image files of those users who have uploaded pictures. An example path stored in path_to_picture column is picture/username.png. There are some users that don't have their pictures uploaded. The column contains nothing for these usernames. I want to generate an HTML table with 20 recent users who have uploaded their pictures. Each row in the HTML table should contain 5 columns. Thus the HTML table would contain 4 rows. How can I accomplish this? I hope I have provided enough information to describe my problem. I would be glad to provide more details if required. I tried few permutations and combinations with ORDER BY and LIMIT clauses to no avail. I have been scratching my head from few hours to get this to work. Any help would be greatly appreciated. -- With Warm Regards, Sudheer. S http://www.binaryvibes.co.in -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_fetch_array
Eduardo Vizcarra wrote: I have a WHILE sentence to retrieve all records from a SELECT query in a database and am using mysql_fetch_array to store them in a matrix, the sentence is like this: while($row=mysql_fetch_array($fotos)) { $fotos_mostrar[] = $row; } $fotos contains all records found in a db table, the SELECT statement is retrieving 2 columns from a table, how do I store all records in a 2 dimention table so I can use it later ? this WHILE sentence seems to only store the last record only Regards how are you checking to see the contents of the $fotos_mostrar array() ? just after the while loop ends, do a var_dump() or print_r() on the array and view the contents. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST superglobal empty, while readfile("php://input") does return data.
Mackatack wrote: Nathan Nobbe schreef: On 11/3/07, Mackatack <[EMAIL PROTECTED]> wrote: Hey all! Im trying to submit a very basic form to phpinfo(): readfile: '; readfile("php://input") phpinfo(); ?> When i use the button to submit the form and it loads the new page I get: var_dump: array(0) { } readfile: foo=bar I would expect the $_POST var to be filled cause the readfile does work. Also, get requests, cookies and sessions do work... all cept for the POST data. I couldn't find any errors in the apache error_log. I think it's not browser related because I tested it another server and it did work using FF and IE7. Im using PHP Version 5.2.4_p20070914-pl2-gentoo, with suhosin and the ZendOptimizer on Linux AMD64. I've also set the max_post and max_upload to 1024M for testing... Nothing works... :( Does anyone have a direction for me? Been using php for years but have never seen anything like this... is this a new box? have you tried w/o suhosin and / or zend optimizer? did the other box you tested on have suhosin? -nathan Yes, this is a new box, but i did try without suhosin and the ZendOptimizer. No dice. -Mackatack What about checking to see if Apache has the the POST option disabled. Make sure the apache is allowing posts to the domain/directory/file/etc... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_fetch_array
Hi guys After doing some changes, I believe it is partially working, what I did is the following: while($row=mysql_fetch_array($fotos)) { $fotos_mostrar[] = $row; } $primer_foto = reset($fotos_mostrar[0]); // This is to set the pointer to the first record echo $primer_foto; // This displays the first column when doing a SELECT However, my SELECT statement retrieves 2 columns from one table, how do I display the second column ? Thanks Eduardo "Jim Lucas" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > Eduardo Vizcarra wrote: >> I have a WHILE sentence to retrieve all records from a SELECT query in a >> database and am using mysql_fetch_array to store them in a matrix, the >> sentence is like this: >> while($row=mysql_fetch_array($fotos)) >> { >>$fotos_mostrar[] = $row; >> } >> >> $fotos contains all records found in a db table, the SELECT statement is >> retrieving 2 columns from a table, how do I store all records in a 2 >> dimention table so I can use it later ? >> >> this WHILE sentence seems to only store the last record only >> >> Regards > how are you checking to see the contents of the $fotos_mostrar array() ? > > just after the while loop ends, do a var_dump() or print_r() on the array > and view the contents. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Rendering problem (IE browser on windows + php on linux host)
What about comparing the pure HTML output of both servers _including headers_, for example with curl? On 3 Nov 2007, at 23:46, Erick Paquin wrote: Hi All, If someone has seen this before it would greatly help me. I have done a php site at work on my windows server. The site renders perfectly in both Firefox & IE. Transferred my site to my home server which is a ubuntu server. Site renders perfect in Firefox but goes wacky in IE. Thought this might be an apache/php config problem on my ubuntu server so I tried to compare both my php.ini + apache config file and nothing works so far. Any Ideas? Erick P. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_fetch_array
Eduardo Vizcarra wrote: Hi guys After doing some changes, I believe it is partially working, what I did is the following: while($row=mysql_fetch_array($fotos)) { $fotos_mostrar[] = $row; } $primer_foto = reset($fotos_mostrar[0]); // This is to set the pointer to the first record echo $primer_foto; // This displays the first column when doing a SELECT if you notice you are referring to an index in your array. You should be doing the reset on $fotos_mostrar like this reset($fotos_mostrar); var_dump($fotos_mostrar); This will display the entire dataset. also, if you read the first line just above the first example of use, you will notice that it says that reset will return the first array element or false. The reason that you are getting the first column is because in your reset call, you are referencing the first index entry in your array. This would return you the first index of the first index in your array. NO, I did not just repeat myself. re-read what I wrote and think it through and it will make perfect sense. So, try what I showed you at the beginning of my comments and you will see the results you are wanting. However, my SELECT statement retrieves 2 columns from one table, how do I display the second column ? Thanks Eduardo "Jim Lucas" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] Eduardo Vizcarra wrote: I have a WHILE sentence to retrieve all records from a SELECT query in a database and am using mysql_fetch_array to store them in a matrix, the sentence is like this: while($row=mysql_fetch_array($fotos)) { $fotos_mostrar[] = $row; } $fotos contains all records found in a db table, the SELECT statement is retrieving 2 columns from a table, how do I store all records in a 2 dimention table so I can use it later ? this WHILE sentence seems to only store the last record only Regards how are you checking to see the contents of the $fotos_mostrar array() ? just after the while loop ends, do a var_dump() or print_r() on the array and view the contents. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php