not able to retrieve numeric entries

not able to retrieve numeric entries

am 08.12.2006 05:27:02 von Mwahahahahaaahaa

Hello all.. here is my prob.. i have a dbase with a table with a few
values such as days, start, whoadded, and 1-31 as entries. I can
succesfully load a dbase and table and retrieve the first couple values
like days and start etc.. but when it comes to loaded a numeric value,
it doesn't echo anything. I've tried:

echo $row[1];
echo $row['1'];

$a = "1";
echo $a

All these things I tried to no avail. Can someone please tell me what
I'm doing wrong? The tutorials I read didn't specify too much how to
handle integers (if that's what's wrong)..
Thanks!!

p.s. here is a snippet of code... the days,start,whoadded works.. just
not the other values (1,2,3, etc ill 31)

dayCounter = 1;
$StartPos = 3;
$numOfDays = 31;
$whatTable = $Table;
$tempStr = "Select * FROM ";
$queryString = ($tempStr . $whatTable);
mysql_connect("localhost", $User, $Pass) or die(mysql_error());
mysql_select_db($dBase) or die(mysql_error());

$result = mysql_query($queryString) or die(mysql_error());
$row = mysql_fetch_array( $result );
$numOfDays = $row['days'];
$StartPos = $row['start'];
$whoAdded = $row['whoadded'];
echo $row['1'];

Re: not able to retrieve numeric entries

am 08.12.2006 06:58:58 von Shion

Mwahahahahaaahaa wrote:
> Hello all.. here is my prob.. i have a dbase with a table with a few
> values such as days, start, whoadded, and 1-31 as entries. I can
> succesfully load a dbase and table and retrieve the first couple values
> like days and start etc.. but when it comes to loaded a numeric value,
> it doesn't echo anything. I've tried:
>
> echo $row[1];

This should output the second column in the row.


> echo $row['1'];

This should output the column called 1.
Using a number as a column name is a really bad idea.



//Aho

Re: not able to retrieve numeric entries

am 08.12.2006 13:46:02 von Mwahahahahaaahaa

I guess I should rename all the numbers to the way they are spelled..
i.e. "one".

Re: not able to retrieve numeric entries

am 08.12.2006 13:48:14 von Shion

Mwahahahahaaahaa wrote:
> I guess I should rename all the numbers to the way they are spelled..
> i.e. "one".

It can be a really good idea to rename the columns to have the names of the
numbers instead of using the numbers.


//Aho