Re: [PHP] My first xml try

2007-11-10 Thread Andrew Ballard
On Nov 10, 2007 12:56 AM, Ronald Wiplinger [EMAIL PROTECTED] wrote:
 Andrew Ballard wrote:
  Ronald,

 On Nov 9, 2007 9:05 PM, Ronald Wiplinger [EMAIL PROTECTED] wrote:


 I tried to use echo statements for debugging and found that it seems I
 do not get the information of require().

 What do I need to change?



 Thanks for helping me!


 I'm not sure what error you're getting, but I would guess it can't
 find the required file because mysql-config is spelled wrong in the



 What do you mean it is spelled wrong? What is spelled wrong? The file name
 of
 the information for $dbname, $dbhost, $dbuname is in ../mysql-config

In the code you posted, there was an extra 'y' in 'mysql'. My point
about the constructor was that even if these variables are defined in
your mysql-config file, it is included in the class constructor
function RSS(). (See
http://www.php.net/manual/en/language.oop.constructor.php) Anything
you declare in that function would fall out of scope as soon as the
function finishes, so they would not be available inside your
getDetail() function or any other function. For more information, this
should help:

http://www.php.net/manual/en/language.variables.scope.php



Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] My first xml try

2007-11-09 Thread Andrew Ballard
Ronald,

On Nov 9, 2007 9:05 PM, Ronald Wiplinger [EMAIL PROTECTED] wrote:
 I tried to use echo statements for debugging and found that it seems I
 do not get the information of require().

 What do I need to change?

I'm not sure what error you're getting, but I would guess it can't
find the required file because mysql-config is spelled wrong in the
constructor for the class that you posted. It also looks like you are
using variables $dbname, $dbhost, $dbuname in your functions, but I
don't see how those variables could be defined. Even if you declare
them global in the constructor function, I'm pretty sure they would be
out of scope in any of your other functions.

I am guessing that your table webref_rss_details must only have one
row in it, because the block of XML you are outputing in getDetails()
is definitely something you only want to send once. Also, if you
aren't using any of the XML writers or DOM libraries to build your
document, you should account for the possibility of invalid XML
characters like , , , and  in the content that you are writing and
make sure they are converted to the appropriate entities.

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] My first XML!

2002-11-27 Thread olinux
Here's a start for you

?
/* Connect to database */

$sql = SELECT * FROM categories ORDER BY
parent_id,cat_id  ASC;

$result = @mysql_query($sql) or die(Couldn't select
categories.); 

$menu = array();

while ($row = mysql_fetch_array($result)) {
$id = $row['cat_id'];
$category = $row['category'];
$pid = $row['parent_id'];

$menu[$pid][$id] = $category;
}

function show_cats ($parent=, $indent=) {
global $menu;

foreach($menu as $key1 = $value1) {

if ($key1 == $parent) {// if it's a top category
print it

foreach ($value1 as $key2 = $value2) { 
$catname = $value2; // $value2 same as
$value1[$key2]
$catID = $key2;
echo str_repeat(nbsp;nbsp;, $indent);
echo a
href=\search/show_results.php?catID=$catID\$catname/abr;

show_cats($catID, $indent+1);
}

}
}

} // end show_cats function

show_cats();
? 

--- Boris Kolev [EMAIL PROTECTED] wrote:
 Hello php-general,
 
   Hi.
   I want to know how i can export tree structure
 from Mysql table to
   XML
   mysql table structure is:
   ID - Group Unique Id
   P_ID - Parent Id
   Name - Name of group
 
   I want to make XML whit tree structure. Can some
 body help me!
   
 
 -- 
 Best regards,
  Boris 
 mailto:[EMAIL PROTECTED]
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php