Re: Working with variables and MySQL
- From: Ar <Ar@xxxxxxxxx>
- Date: 20 May 2008 21:13:02 GMT
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.
.
- References:
- Working with variables and MySQL
- From: Ar
- Re: Working with variables and MySQL
- From: No_One
- Working with variables and MySQL
- Prev by Date: Re: Full Range ?
- Next by Date: php: how to render xml as xls/odt
- Previous by thread: Re: Working with variables and MySQL
- Next by thread: Please, endorse my new php class library and get license free
- Index(es):
Relevant Pages
|