Re: [PHP] array problems

2006-08-16 Thread Richard Lynch
On Wed, August 16, 2006 1:08 am, Chris G wrote: > while($line = mysql_fetch_array($result)) { > > $data1y[] = $line['rep_value_perc']; $dataly[][] = $line['rep_value_prec']; > > } > > This gives me just the one array from the above example, $datay1. How > would > > you dynamically create the all

Re: [PHP] array problems

2006-08-16 Thread John Wells
On 8/16/06, David Tulloh <[EMAIL PROTECTED]> wrote: Chris G wrote: foreach ($user_input_array as $user_input) { $data_member = array(); # Create an empty array Do SQL query stuff foreach ($sql_results as $sql_member) { $data_member[] = $sql_member;

Re: [PHP] array problems

2006-08-16 Thread David Tulloh
Chris G wrote: > Hi all > > Having a prob with a php script... > > 3 arrays > > $datay1=array(140,110,50,60); > > $datay2=array(35,90,190,190); > > $datay3=array(20,60,70,140); > > which have to be passed to a class like this > > $gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3));

Re: [PHP] array problems

2003-11-28 Thread Eugene Lee
On Thu, Nov 27, 2003 at 08:19:02PM -0500, Curtis Maurand wrote: : On Wednesday 26 November 2003 21:53, Marek Kilimajer mumble: : > Curtis Maurand wrote: : > > Sorry, its a typo. it should be: : > > : > > $city = "Ipswitch"; : > > $city_found = 0; : > > $contentfile = fopen("content.txt", "r"); : >

Re: [PHP] array problems

2003-11-28 Thread Marek Kilimajer
Curtis Maurand wrote: OK. That worked, thanks. Is it me, or is that rather odd behavior? It is you ;) Shouldn't array elements set within a loop be available to me outside the loop if the loop exits normally? A loop is not a function (well it is, sort of.) Should I declare the variable as

Re: [PHP] array problems

2003-11-28 Thread Jason Wong
On Friday 28 November 2003 16:03, [EMAIL PROTECTED] wrote: > I think what you got is a scope problem. You are creating $content_array > in your while loop so its scope is limited to the while loop. To test this > simply do a var_dump or print_r on $content_array outside your loop and > see if it a

Re: [PHP] array problems

2003-11-28 Thread SLanger
>$city = "Ipswitch"; >$city_found = 0; >$contentfile = fopen("content.txt", "r"); >while (!feof($contentfile) && $city_found == 0); > { >$my_line = fgets($contentfile, 16384); >$content_array = explode("\t",$my_line); >if ($content_array[0] == $city) > { >$city_foun

Re: [PHP] array problems

2003-11-27 Thread Curtis Maurand
OK. That worked, thanks. Is it me, or is that rather odd behavior? Shouldn't array elements set within a loop be available to me outside the loop if the loop exits normally? A loop is not a function (well it is, sort of.) Should I declare the variable as global? global $content_array; $

Re: [PHP] array problems

2003-11-27 Thread Curtis Maurand
Thank you, I'll try that. Curtis On Wednesday 26 November 2003 21:53, the council of elders heard Marek Kilimajer mumble incoherently: > Curtis Maurand wrote: > > Sorry, its a typo. it should be: > > > > $city = "Ipswitch"; > > $city_found = 0; > > $contentfile = fopen("content.txt", "r"); >

Re: [PHP] array problems

2003-11-26 Thread Marek Kilimajer
Curtis Maurand wrote: Sorry, its a typo. it should be: $city = "Ipswitch"; $city_found = 0; $contentfile = fopen("content.txt", "r"); while (!feof($contentfile) && $city_found == 0); { $my_line = fgets($contentfile, 16384); $content_array = explode("\t",$my_line); if ($content_array

Re: [PHP] array problems

2003-11-26 Thread Curtis Maurand
Sorry, its a typo. it should be: $city = "Ipswitch"; $city_found = 0; $contentfile = fopen("content.txt", "r"); while (!feof($contentfile) && $city_found == 0); { $my_line = fgets($contentfile, 16384); $content_array = explode("\t",$my_line); if ($content_array[0] == $city) {

Re: [PHP] array problems

2003-11-26 Thread Jason Wong
On Wednesday 26 November 2003 04:45, Curtis Maurand wrote: > consider the following code (content.txt is tab delimited). > > $city = "Ipswitch"; > $content = fopen("content.txt", "r"); > $city_found = 0; > while (!feof($content) && $city_found == 0) > { > $my_line = fgets($content, "r"); >

Re: [PHP] array problems

2003-11-25 Thread Marek Kilimajer
Curtis Maurand wrote: Hello, consider the following code (content.txt is tab delimited). $city = "Ipswitch"; $content = fopen("content.txt", "r"); $city_found = 0; while (!feof($content) && $city_found == 0) { $my_line = fgets($content, "r"); $content_array = explode("\t",$my_line);

Re: [PHP] array problems

2003-11-25 Thread Eugene Lee
On Tue, Nov 25, 2003 at 03:45:11PM -0500, Curtis Maurand wrote: : : Hello, : consider the following code (content.txt is tab delimited). : : $city = "Ipswitch"; : $content = fopen("content.txt", "r"); : $city_found = 0; : while (!feof($content) && $city_found == 0) : { : $my_line = fgets(

Re: [PHP] Array problems again

2002-05-17 Thread Jason Wong
On Friday 17 May 2002 21:20, Josh Edwards wrote: > Here's a sample of a weblog. I have a loop that extracts the request ie > "Get /A1.php > How do I get the top ten requests and how many time these were requested > after looping thru the whole file. Can you set up an array that is self > populati