Results 1 to 6 of 6

Thread: [RESOLVED] Simple question

  1. #1

    Thread Starter
    Hyperactive Member phrozeman's Avatar
    Join Date
    Apr 2000
    Location
    Netherlands
    Posts
    442

    [RESOLVED] Simple question

    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

    VB Code:
    1. if ($brand == "renault") {
    2.     $DealPic = "images/renault.gif";
    3.  }
    Last edited by phrozeman; Oct 12th, 2003 at 02:38 PM.
    There's a certain mystique when I speak, that you notice that it's sorta unique, cause you know it's me

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    What seems to be the problem? Do you get an error? Or are you simply not getting the results you expect?
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    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

    PHP Code:
    if(strtolower($band) == "renault") {
        
    $DealPic "images/renault.gif";


  4. #4
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Re: Simple question

    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

    VB Code:
    1. if ($brand == "renault") {
    2.     $DealPic = "images/renault.gif";
    3.  }
    If you truly want to REPLACE IT with another string, then your code would be:

    Code:
    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.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Besides, if your code and images keep following that logic, it would be MUCH faster to write
    $DealPic = "images/$brand.gif";
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6

    Thread Starter
    Hyperactive Member phrozeman's Avatar
    Join Date
    Apr 2000
    Location
    Netherlands
    Posts
    442
    Thanks guys, i already got it working, i made a spelling error and thats why it didn't work
    There's a certain mystique when I speak, that you notice that it's sorta unique, cause you know it's me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width