MYSQL New Tricker

liguehs

New Member
Messages
62
Reaction score
0
Points
0
Hi guys,

I was wondering if some one can help me for making a new tricker like this one:
http://www.nhl.com/

Some changes I would like to have is that instead of having 3-4 news in the same picture, I would like to have only 1.

But I am sure I would be able to acheive that, but my question is how can I make it so it reads the last let say the last 5 news from a mysql Database?
 

diabolo

Community Advocate
Community Support
Messages
1,682
Reaction score
32
Points
48
well depending how your MySQL structure is set up, it can vary, and I cannot give you a definite answer until I see it. But here is a sample.

$sql = "SELECT * FROM news ORDER id ASC|DESC LIMIT 0, 5"

the main important things here is,
ORDER
`id` is how you are gonna track your news
ASC|DESC = Ascending or Desecnding. chose one depending how your id's are calculated

LIMIT
`0` is the first one it starts at
`5` is the last one it ends ad

hope I was helpful
 
Last edited:

liguehs

New Member
Messages
62
Reaction score
0
Points
0
Hi,
Thanks for your reply,

Sorry if I was not clear, it is not the PHP/MYSQL it self, but a way of integrating the flash in it....


Thats what is confusing me.
 

diabolo

Community Advocate
Community Support
Messages
1,682
Reaction score
32
Points
48
o flash.
well, sorry can't help you there. never really caught onto Flash and PHP interactions.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
I'm more knowledgeable of Flex than Flash, but I can give you some pointers.

You'll probably want to have the PHP script output the news items as XML. Some format like:
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<news>
  <item>
    <headline>Stix Nix Hick Pix</headline>
    <image>http://upload.wikimedia.org/wikipedia/commons/thumb/e/ee/Lange-MigrantMother.jpg/300px-Lange-MigrantMother.jpg</image>
    <caption>Migrant Mother</caption>
  </item>
  ...
</news>
When your widget gets the XML document, it fills in the news ticker with items based on the elements in the XML doc.

With Flex, you can bind an HTTPService as the dataProvider for your widget, call "send" on the HTTPService and voila, you've got the data. I'm not as familiar with straight Flash, and I think it does it a little differently. I believe you use an XML object and call its load method (load in Flash CS3), passing in an HTTP URI. The load is asynchronous, so you'll have to add an "onLoad" handler to handle the response. Kirupa.com has an introduction to XML in Flash you might want to check out.

The part I'm least certain about is creating the news item and ticker. That's where Flash and Flex differ the most.
 
Top