Home  |  Linux  | Mysql  | PHP  | XML
From:Nathan Wallace Date:Sun Sep 19 11:44:59 1999
Subject:PHP Knowledge Base Update -- September 18th, 1999

------------------------------------------------------------
Why can't PHP find my mysql.sock file?
http://www.e-gineer.com/e-gineer/phpkb/view.phtml/qid/632
------------------------------------------------------------
se@lakenet.no, Jim Winstead

The mysql functions in php will use the path for the mysql.sock file 
that is compiled into the mysql client that is compiled into php (phuu!)

making a backup, and recompiling both mysql and php/apache seems to
be in order:   run ./configure --help to get to see where you can set
the sock file for mysql.

For recent versions of PHP, you can use "localhost:/path/to/mysql.sock"
in your mysql_connect call to tell it where to find the socket.


------------------------------------------------------------
How can I do a union in MySQL?
http://www.e-gineer.com/e-gineer/phpkb/view.phtml/qid/633
------------------------------------------------------------
Martin Ramsch

MySQL does not support UNION as yet.

Below is an example solution if you need data from 3 tables in a union.

If the order of result rows doesn't matter, then just do three single
SELECTs.

If you need to sort all selected rows from all three tables by some
order, then a work-around is to use a temporary table:

With MySQL V3.23.x, this should work (untested):
   CREATE TEMPORARY TABLE tmp type=HEAP SELECT * FROM table1 WHERE ...;
   INSERT INTO tmp SELECT * FROM table2 WHERE ...;
   INSERT INTO tmp SELECT * FROM table3 WHERE ...;
   SELECT * FROM tmp ORDER BY ...;
   DROP TABLE tmp;

With earlier versions do it this way:
   CREATE TABLE tmp1234 ( ...appropriate column definitions... );
   INSERT INTO tmp1234 SELECT * FROM table1 WHERE ...;
   INSERT INTO tmp1234 SELECT * FROM table2 WHERE ...;
   INSERT INTO tmp1234 SELECT * FROM table3 WHERE ...;
   SELECT * FROM tmp1234 ORDER BY ...;
   DROP TABLE tmp1234;


------------------------------------------------------------
How can I flush a file I'm writing?
How can I flush the file write buffer in PHP?
http://www.e-gineer.com/e-gineer/phpkb/view.phtml/qid/634
------------------------------------------------------------
Scott A. Cole

Just use flush():

    http://www.php.net/manual/function.flush.php3


** OTHER RANDOMLY SELECTED PHPKB ENTRIES **


------------------------------------------------------------
Can I use PHP to interface with an AS/400 database?
http://www.e-gineer.com/e-gineer/phpkb/view.phtml/qid/358
------------------------------------------------------------

AS/400 uses the DB2 database.

You should be able to interface PHP to AS/400 using the DB2 ODBC
driver.


------------------------------------------------------------
How can I figure the correct date n hours from now while avoiding 
daylight savings time adjustments?
http://www.e-gineer.com/e-gineer/phpkb/view.phtml/qid/416
------------------------------------------------------------

The following script adds an hour to the current date.  Note that even 
though the number of seconds exceeds the normal range of 0 to 59, the 
date will be figured correctly by mktime().  If daylight savings time 
happens in the next hour, mktime() will adjust for this as well.

<?

//get current timestamp
list($hour, $min, $sec, $day, $mon, $yr) = 
   explode(" ",date("H i s d m y"));

//print time 3600 seconds (1 hour) from now
print(date(date("H i s d m y"), 
   mktime($hour, $min, $sec+3600, $mon, $day, $yr));

?>


------------------------------------------------------------
Are there any resources for Italian developers?
http://www.e-gineer.com/e-gineer/phpkb/view.phtml/qid/406
------------------------------------------------------------

There is an Italian mailing list available for php3

Send an email with

    subscribe

as the subject to the address

    php3-it-request@michel.enter.it

to join.


------------------------------------------------------------
Which one is faster for looping, for or while?
http://www.e-gineer.com/e-gineer/phpkb/view.phtml/qid/326
------------------------------------------------------------

While is marginally faster than for.  But it probably isn't measurable
so I wouldn't worry about it if I were you.


------------------------------------------------------------
Where can I get a list of all the php3_ settings for Apache?
What configuration settings can I make for PHP in Apache conf or 
.htaccess files?
http://www.e-gineer.com/e-gineer/phpkb/view.phtml/qid/507
------------------------------------------------------------

Just about every directive listed here has a corresponding Apache
httpd.conf directive. Simply prepend php3_ to the start of the directive
names listed here. 

    http://www.php.net/manual/configuration.php3

There are some that can't be set in the .conf file though.  For the
definitive list, have a look at mod_php3.c in the source code.

...or, a shortcut would be server-info, if you compiled Apache with
mod_info.If yes, enable it (search httpd.conf for server-info handler)
and open http://your.server.name/server-info. Go to php3_module section
and there you'll see all the config. settings
available.

...or you can try this on the command line:

    httpd -L

...you can see their current values using php_info()



Navigate in group php.kb at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants