Click to See Complete Forum and Search --> : [RESOLVED] Simple question
phrozeman
Oct 8th, 2003, 05:41 AM
How can i compare values?
i need to check the brandname, and replace it with another string (a image path). Is this code below correct? becouse it aint working here :(
and i am very new to php ;)
if ($brand == "renault") {
$DealPic = "images/renault.gif";
}
techgnome
Oct 8th, 2003, 08:26 AM
What seems to be the problem? Do you get an error? Or are you simply not getting the results you expect?
Chroder
Oct 8th, 2003, 02:29 PM
Perhaps you've got a capitalization in $brand and you didn't carry the same capitalization through into the test string. Convert them both to lowercase and see if it works
if(strtolower($band) == "renault") {
$DealPic = "images/renault.gif";
}
The Hobo
Oct 11th, 2003, 05:44 PM
Originally posted by phrozeman
How can i compare values?
i need to check the brandname, and replace it with another string (a image path). Is this code below correct? becouse it aint working here :(
and i am very new to php ;)
if ($brand == "renault") {
$DealPic = "images/renault.gif";
}
If you truly want to REPLACE IT with another string, then your code would be:
if ($brand == "renault") {
$brand = "images/renault.gif";
}
That would be replacing it (the $brand) with something else. In your example, you're just creating another variable based on what $brand is.
CornedBee
Oct 12th, 2003, 08:05 AM
Besides, if your code and images keep following that logic, it would be MUCH faster to write
$DealPic = "images/$brand.gif";
phrozeman
Oct 12th, 2003, 02:37 PM
Thanks guys, i already got it working, i made a spelling error and thats why it didn't work :D
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.