View Single Post
Old 04-06-2008, 02:45 PM   #7 (permalink)
moe122
The Visitor
 
Join Date: Apr 2008
Posts: 1
Thanks: 0
moe122 is on a distinguished road
Default

hey, i just completed your tut because i need to get some data from php into flash, and so far i was doing it directly....php to flash and everything was fine but because i got a paging system in php the php changes all the time (i.e blabla.php?x=y) and in flash i've got to load the page which cannot happen if the page changes.....i saw your tut about making an xml and i know you can load an xml into flash so im going to give it a go.....but i get the following error when previewing the page.....


Warning: Invalid argument supplied for foreach() in C:\wamp\www\Web Root\Test\TMP9mcbxywrkg.php on line 23
Wrote: 34 bytes

my code is as follows:

PHP Code:
<?php
require_once("Connections/Connection.php"); // Database Connection
include("Function/Dateswapper.php"); // Dateswapper function

/////
$query sprintf("SELECT * FROM clients limit $rowstart,$limit");
$result = @mysql_query($query);
$row = @mysql_fetch_array($result);
/////

$doc = new DomDocument('1.0');
$root $doc->createElement('profiles');
$root $doc->appendChild($root); 

 
while(
$row = @mysql_fetch_array($result))
{
    
// add node for each record
    
$clients$doc->createElement('clients');
    
$clients $root->appendChild($clients);
}  

foreach(
$row as $Username => $fieldvalue

    
$clients->appendChild($doc->createElement($fieldname$fieldvalue)); 
}
echo 
'Wrote: ' $doc->save("clients.xml") . '  bytes';

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>
and thnx in advance.....gr8 tut btw...
moe122 is offline  
Reply With Quote