Re: Working with variables and MySQL
- From: No_One <no_one@xxxxxxxxxxxx>
- Date: Tue, 20 May 2008 10:18:27 -0500
On 2008-05-20, Ar <Ar@xxxxxxxxx> wrote:
I have a MySQL database table that keeps track of lots of numbers for
event outcomes.
For simplicilty, and to make it easy for arithmetic work, and to keep the
database small, all the variables are of type integer. However, I have
entered into the tables scores that that are not normally expected to
indicate specific conditions, like (integer) 44 for example meaning
"Event Cancelled" etc.
While I have no problem reading the MySQL table row data out into a
webpage (see code below), I do not know how to do text substitutions
WITHOUT changing the database data, ie. only substitute as it's being
read out of the database. I'm still very sketchy on arrays, and that's
what's causing the problem for me.
So I have something like the following;
while ($row = @mysql_fetch_array($theresults))
{
$Theid = $row['EnteredNumber'];
$1stresult = $row['Finished1'];
$2ndresult = $row['Finished2'];
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:
$display_entry .= "$row[EnteredNumber], $row[Finished1]<BR>";
and finally, maybe
if($row['Finished2']=44)
$row['Finished2']="Cancelled";
assuming you don't have to make too many of these changes.
ken
.
- Follow-Ups:
- Re: Working with variables and MySQL
- From: Ar
- Re: Working with variables and MySQL
- From: No_One
- Re: Working with variables and MySQL
- References:
- Working with variables and MySQL
- From: Ar
- Working with variables and MySQL
- Prev by Date: Please, endorse my new php class library and get license free
- Next by Date: Re: Working with variables and MySQL
- Previous by thread: Working with variables and MySQL
- Next by thread: Re: Working with variables and MySQL
- Index(es):
Relevant Pages
|