...

View Full Version : Help! I need to grab url from DB!



activewebdesign
08-13-2008, 05:19 PM
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


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,

mlseim
08-13-2008, 05:56 PM
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?

activewebdesign
08-13-2008, 05:58 PM
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.

mlseim
08-13-2008, 05:59 PM
Type an example of what that link should look like, pretend the image is called "hair.jpg".

activewebdesign
08-13-2008, 06:01 PM
<a href="http://www.rate-this.org/hair"><img src="hair.jpg"></a>

mlseim
08-13-2008, 06:30 PM
<a href="http://www.rate-this.org/hair"><?=$dpic?></a>

activewebdesign
08-13-2008, 06:33 PM
Thanks a bunch!!!

I owe you

activewebdesign
08-13-2008, 06:41 PM
<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?

mlseim
08-13-2008, 06:46 PM
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.




.

activewebdesign
08-13-2008, 06:49 PM
OK thanks right the last bit i need is this


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?

mlseim
08-13-2008, 06:58 PM
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.

mlseim
08-13-2008, 07:08 PM
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 " />



.

activewebdesign
08-13-2008, 07:22 PM
Thanks!

I have got it all working tbh its GREAT!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum