Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    New Coder
    Join Date
    Aug 2008
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Help! I need to grab url from DB!

    I have hit a problem,

    I am trying to grab the picture url from my DataBase.

    Its for www.rate-this.org/hair the picture is shown using

    PHP Code:
    while($obj=mysql_fetch_object($res))
        {
            if(
    $obj->url=="")
            {
                
    $dpic="<img border=0 width=250 src='pics/$obj->filename'>";
            }
            else
            {
                
    $dpic="<img src='$obj->url'>"
    I think,

    Can someone help me please?

    I need it to show the url at the end of a code.

    So i have something like this <input>www.rate-this.org/hair<?php echo PHOTOURL HERE?>

    Thank you,

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,500
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    I don't understand this line:
    So i have something like this <input>www.rate-this.org/hair<?php echo PHOTOURL HERE?>

    Are you trying to display the line, or actually display the photo, or display a link?
    I don't know what <input> is for and the URL and then the URL for a photo?

  • #3
    New Coder
    Join Date
    Aug 2008
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Sorry i mean to have the code in a text box.

    And so it displays a html code people can copy and paste.

    The code will show the image.

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,500
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Type an example of what that link should look like, pretend the image is called "hair.jpg".

  • #5
    New Coder
    Join Date
    Aug 2008
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts
    <a href="http://www.rate-this.org/hair"><img src="hair.jpg"></a>

  • #6
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,500
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    <a href="http://www.rate-this.org/hair"><?=$dpic?></a>

  • #7
    New Coder
    Join Date
    Aug 2008
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks a bunch!!!

    I owe you

  • #8
    New Coder
    Join Date
    Aug 2008
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts
    PHP Code:
    <input type="text" onclick="track('forum1');highlight(this)" style="width: 500px" size="70" value="<a href="http://www.rate-this.org/body/index.php?username=<?php echo $username?><?=$dpic?></a>"/>

    I am using this on www.rate-this.org/body

    but for some reason its not showing how i want it to

    What can i do?

  • #9
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,500
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    This is what your line looks like in your HTML:

    <a href="http://www.rate-this.org/body/index.php?username=Shroom<img border=0 width=250 src='pics/ShroomBCRDU.jpg'></a>"/>

    You can see that the PHP was inserted into the wrong place.

    It should be like this instead:

    <a href="http://www.rate-this.org/body/index.php?username=Shroom"/><?=$dpic?></a>

    EDIT:
    ... or this might work better (there is a quote problem) ...

    This now looks correct ...
    <input type="text" onclick="track('forum1');highlight(this)" style="width: 500px" size="70" value="<a href='http://www.rate-this.org/body/index.php?username=<?php echo $username?>'><?=$dpic?></a>" />

    sorry about that.




    .
    Last edited by mlseim; 08-13-2008 at 06:55 PM.

  • #10
    New Coder
    Join Date
    Aug 2008
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts
    OK thanks right the last bit i need is this

    PHP Code:
    while($obj=mysql_fetch_object($res))
        {
            if(
    $obj->url=="")
            {
                
    $dpic="<img border=0 width=250 src='pics/$obj->filename'>";
            }
            else
            {
                
    $dpic="<img src='$obj->url'>"
    Atm dpic shows as <img border=0 width=250 Then the Img URL in ma code.

    How fix this?

  • #11
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,500
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    See my previous post ... I found a quote problem after you must have
    gone back and did some coding ... see if the blue text works properly.

  • #12
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,500
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    I assume you're trying to get the link to appear as a line of text ...
    something that a person can copy and paste to their own website?

    What exactly is the "Share this photo" supposed to do?

    Is it a link that I cut and paste, or will you have it be some
    sort of image? Don't forget that you can use PHP to
    automatically put a "Rate-This.org" watermark on each photo.
    (Using PHP GD functions)


    EDIT AGAIN ...

    Your trouble is with double quotes ...

    <input type="text" value=" anything in here needs to have single quotes " />



    .
    Last edited by mlseim; 08-13-2008 at 07:20 PM.

  • #13
    New Coder
    Join Date
    Aug 2008
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks!

    I have got it all working tbh its GREAT!!


  •  

    Posting Permissions

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