Jump to content

I'm almost there yipee! But...


Novice@PHP

Recommended Posts

Hey everyone hope you're fingers aren't too tired after all your hard days coding.  8)

 

I've just coded a lot of a web application but have hit a dead end in regards of calling an image forward.

 

The code uses a name stored in the database to check for a picutre named the same as what the value is in the databse.

 

The problem is I can't figure out how to get it toc check for and disaply the image.

 

The term "refer" in the code is what I need to be able to add .gif .jpg or .png to. So it can check and display the correct image.

 

<?php
      if (file_exists("logos/".$product["refer"]))
      {
        print "<a target='_BLANK' href='".tapestry_buyURL($product)."'><img border='0' src='".$config_baseHREF."logos/".$product["refer"]."' alt='".$product["name"]."' /></a>";
      }
      else
      {
        print " ";
      }
      
?>

 

All help is appreciated.

 

Also just to note I'm still a total noob so if my explanation doesn't make much sense I'll be more than glad to hear some advice on what way I should say this and answers any questions.

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/203306-im-almost-there-yipee-but/
Share on other sites

I don't really understand... Like this?

if (file_exists("logos/".$product["refer"].".png"))

 

Yes that's it and the second part where refer appears is like the same?

 

<img border='0' src='".$config_baseHREF."logos/".$product["refer"]."' alt='".$product["name"]."' />

 

Also I knew it would be hard to understand me. I'm only really new to PHP and knownone of the terminology. I just lern by looking through other peeps code.

 

Thanks.

I don't really understand... Like this?

if (file_exists("logos/".$product["refer"].".png"))

 

Thank you so much. That's it and working up until the  second part where refer appears. Do you know what to put in the line below also?

 

<img border='0' src='".$config_baseHREF."logos/".$product["refer"]."' alt='".$product["name"]."' />

 

Also I knew it would be hard to understand me. I'm only really new to PHP and know none of the terminology. I just learn by looking through other peeps code.

 

Thanks.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.