RottNKorpse
Technical User
- Aug 8, 2006
- 13
Here's what I am trying to do...I am trying to make a hyperlink and an image source reference my sql database.
Lets say the table I am using has 3 fields in it which would be "Name", "MyURL" and "MyImage" hopefully the names of the fields dont matter because I will prolly change them later but for now thats what they are.
Now I want my page to display the following code:
<a href="<?=$pageheaderurl?>"><img src="<?=$pageheaderimage?>" border="0"></a>
I will have MANY rows in this table for different images and urls but I need to be able to reference one single row and have the link url and image url for a specific name on the page I am working on. It doesnt have to be dynamic in the sense of automaking the pages for this.
For Example:
Name=John
MyURL=http://fakeurl.com/image.jpg
MyImage=
I want <a href="<?=$pageheaderurl?>"> to only reference the data in the MyURL field for the name John and to not look at the other rows at all. Also the same thing for <img src="<?=$pageheaderimage?>" border="0"> with only referencing "John".
The sqlquery I tried didnt work as I was basically taking a guess on how it might work but since it didnt I gotta request some help.
Here is the query I used:
$pageheaderimagequery="SELECT name, myimage FROM pageheaders WHERE name = John";
$pageheaderimageresult=mysql_query($pageheaderimagequery);
$pageheaderimage=mysql_result($pageheaderimageresult,$i,"image_url");
$pageheaderurlquery="SELECT name, myurl FROM pageheaders WHERE name = John";
$pageheaderurlresult=mysql_query($pageheaderurlquery);
$pageheaderurl=mysql_result($pageheaderurlresult,$i,"link_url");
so could anyone help me out on this? I would really appreciate any help I can get.
Thanks,
RottNKorpse
Lets say the table I am using has 3 fields in it which would be "Name", "MyURL" and "MyImage" hopefully the names of the fields dont matter because I will prolly change them later but for now thats what they are.
Now I want my page to display the following code:
<a href="<?=$pageheaderurl?>"><img src="<?=$pageheaderimage?>" border="0"></a>
I will have MANY rows in this table for different images and urls but I need to be able to reference one single row and have the link url and image url for a specific name on the page I am working on. It doesnt have to be dynamic in the sense of automaking the pages for this.
For Example:
Name=John
MyURL=http://fakeurl.com/image.jpg
MyImage=
I want <a href="<?=$pageheaderurl?>"> to only reference the data in the MyURL field for the name John and to not look at the other rows at all. Also the same thing for <img src="<?=$pageheaderimage?>" border="0"> with only referencing "John".
The sqlquery I tried didnt work as I was basically taking a guess on how it might work but since it didnt I gotta request some help.
Here is the query I used:
$pageheaderimagequery="SELECT name, myimage FROM pageheaders WHERE name = John";
$pageheaderimageresult=mysql_query($pageheaderimagequery);
$pageheaderimage=mysql_result($pageheaderimageresult,$i,"image_url");
$pageheaderurlquery="SELECT name, myurl FROM pageheaders WHERE name = John";
$pageheaderurlresult=mysql_query($pageheaderurlquery);
$pageheaderurl=mysql_result($pageheaderurlresult,$i,"link_url");
so could anyone help me out on this? I would really appreciate any help I can get.
Thanks,
RottNKorpse