Jump to content


Photo

php & XML gallery


  • Please log in to reply
31 replies to this topic

#1 darkson01

darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 28 January 2007 - 05:02 PM

ok can you guys check over these because i have no idea why they won't work! :)

PHP
<?php$conn = mysql_connect("localhost","username","password");$db = mysql_select_db("database");echo "<?xml version=\"1.0\" encode=\"UTF-8\"?>";echo "<firstChild>";$select = mysql_query("SELECT * FROM `Scotland` ORDER BY `id` ASC") or die(mysql_error());whilte($row = mysql_fetch_array($select)); {echo "<picture image=\"".$row[""]."\";}echo "</firstChild>";?>

Flash

image of the database is attached <_< i just have no idea!

Attached Files



#2 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 28 January 2007 - 05:10 PM

Well the first thing I noticed was your PHP code. Instead of writing 'while' you wrote 'whilte'.

Also, the Flash, the variable is GalleryPictures, yet you rewrote it in other area's galleryPictures.

Edited by Ben, 28 January 2007 - 05:14 PM.


#3 darkson01

darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 28 January 2007 - 05:46 PM

:)

sorry, stupid mistakes there. but i've change them and still nothing's working. can you spot any thing wrong in there that's stopping it from working?

#4 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 28 January 2007 - 07:27 PM

In your PHP, the while loop is cancelled by a semicolon ";". Remove it.

Also, in your Flash function (GenerateGallery) the parameter on the function has three L's in it, not 2.

#5 darkson01

darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 29 January 2007 - 07:24 AM

still not working :flower4u: sorry for not seeing the typos, happens alot cause im dyslexic

#6 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 29 January 2007 - 08:51 AM

Try removing the galleryPictures variable and replace everywhere it's written with the value. I've tried it before and it never worked for me.

If it comes down to it and you still haven't got it working, I have a ready made XML + Flash image gallery that works perfectly.

Edited by Ben, 29 January 2007 - 08:52 AM.


#7 darkson01

darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 29 January 2007 - 09:03 AM

naw no change man!
this is bugging me so much!
it's like the main thing about this site! :(

is there any chance you can send me your xml gallery and maybe give us a hand helping make that able to load images from the database? pretty please? :flower4u:

#8 Pax

Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 29 January 2007 - 09:14 AM

Have you looked into having the php just send the data it gets from the database right into flash? Seems to me youre doing far too much work here...

You query the database, write an xml file, load the xml file, parse the xml file then make the image gallery... why not query the database and send an object/array into flash and loop it to create your image gallery :flower4u: Looks like 1/2 the work to me!

AMFPHP mate. I have a working setup for an image gallery if you need help...amfphp can be a pain to setup sometimes.

#9 darkson01

darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 29 January 2007 - 09:29 AM

setting amfphp is actually the thing thats putting me off it, if you culd help me set up it up that would be AMAZING!

#10 Pax

Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 29 January 2007 - 10:29 AM

For sure...give it a go, and if you run into any problems, post here and I can give you a hand. IMO, you should try it on your own before I drop the answer in your lap :flower4u:

A little tip tho: My first try, I just modified the example files (either helloword.php or echotest.php depending on what tutorial you use to do it) with the php code that I needed. I had the php return an array to flash and used that to build my gallery. Worked nicely.

#11 darkson01

darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 29 January 2007 - 02:34 PM

no offence pax but the amfphp looks alot bloody harder to do. ben is there any chance you can give a copy of you xml gallery? i tink i'll stick to you way as i'm understanding that more and is easier to edit, for me anyway.

Edited by darkson01, 29 January 2007 - 03:42 PM.


#12 Pax

Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 29 January 2007 - 04:21 PM

lol, why would I take offense to that? Use whatever you're comfortable with.

#13 darkson01

darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 29 January 2007 - 05:04 PM

lol, why would I take offense to that? Use whatever you're comfortable with.


just being polite buddy :lol:

thanks for offering the idea though!

#14 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 29 January 2007 - 05:16 PM

AMFPHP is really nothing different to regular PHP. I had a look before. Anyway, I've attached my gallery to this post for you download:
Attached File  Gallery.zip   118.31KB   264 downloads

#15 darkson01

darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 30 January 2007 - 01:42 PM

thanks man! (nice looking gallery man!)

erm from the picture attached, how would i select the column "image_url" in the code below?

[codebox]
echo "<?xml version=\"1.0\" encode=\"UTF-8\"?>";
echo "<firstChild>";

$select = mysql_query("SELECT * FROM `Scotland` ORDER BY `id` ASC") or die(mysql_error());

whilte($row = mysql_fetch_array($select)); {

echo "<picture image=\"".$row[""]."\";

}

echo "</firstChild>";[/codebox]

also is that code correct?

#16 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 30 January 2007 - 09:35 PM

echo "<?xml version=\"1.0\" encode=\"UTF-8\"?>";
echo "<firstChild>";
$select = mysql_query("SELECT * FROM `Scotland` ORDER BY `id` ASC") or die(mysql_error());
while($row = mysql_fetch_array($select)) {
echo "<picture image=\"".$row[""]."\" thumb=\"".$row[""]."\" />";
}
echo "</firstChild>";
That code should work. Make sure you supply a thumbnail image, as I said in the readme.txt file.

#17 darkson01

darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 31 January 2007 - 04:34 AM

ok, and the [""] parts after the $row. what would i put in there?

#18 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 31 January 2007 - 05:51 AM

the row names inside the mysql table

#19 darkson01

darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 31 January 2007 - 08:08 AM

omg! ^_^ ^_^

fantastic it works!

thank you so much ben, your a real life saver!!

just two last questions sorry :P

1) where would i place a preloader so it appears when loading up the image in the picture box and thumb boxes?

2)how can i change it so if there is less than 10 thumbs, the boxes don't disappear in the middle but rather when tyhey reach the left hand side of the screen?

Edited by darkson01, 31 January 2007 - 08:09 AM.


#20 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 31 January 2007 - 03:45 PM

Hm..

1) You can place preloader anywhere, I would say under the image loader. Then you just use this:
preloadBar._xscale = imageHolder.getBytesLoaded()/imageHolder.getBytesTotal()*100;
Inside an onEnterFrame loop.

2) Not really sure what you mean there, maybe explain it a bit more clearer?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users