really weird stupid question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

really weird stupid question

Post 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?
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Post 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.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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
User avatar
Drayton
Forum Newbie
Posts: 24
Joined: Thu Apr 01, 2004 2:14 am

Post 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...
User avatar
andre_c
Forum Contributor
Posts: 412
Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah

Post 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.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Yeah, keep the single quotes, without them you may get 'clashes' with defined vars.

Drayton, what's all the bold about? ;)
User avatar
Drayton
Forum Newbie
Posts: 24
Joined: Thu Apr 01, 2004 2:14 am

Post 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!
compound_eye
Forum Newbie
Posts: 15
Joined: Wed Mar 17, 2004 8:42 pm

Post 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
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Check what's being returned by the database:

Code: Select all

echo '<pre>';
print_r($row);
echo '</pre>';
Mac
compound_eye
Forum Newbie
Posts: 15
Joined: Wed Mar 17, 2004 8:42 pm

Post by compound_eye »

i meant copyright :)
Post Reply