[PHP] Re: Creating XML files
Not so hard to find : http://php.net/manual/en/book.xml.php "It flance" <[EMAIL PROTECTED]> a écrit dans le message de news:[EMAIL PROTECTED] Hi all, Some months ago i worked with XML. And i remember that i was able to create xml files quite easily. Now i don`t have the book i used by the time. I made many searches in google and i don't find something interesting. So i'm wondering if somebody can give a good link with examples. If i remeber well, i can create axml file without writing the hole file to a string before writing the string to the file. Thanks a lot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: No Database Connection possible (mySQL)
First problem : there are not return in the function as it said Second problem : php make a real connection with a unique id to a server database $server1 = array("localhost","user","pass") $server2 = array("localhost2","user2","pass2") Function mysqlConnectServer($server) { $uid = mysql_connect($server) or die(mysql_error()); return $uid; } $uidServer1 = mysqlConnectServer( $server1); $uidServer2 = mysqlConnectServer( $server2); $db1_1 = mysql_select_db("tava", $uidServer1); $db1_2 = mysql_select_db("tava2", $uidServer1); $db2_1 = mysql_select_db("tava", $uidServer2); $db2_2 = mysql_select_db("tava2", $uidServer2); In this exemple we used, only 2 mysql connections to create 4 databases connections, on 2 mysql servers. Depending of your application, you must manage server and database connection, to manage error and problem connection, but also for performance and don't create a server connection each time you connect to a different database on the same mysql server. Also look at PDO:mysql and mysqli on php.net Mysqli is simple to use, for exemple mysqli_connect(), use a mysql_connect or a mysql_pconnect depending of your configuration. Also mysqli check all server connection, if already exist it dont create a new connection to the server, but use an allready connection even your code isn't really optimised. PDO is more complex and, in my mind, have some problem of performance at this time. ""Aviation Coding"" <[EMAIL PROTECTED]> a écrit dans le message de news:[EMAIL PROTECTED] Hi all, I am having problems with a connection to a mysql database. I am using function con() { mysql_connect("localhost","user","pass") or die(mysql_error()); mysql_select_db("tava") or die(mysql_error()); } Now, when I call the _function_ (!) con() or die("no con"); I get the "no con" output. When I call the mysql_connect and mysql_select directly before executing a query, I get some DB output. But that won't work when I am using the function... Any ideas would be greatly appreciated. Cheers! Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: class_is_loadable?
Hi, The problem is not the autoload but the implementation of such function. class_is_loadable mean, "hey php look at my class somewhere in my files". PHP should inspect some files, in some directories and list classes. Which files, which extensions files, in which directories ? ... In my mind you must replan your autoload, for exemple make a link beetween classes and files name, ie : if file_exists( A.class.php ) include_once( B.class.php) else include_once( A.class.php ); Check the factory method at Zend site, that explain how to work with class method, without to know the exact name of class (ex : load an specific class depending of the database available) "Larry Garfield" <[EMAIL PROTECTED]> a écrit dans le message de news:[EMAIL PROTECTED] Greetings, all. I am trying to figure out a way to implement the following logic, but I am not sure if it is possible to do so without a lot of additional side work: I have a class, A, and another class B that extends A. They live in separate files. The logic I need to implement is as follows: if (class_exists('B')) { $foo = new B(); } else { $foo = new A(); } That is all well and good if both A and B are already loaded and parsed, but I am using spl_autoload to lazy-load classes as needed. That means the class_exists() call will return false if B exists but hasn't been included yet. What I would like to happen is for PHP to include B if it exists or give a non-fatal error if it doesn't so that I can instantiate A instead. Ideally, the logic would be something like the following: try { $foo = new B(); // Try to autoload B, throw exception if it can't. } catch (ClassDoesntExistEvenAfterRunningThroughAutoloadException $e) { $foo = new A(); // May autoload A at this point, too. } // do stuff with $foo However, as far as I am aware $foo = new B(); will cause a fatal exception if autoload doesn't find a B. Does anyone know of a way to achieve the above effect? This is specifically for PHP 5.2 and later. Thanks. -- Larry Garfield [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] URL Rewrite
Look at http://framework.zend.com/manual/en/zend.controller.router.html Apache configuration et framework methods to rout your files are there. "Subhranil" <[EMAIL PROTECTED]> a écrit dans le message de news:[EMAIL PROTECTED] Hi All, I want to show one URL at browser and content of different URL. Like user can see the URL at address bar like http://localhost/test/home/ or http://localhost/test/tech/php/but content of page will be http://localhost/test/index.php The URL of the address bar will never change to http://localhost/test/index.php Still a newbie! Thanks, Subhranild. -- View this message in context: http://www.nabble.com/URL-Rewrite-tp18233803p18233803.html 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] Re: Session variables disappear (some of them only)
Difficult to help you because there are many method of session : - where do you store the sessions_variables : in local file, db or cookie ? - how you transmit the session id, beetween pages(runtimes) : cookie, $GET link, database ? Did you check the availability of user cookie if you use it ? Because if in each page of your application you define a session variable it's sure it will be every time here. But the problem of session it's to transmit its ID between different pages, or session will be reset. If a user don't authorised cookie you must transmit the session id by db storage or $Get link. Also I don't see, a php modification during the last upgrades to explain that's kind of session problem. "karma" <[EMAIL PROTECTED]> a écrit dans le message de news:[EMAIL PROTECTED] Hi ! I have a very weird issue since the last Apache upgrade (-> 2.2.8-r3, a month ago), but I'm not sure it is related (well, I'm pretty sure it's not). Like many people, I've written an application that use PHP session variables, like $_SESSION["my_variable"]. Sometimes (it doesn't happen all the time), _some_ of these variables are not written in the session file and they are lost after a simple header("Location:...); (same domain). The session file is in the right directory (permissions are fine), but some of my variables are missing. The facts : - Apache 2.2.9 + PHP 5.2.6_rc4 running on a Gentoo (up-to-date) - all my scripts begin with session_start(). I've tried to add session_write_close() before every header(Location:...) call, it doesn't help. - I didn't change anything in my program (it has been running just fine for 2 years), it just began to fail from time to time (I would say 10 times a day). There is no hidden unset() function : it would fail for everyone. - these variables are all set correctly, and they don't have reserved names. - only a few variables disappear, but they are always the same ones (could it depend on their position in the session file ?!?) - the session files are very small (max 100ko) - it seems that it doesn't depend on the browser, but IE6 and IE7 seem to be the most affected ones (it may be because my users mostly use these browsers). - I can't reproduce this issue from my local network (any OS/browser - it would be too easy :) - reverting to the previous stable Apache and/or PHP versions doesn't help. - I didn't change any php.ini directive. Any idea ? Thanks ! PS: if you need more details, just ask. The only thing I can't do is pasting the code : the scripts are quite huge. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php