[PHP] problem with mysql_fetch_array
i am trying to print some values from a table with using mysql_fetch_array in a loop but not able to get correct values. it works fine for the loop i=0, prints all desired values but when it bocomes i=1 and starts the loop again the result values gets reset and prints the same old values. for example: outout of the query is result 1 result 2 result 3 result 4 result 5 result 6 result 7 result 8 result 9 result 10 result 11 result 12 :when i=0, it runs through the loop and prints result 1 result 2 result 3 result 4 result 5 result 6 :which is perfect. :but when i=1, it prints the same values, result 1 result 2 result 3 result 4 result 5 result 6 why is that so? can anyone help me? thanks in advance. $query4 = mysql_query("SELECT result FROM TBL_result WHERE survey_no=2"; for($i=0; $i < 2; ++$i)//surveys { for($j=0; $j < 2; ++$j)//questions { for ($k=0; $k < 3; ++$k)//sub-quesions { $row2 = mysql_fetch_array($query4); //Printing all result values one by one } } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with mysql_fetch_array
$query4 = mysql_query("SELECT result FROM TBL_result WHERE survey_no=2"; while($row2 = mysql_fetch_array($query4)) { //print array } this will print whole array. i just want to print a row at a time and it should be in the loop because i am printing other things as well. can you tell me how to print a row at a time. actually as i explained earlier, i am able to print a row at a time but when it becomes i=1 and starts outer loop for the second time it just printing the same values. any suggestion? thanks, deepak Justin Patrin wrote: On Wed, 11 Aug 2004 17:13:49 -0400, Deepak Dhake <[EMAIL PROTECTED]> wrote: i am trying to print some values from a table with using mysql_fetch_array in a loop but not able to get correct values. it works fine for the loop i=0, prints all desired values but when it bocomes i=1 and starts the loop again the result values gets reset and prints the same old values. for example: outout of the query is result 1 result 2 result 3 result 4 result 5 result 6 result 7 result 8 result 9 result 10 result 11 result 12 :when i=0, it runs through the loop and prints result 1 result 2 result 3 result 4 result 5 result 6 :which is perfect. :but when i=1, it prints the same values, result 1 result 2 result 3 result 4 result 5 result 6 why is that so? can anyone help me? thanks in advance. $query4 = mysql_query("SELECT result FROM TBL_result WHERE survey_no=2"; for($i=0; $i < 2; ++$i)//surveys { for($j=0; $j < 2; ++$j)//questions { for ($k=0; $k < 3; ++$k)//sub-quesions { $row2 = mysql_fetch_array($query4); //Printing all result values one by one } } } I'm not sure what you think this should do, but you're assuming that 2 * 2 * 3 (12) records will be returned, no more, no less. I doubt this is the case. Normally, such things are done like this: $query4 = mysql_query("SELECT result FROM TBL_result WHERE survey_no=2"; while($row2 = mysql_fetch_array($query4)) { //print array } If this isn't what you want, perhaps you should be doing 3 seperate queries in there? Please explain why you have 3 for loops around your fetch; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GD installation problem
Can anyone tell me how to install GD 2.0.28 (which support GIF) with php? Can you tell me all the instructions to follow? Thanks, _deepak -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help in php script
I have a following PHP file TimeRotateImage.php which prints an image = 6 and $curr_time[2] <= 17) { PRINT IMAGE_1; } else { PRINT IMAGE_2; } ?> I want to use this script in another file to display the image. the tag should be But i am not getting any output if i follow the above procedure. Can you tell me how to do it? I have to have the script TimeRotateImage.php which calculates which image to print accoring to local time and i want to embed the file name in html tag to print it on screen. thanks in advance. deepak -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help in php script
PRINT is nothing but... TimeRotateImage.php = 6 and $curr_time[2] <= 17) { print ""; } else { print ""; } ?> this script (something like this) should be called from another script like, "; ?> did you get what i am saying? please let me know if you have some solution. thanks Klaus Reimer wrote: Deepak Dhake wrote: But i am not getting any output if i follow the above procedure. Can you tell me how to do it? I have to have the script TimeRotateImage.php which calculates which image to print accoring to local time and i want to embed the file name in html tag to print it on screen. It's not clear what your PRINT macros are doing. Maybe you forgot to send the content-type-header? Or maybe there is a script error which is not displayed when you call the page inside a image tag. Call the script directly in your browser to see what's going on. If it outputs binary data then everything is working but you forgot the content-type header. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to load PDF file page by page
Hello all, Can anyone tell me how to read large PDF file and outputs it but the PDF file should load page by page before it completely downloads. Thanks in advance! Deepak -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to load PDF file page by page
Hi Richard, There is a concept called "byte-serving" with you can control the loading of PDF file using PHP. I am not very sure how to do it. If you get a chance to look into it then please let me know. Thanks, Deepak Richard Lynch wrote: Deepak Dhake wrote: Can anyone tell me how to read large PDF file and outputs it but the PDF file should load page by page before it completely downloads. I think that's more of an Adobe question than PHP, really... I vaguely recall that you could make this happen (only?) if you were using not just a plain PDF, but a PDF with PDI (FDI???) where, essentially, your PDF file references *other* PDF files, and those get sucked down separately. Note that this is the big-time feature where you have to PAY MONEY for libPDF and similar products, as I recall. IE, without this feature, it was free/cheap, but if you wanted this, you'd pay (more). Since I never needed this feature, I only skimmed through it all, and could be completely wrong. Also note that, almost for sure, when you send out the "main" PDF, and then that PDF sucks down all the other PDFs, you are really chewing up a *LOT* of HTTP connections opening and closing. Seems kind of expensive to me for the sake of showing the user one page/part of a giant PDF in advance... At that point, it seems to me you'd better serve the end user by having separate PDF files, if at all possible, and let them download the parts they want, or just warn them it will be awhile to download... YMMV NAIAA IANAL It's REAL easy to bloat PDF files very fast, and having monster PDF files seems like a Bad Idea (tm) to me, in general. I'm sure there are specific cases where it's the Right Answer and your needs may well be one of them -- I just want to make sure you understand the ramifications before you go down the garden path. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php