[PHP] Debug recursion
Hi all i have found a bug in my db class when i use the recursion. I try to use the adjacency list model to develop a three menu but when i call the function in recursive way i loose data because the value returned from the fetch seem to be empty. I have db table like this: table catalog ID | Name_Category | Subcategory 1 node category 0 2 1_sub_category 1 3 2_sub_category 1 4 another_node 0 5 another_node 0 I have this db class code: http://phpfi.com/229087 And i create an instance of such class with this code. http://phpfi.com/229088 My problem is that i take only the fist main category, the subcategory of this node and later the function esc and doesn't print the other main category. I have try to use the native php mysql function and the code work then the problem i suppose is in my class. Procedural way with native functions unction buildThree($parent) { $sql = SELECT id, name_category FROM category WHERE subcategory = {$parent}; $rs = mysql_query($sql) or die(mysql_error()); if ($rs) { while (list($id, $nome) = mysql_fetch_array($rs)) { $sql2 = SELECT id FROM category WHERE subcategory = {$id}; $rs2 = mysql_query($sql2) or die(mysql_errno()); $total = mysql_num_rows($rs2); if ($total) { echo'li # '.$nome.' '.\n\r.'ul'.\n\r; buildThree($id); echo/ul.\n\r./li.\n\r; } else { echo'li ?m=productamp;cat='.$id.' '.$nome.' /li'.\n\r; } } } } echo 'ul'; buildThree(0); echo '/ul'; echo 'ul'; buildThree(0); echo '/ul'; -- View this message in context: http://www.nabble.com/Debug-recursion-tf3632803.html#a10143940 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Socket server in PHP
Hi all sorry for the ignorance :D.This is my first time with Socket and i have a question for you.I want create a script that run like daemon in background and listen incoming request.It's possible with socket open a stream to a directory and check any change on this directory ? I want send notify about the state of directory through e-mail for example: when a user add new files or change any data. Thanks so much and good work to all. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 5.1 release
Hi all, i have question about the PHP 5.1 version. The PHP-GTk2 it's proud to start and require PHP5.1 version to work. When it's possible to use a stable version and what are the new features of this release. Thanks so much to all. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP safe_mode
Hi all i have problem with safe_mode i don't understand the logic to apply to avoid owners problem with script. Can you step by step ho to solve ? Thanks so much in advice. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with recorset
Hi all sorry for the newbie's question but i want understand the problem. I have use a simple command with sqlite to get a data from a table. $dbFile = realpath(./)./data.db; $db = sqlite_open($dbFile); if (!(is_resource($db))) { die(Impossibile aprire uno stream: . sqlite_error_string(sqlite_last_error($db))); } $query = SELECT id, file, time FROM file; $res = sqlite_unbuffered_query($db, $query); while (list($id, $file, $time) = sqlite_fetch_array($res)) { echo $id.$file.$time.\n; } I i want use a OOP to get a data from a a table i get for every execution of loop while the first record. include(./classdb.php); class DbData extends SqliteDbConnect { function GetQueryResult($query) { $res = sqlite_unbuffered_query($this-dbLink, $query); return $rows = sqlite_fetch_array($res); } } $db = new DbData(./, data.db); $query = SELECT id, filem time FROM file; while (list($id, $file, $time) = $db-GetQueryResult($query)) { echo $id.$file.$time.\n; } I have tested the script with CLI on PHP4/Win. Thanks so much to all. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] in_array and annidated path
Hi all sory for the double post but i have deleted the first email that i have send to the list. The problem that i have found is that in_array function don't work with annidate path. I have created a function that update a list of filepath from a directory to DB but when i use particular path with space and more long like: C:\back\Microsoft.NET\Framework\v1.0.3705\file.exe with more iteration there are problem because add the same file again. Can you help me to fix the problem ? I have used this script with CLI but to explain the problem i have added the source to this location: http://www.fadelabot.net/update.php Thanks so much to all and good work. P.S: There is another problem about the CPU usage on windows Xp i have a process php.exe that use 99% of CPU. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with in_array function
Hi all i have problem with in_array() function to comparing string of filepath. I read from a directory and write the filepath into database if the flag is off. If the file is modified i update the last time of modify and if there are new file i add this file into Db. i have write a function to explain the problem to this link: http://www.fadelabor.net/update.php Thanks so much to all. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to compile PHP5 with VC++ 6.0
Hi all i have a question. There si an how-to that explain step by step all necessary to create a myself compiled php distribution ? I have read about: http://docs.php.net/en/install.windows.building.html Can you send a new link about this issue. Thanks so much again and good work to all. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Logging with PHP to SMTP server
Hi all, there is a way to create log-system to authenticate to smtp server ? Thanks so much to all. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to compile a script into executable file
Hi all and sorry for my ignorance. I have used the Bcompiler to compiler a script into .exe file to distribuited on Windows System but i don't have any result. Can you explain how to realize with a simple example ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Accellerator into Zend Engine2 by default
PHP is scripting language interpreted and not compiled. I want know about the difference beetwean the bytecode of JSP and ASP.NET than PHP-Accelerator. Why this extension isn't a built-in into Zend Engine parsing ? This is a better solution to comparison the performace of PHP versus other technologies like JSP and ASP.NET ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP parse Excel and Access files
How to read and get data from Excel Files and Access Files. Can you post me articles and tutorials on the web-sites that explain the basic concept to create an interface for PHP and this files-type. Thanks so much to all. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with Regular expression
Hi all. I have a problem: i want subs any characters from a string but i don't have fix the problem. The string that i want to manipulate is the value from a text field of a search engine. The characters that i want to try substitute is , , +, -, |, ||, or, and, not in not case-sensitive mode with . I have create a pattern like this: $str = Sybase and PHP not ASP or JSP Oracle not Andy | Perl || Python + Ruby; $pattern = /(\band\b)|(\bnot\b)|(\bor\b)|(\b\b)|(\b\b)|(\b\.\b)|(\b\+\b)|(\b\|\|\b)|(\b\|\b)/i; echo $str = preg_replace($pattern, , $str, -1); But characters like + don't subs with . Thanks to all and sorry my bad language -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Class PHP4 problem
?php //db_class.php error_reporting(E_ALL); class Db_Connect { var $host; var $user; var $pasw; var $MYSQL_ERRNO; var $MYSQL_ERROR; var $query; function make_connect($host, $user, $pasw) { $this-host = $host; $this-user = $user; $this-pasw = $pasw; $link_id = mysql_connect($this-host, $this-user, $this-pasw); if (!$link_id) { die(Impossibile connettersi al server mysql . br . Dettagli: . $this-MYSQL_ERROR . Errore No: . $this-MYSQL_ERRNO); } else { return $link_id; } } function select_db($db_name) { if (!(mysql_select_db($db_name))) { die(Impossibile selezionare il database . $db_name . br . Dettagli: . $this-MYSQL_ERROR . br . Errore No: . $this-MYSQL_ERRNO); } } function sql_query($query) { if (!(mysql_query($query))) { die(Impossibile eseguire query al database . br . Dettagli: . $this-MYSQL_ERROR . br . Errore No: . $this-MYSQL_ERRNO); } else $result = mysql_query($query); return $result; } function close_connection() { mysql_close($this-make_connect()); } } class Result_Db extends Db_Connect { function get_data() { $res = $this-sql_query($query); while($db_data = mysql_fetch_array($res)) { echo $db_data[tot] . br; } } } $obj = new Result_Db; $obj-make_connect('localhost', 'root', ''); $obj-select_db('sottilelinearossa'); $obj-sql_query('select count(id) as tot from articoli'); $obj-get_data(); ? I get this message because the variable is not valid when call the method sql_query in the child class Result_Db. How to fix this problem ? Notice: Undefined variable: query in c:\programmi\apache group\apache\users\kioto\db_class2.php on line 66 Impossibile eseguire query al database Dettagli: Errore No: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Virtual Host problem
Hi all i've try to configure Apache with Virtual Host in the main configuration file of Apache i have modify like this: #NameVirtualHost *:80 NameVirtualHost * # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # VirtualHost *:80 ServerAdmin [EMAIL PROTECTED] DocumentRoot /usr/local/apache/users/default ServerName mordoch /VirtualHost VirtualHost *:80 ServerAdmin [EMAIL PROTECTED] DocumentRoot /usr/local/apache/users/mysite ServerName mysite /VirtualHost VirtualHost *:80 ServerAdmin [EMAIL PROTECTED] DocumentRoot /usr/local/apache/users/brothersite ServerName brother /VirtualHost I have insert a file index.php in all main folder of virtaul host: /usr/local/apache/users/default/index.php /usr/local/apache/users/mysite/index.php /usr/local/apache/users/brothersite/index.php I have modified the file hosts in etc/hosts. 39.244.88.126 mordoch 127.0.0.1 mordoch 127.0.0.1 localhost 127.0.0.1 mysite 127.0.0.1 brother When i try to view with my browser i type on my addressbar http://localhost i receive a message error like this: Warning: Unknown(/usr/local/apache_1.3.31/users/default/index.php): failed to open stream: Permission denied in Unknown on line 0 Warning: (null)(): Failed opening '/usr/local/apache_1.3.31/users/default/index.php' for inclusion (include_path='.:/usr/local/php/lib/php') in Unknown on line 0 I receive this error for all virtual host that i have create. The chmod of all folder is set to 777. What are the reason ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Drop directory with PHP
Hi all I have create this function to delete directory and file but i have no result . When i call the function i don't receive any errors by PHP. I have test this function with PHP 4.3.6 and Apache for NT version 1.3.1 on Windows Xp Professional I write this code : ?php error_reporting(E_ALL); function DropDir($dir) { if (is_dir($dir)) { if (!($handle = opendir($dir))) die(It' no possible open directory $dir); while(false !== ($file = readdir($handle))) { if ($file != '.' $file != '..') { if (is_dir($dir . '/' . $file)) { DropDir($dir . '/' . $file); exec(rmdir $file); } else { exec(del $file); } } } closedir($handle); exec(rmdir $dir); } } //call function DropDir DropDir('my_folder'); ? I think that it' impossible for me find solution to this problem. Can you help me ? Thanks so much to all an sorry for my bad language -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php