Page 1 of 1

really weird stupid question

Posted: Sun Apr 04, 2004 11:42 am
by John Cartwright

Code: Select all

<?php
    while ( $row = mysql_fetch_array($result)) { 
	$lifetimeL  = $row["Life Time License"]; 
	$oneyearL   = $row["1 Year License"]; 
	$AB100      = $row["AB100"]; 
	$AB150      = $row["AB150"]; 
	$copywright = $row["copywright"];
	}
?>
There is 1 row in my table which holds the price of these items.
For some reason they all work when I echo them except AB100 and AB150...... I know there is information in it and it is just boggling my mind why it wont work :S : S :S

Anyone have any ideas?

Posted: Sun Apr 04, 2004 5:01 pm
by TheBentinel.com
What do you get if you use numbers instead of names for your array elements? $row[0], $row[1], etc. Maybe the names are slightly different than in your code. At least you'll see if you're pulling the data from the db or not.

Posted: Sun Apr 04, 2004 10:26 pm
by John Cartwright
the names r exackly the same, I copied and pasted them a million times.. but yea I'll try it your way.. ty

Posted: Mon Apr 05, 2004 1:27 am
by Drayton
<?php
while ( $row = mysql_fetch_array($result)) {
$lifetimeL = $row[Life Time License];
$oneyearL = $row[1 Year License];
$AB100 = $row[AB100];
$AB150 = $row[AB150];
$copywright = $row[copywright];
}
?>


try this one, i just remove the double quotations...

Posted: Mon Apr 05, 2004 1:38 am
by andre_c
... just curious, what would removing the quotations do? From my understanding it's better to have the quotations to not cause problems with constants.

Posted: Mon Apr 05, 2004 1:39 am
by markl999
Yeah, keep the single quotes, without them you may get 'clashes' with defined vars.

Drayton, what's all the bold about? ;)

Posted: Mon Apr 05, 2004 1:44 am
by Drayton
Sorry bro! i didn't know its not allowed to make my font bold. tanx for reminding me. i haven't read yet the rules b4 posting a reply! i appreciate your reminder! tanx!

Posted: Mon Apr 05, 2004 1:51 am
by compound_eye
you've spelled copywrite incorrectly, is that causing any trouble?

i like to run queries in sql control centre, to see what data i get back when i have problems, that way i get to see the data that comes back, and can isolate sql problems from php problems,

i'm suspicious of the spaces in your field names eg 'Life Time License', that could be causing trouble,

cheers
mat

Posted: Mon Apr 05, 2004 4:07 am
by twigletmac
Check what's being returned by the database:

Code: Select all

echo '<pre>';
print_r($row);
echo '</pre>';
Mac

Posted: Wed Apr 07, 2004 3:27 am
by compound_eye
i meant copyright :)