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
https://forums.phpfreaks.com/topic/253248-jquery-gallery/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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