# Php to flash

**URL:** https://forum.kirupa.com/t/php-to-flash/207601
**Category:** Uncategorized
**Created:** [November 19, 2006, 10:13pm UTC](https://forum.kirupa.com/t/php-to-flash/207601 "2006-11-19T22:13:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mymelody](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@mymelody](https://forum.kirupa.com/u/mymelody)
#### Post date: [November 19, 2006, 10:13pm UTC](https://forum.kirupa.com/t/php-to-flash/207601/1 "2006-11-19T22:13:57Z")

</div>

[COLOR=black]Hi![/COLOR]  
[COLOR=black]I need help to show information from my phpfile in Flash.[/COLOR][COLOR=black]The name of the table is news. I want to show everything from news order by newsid.[/COLOR]  
[COLOR=black]I don’t now how to use my whileloop in my phpfile when I should post it to Flash. In my flashfile I use dynamic text to [/COLOR]  
[COLOR=black]show the database information and the var is txt\_list.[/COLOR]  
[COLOR=black]And I use loadVariables to pick up the phpfile:[/COLOR]  
[COLOR=black]onClipEvent (load) {[/COLOR]  
[COLOR=black]loadVariables("[/COLOR][[COLOR=black]stp.php[/COLOR]](http://localhost/lisas/stopusnot/test4.php)[COLOR=black]", this, “GET”);[/COLOR]  
[COLOR=black]}[/COLOR]

[COLOR=black]This is my phpcode: [/COLOR]

[COLOR=black]\<?php [/COLOR]  
[COLOR=black]$objConn = mysql\_connect (‘localhost’ , ‘root’ , ‘#’); [/COLOR]  
[COLOR=black]mysql\_select\_db (‘stp); [/COLOR]  
[COLOR=black]$sql = mysql\_query(“SELECT date, headline, text FROM news ORDER BY newsId DESC”) or exit(mysql\_error()); [/COLOR]  
[COLOR=black]while ($r = mysql\_fetch\_array($sql)) [/COLOR]  
[COLOR=black]{ [/COLOR]  
[COLOR=black]echo(’\<p\>\<h4\>’.$r[‘headline’].’\</h4\>’.$r[‘date’].’\<br /\>’.nl2br($r[‘text’]).’\</p\>’); [/COLOR]  
[COLOR=black]} [/COLOR]  
[COLOR=black]mysql\_close($objConn); [/COLOR]  
[COLOR=black]?\> [/COLOR]

[COLOR=black]When I just want to show one record from news it works fine, like this:[/COLOR]

[COLOR=black]$objConn = mysql\_connect (‘localhost’ , ‘root’ , ‘#’); [/COLOR]  
[COLOR=black]mysql\_select\_db (‘stp’); [/COLOR]  
[COLOR=black]$query = “SELECT \* FROM news WHERE newsId=1”; [/COLOR]  
[COLOR=black]$result = mysql\_query($query); [/COLOR]  
[COLOR=black]$headline = urlencode(mysql\_result($result,0,“headline”)); [/COLOR]  
[COLOR=black]print "&txt\_list=$headline [/COLOR]
