Jump to content

jquery gallery


Lacrimosa

Recommended Posts

Hey all,

 

I really need some help with my coding since i'm stuck with a problem I can't seem to solve.

 

I am currently working with a jquery gallery plugin, but instead of having the images in a folder on the server, I'd like to link to a database, and get them from a php script.

So far I've got this:

 

<?php

 

$dblink = mysql_connect("localhost", "mmd4a201105", "*******");

if (!$dblink)

{

echo "Forbindelse til database kunne ikke etableres".mysql_error();

exit;

}

 

$db = mysql_select_db ("mmd4a201105");

if (!$db)

{

echo "Databasen kunne ikke vælges".mysql_error();

exit;

}

 

 

$sql_streng = "select titel, navn, mail, tekst, fotonavn from foto";

 

$resultat = mysql_query ($sql_streng, $dblink);

$antal_raekker = mysql_num_rows($resultat);

 

if ($antal_raekker == 0)

{

echo "Der er ingen fotos at vise!";

}

else

{

while ($raekke = mysql_fetch_assoc($resultat))

{

echo "<img src=\"fotos/$raekke[fotonavn]\" alt=\"fotos/$raekke[fotonavn]\" width=\"75px\" height=\"75px\" title=\"$raekke[titel] /><br><br>";

 

}

}

 

mysql_close ($dblink);

?>

 

The gallery currently only displays the first image in the database table but I like it to display all images on the database... loop function perhaps, I'm not sure that's what the term is called?

 

Appreciate any help, and sorry if it's a bit confusing. I'll gladly specify anything required. :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.