FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Multiple <a> Tags, Filled With MySQL DB data with PHP
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Multiple <a> Tags, Filled With MySQL DB data with PHP [message #179228 is a reply to message #179225] Tue, 25 September 2012 18:26 Go to previous messageGo to previous message
tom.rankin51 is currently offline  tom.rankin51
Messages: 17
Registered: September 2012
Karma:
Junior Member
I'm not sure what you mean. I think my source is correct yes, hence why I can't figure out the problem. As far as my knowledge extends, the php code I provided does exactly the same as the collection of <a> tags - but it produces completely different results.

I have already noted that my php code will produce four thumbnails which I have accounted for, however it i this code which will load the first image in a new page and not display facebook share links.

Tom

On Tuesday, September 25, 2012 7:21:50 PM UTC+1, Jerry Stuckle wrote:
> On 9/25/2012 1:43 PM, tom(dot)rankin51(at)googlemail(dot)com wrote:
>
>> Hello
>
>>
>
>> I am trying to create two image galleries using fancybox. There is no issue doing this by manually typing out a bunch of <a> tags with the info inside, but when I attempt to code a piece of PHP to pull this data from my database, it doesn't like it and displays the images strangely.
>
>>
>
>> The "working" code is:
>
>>
>
>> <a class="fancybox" rel="1" href="/image4.jpg" title="Title 1"><img src="thumbnail.jpg"></a>
>
>> <a class="fancybox" rel="1" href="/image3.jpg" title="Title 2"></a>
>
>> <a class="fancybox" rel="2" href="/image2.jpg" title="Title 3"><img src="thumbnail.jpg"></a>
>
>> <a class="fancybox" rel="2" href="/image1.jpg" title="Title 4"></a>
>
>>
>
>> This essentially groups the images by the 'rel' tag automatically, showing two thumbnails which when clicked shows the corresponding images in descending order (ie last added).
>
>>
>
>> In my database I have created a 'rel' field and populated it with either "1" or "2", and tried the following:
>
>>
>
>> <!-- START OF PHP SCRIPT (DB OPEN)-->
>
>> <?
>
>> include("php/dbinfo.inc.php");
>
>>
>
>> mysql_connect($hostname,$username,$password);
>
>> @mysql_select_db($database) or die( "Unable to select database");
>
>>
>
>> $visuals_query=mysql_query("SELECT id, imagelink, comment, picdate, rel FROM PictureMedia ORDER BY picdate DESC");
>
>>
>
>> mysql_close();
>
>> ?>
>
>> <!-- END OF PP SCRIPT (DB OPEN) -->
>
>>
>
>> <?
>
>> while($r=mysql_fetch_assoc($visuals_query)) {
>
>> echo '<a class="fancybox" rel="'.$r["rel"].'" href="'.$r["imagelink"].'" title="'.$r["comment"].'"><img src="thumbnail.jpg"></a>';
>
>> }
>
>> ?>
>
>>
>
>> Now, I think that this should do exactly the same thing, other than showing four thumbnails obviously. What actually happens is that the first thumbnail loads the last added image in a new page, then the other three as expected but with the focus on the picture displayed by the query. It also did not show a Facebook share button when using PHP.
>
>>
>
>> I understand that this issue isn't all down to PHP, but may be down to the fancybox script. However, I can't post in two groups simultaneously so if my code looks correct then I can go along another route.
>
>>
>
>> Thanks in advance
>
>> Tom
>
>>
>
>
>
> Look at the source code in your page - does it look correct?
>
>
>
> --
>
> ==================
>
> Remove the "x" from my email address
>
> Jerry Stuckle
>
> JDS Computer Training Corp.
>
> jstucklex(at)attglobal(dot)net
>
> ==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Dynamic Links (MySQL/PHP)
Next Topic: Advice for Literature on PHP-Based Web Development Business Models
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 09 23:46:50 GMT 2024

Total time taken to generate the page: 0.05195 seconds