Re: Working with variables and MySQL



On Tue, 20 May 2008 10:18:27 -0500, No_One wrote:

Firstly, thank you very much for helping me, it was more than enough to
help me out of a hole.

while ($row = @mysql_fetch_array($theresults)) would normally be:

while ($row = @mysql_fetch_array($theresults,MYSQL_ASSOC))

assigning variable names to the output isn't necessary:

This I did not know, I was following some examples from books and googled
examples. This on it's own saves loads of typing.

As for the second bit and displaying entries, I have the code looking
like below, which deals with all rows and columns without having to do
loads of typing. It's a bit messy, but it does it's job.


$Iterations = 1;

while ($row = @mysql_fetch_array($theresults,MYSQL_ASSOC))
{

while ($Iterate <= 10) //number of results per row
{
if ($row['Result'.$Iterate] == 44) $row['Result'.$Iterate]="Cancelled";
if ($row['Result'.$Iterate] == 55) $row['Result'.$Iterate]="NQ";
$Iterations++;
}

$display_entry .= "$row[EnteredNumber], $row[Result1]<BR>";

$Iterations = 1;
}


This will display all the results as normal, plus substitute any number
44 or 55 with their respective text entries into the table on the webpage.

Thanks again for your help.
.



Relevant Pages

  • Re: Most reliable USB ADSL modem?
    ... would be loads of posts with unsuitable suggestions that then need ... I just had a quick crack at typing it all out but ... one power socket that can be dedicated to the gear, ... What would be ideal in that situation would be a hardware ADSL modem on a ...
    (uk.comp.os.linux)
  • Re: OT: MacBook
    ... Yep, fond memories of my ZX81, Spectrum, BBCb, CPM, DOS days, typing ... loads of stuff in, luckily we have moved on now ... ...
    (uk.rec.motorcycles)
  • Re: iWork 08 trial
    ... typing text results in a bit of a ... 1Ghz iLamp with 768Mb and loads of apps open. ... I *have* to download the trial version. ... which actually is IMHO a quite nice DTP app for ...
    (uk.comp.sys.mac)
  • Certain websites taking too long to "load"
    ... >From either clicking on a Google search link, ... typing "www.dishnetwork.com" in the address line, ... minutes go by before Dish Network's site finally loads. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)