Home  |  Linux  | Mysql  | PHP  | XML
From:Nathan Wallace Date:Mon Jan 24 23:03:50 2000
Subject:[FAQTS] PHP Knowledge Base Update -- January 25th, 2000
Many people on this list might be interested in the new MySQL Knowledge
Base that was released yesterday:

    http://mysql.faqts.com

If you have any knowledge base ideas, or wish to start your own please
mail me or just jump in at http://www.faqts.com and go nuts :-)

Cheers,

Nathan


## Unanswered Questions ########################################


-------------------------------------------------------------
Is there perl like 'strict' swicth to php
http://www.faqts.com/knowledge-base/view.phtml/aid/651
-------------------------------------------------------------
Jani Averbach



-------------------------------------------------------------
Can anyone tell me how to get the XML expat library working on Win98 PWS 4.0
http://www.faqts.com/knowledge-base/view.phtml/aid/654
-------------------------------------------------------------
Shaun Lizzio



-------------------------------------------------------------
Why does echo("help\n") not create a newline?
http://www.faqts.com/knowledge-base/view.phtml/aid/663
-------------------------------------------------------------
Lee Engler, Nathan Wallace



-------------------------------------------------------------
How do I get the image in a mySQL blob field to display on a page?  (Obvisouly both <image>  and Header("Content-type:  image/jpeg");  are out)
http://www.faqts.com/knowledge-base/view.phtml/aid/666
-------------------------------------------------------------
Matt Gregory



## New Entries #################################################


-------------------------------------------------------------
Can I disable an internal PHP function?
http://www.faqts.com/knowledge-base/view.phtml/aid/656
-------------------------------------------------------------
Nathan Wallace
Stanislav Malyshev

You can try to go to the C code that implements the function and just
remove the part of the function that does the actual work.

For example, to stop users using the link function just remove the part
that does the actual filesystem link.

After making the changes, recompile.


-------------------------------------------------------------
Why does my PHP CGI installation always get the error 'No input files specified'?
What httpd.conf changes do I need to make for a PHP CGI installation?
http://www.faqts.com/knowledge-base/view.phtml/aid/657
-------------------------------------------------------------
Nathan Wallace
Dave Reed

I was having problems getting started a few weeks ago and got this
answer - make certain you have apache set up correctly to handle php:

change .php3 to whathaver extension you use (.php or .phtml) and
change the /path/to/php to /home/httpd/cgi-bin/php

In short, put the following in your httpd.conf

   AddType application/x-httpd-php3 .php3
   AddType application/x-httpd-php3-source .phps

   Action application/x-httpd-php3 /path/to/php


-------------------------------------------------------------
Why are my uploaded files always zero (0) bytes?
http://www.faqts.com/knowledge-base/view.phtml/aid/659
-------------------------------------------------------------
Nathan Wallace
Magnus Hammar

Before doing anything with an uploaded file, I always like to check
that:-

1) The file actually exists.
2) It's got a non-zero size.

Doing a quick 'if(@filesize($path))' on it will tell you both. I had a
problem the other evening with people uploading files and it creating
errors about writing 0 bytes.  The problem: /tmp/php/ was full. 

there is also the variable, upload_max_filesize in your php.ini file,
which is the max number of bytes which can be uploaded (it overrides the
MAX_SIZE specified in your html).


-------------------------------------------------------------
How can I strip / remove all HTML and PHP tags from a string?
http://www.faqts.com/knowledge-base/view.phtml/aid/660
-------------------------------------------------------------
Nathan Wallace
Matt Zandstra

Try using the strip tags function:

    http://www.php.net/manual/function.strip-tags.php3


-------------------------------------------------------------
How can I make a page to show system statistics?
http://www.faqts.com/knowledge-base/view.phtml/aid/664
-------------------------------------------------------------
Nathan Wallace
alex

You can do that with MRTG and its contrib scripts.

I use it to measure the loadavg of all my linux box (/proc/loadavg) it's
the same info you get from the command "top" or "w" at the shell.  You
could adapt one of those scripts to measure /proc/meminfo or whatever
you want.

It can measure anything you want, read about it at

    http://www.ee.ethz.ch/~oetiker/webtools/mrtg/mrtg.html


-------------------------------------------------------------
How do global variables and functions work?
Do I declare global variables at the top level or inside functions?
http://www.faqts.com/knowledge-base/view.phtml/aid/665
-------------------------------------------------------------
Nathan Wallace
Torben Wilson

It's all in the manual, under "Language Reference/Variables/Variable
Scope":

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

The basic idea is that global variables are not available within
functions by default. To change that, use the 'global $varname;'
statement within your function to allow access. Or use
$GLOBALS['varname'].


-------------------------------------------------------------
How can I remove all instances of a character from a string?
http://www.faqts.com/knowledge-base/view.phtml/aid/669
-------------------------------------------------------------
Nathan Wallace
Donovan J. Edye, Jason Brooke

You need to use str_replace():

    http://www.php.net/manual/function.str-replace.php3

Here is a quick example:

    $str = 'abcde';
    $str_minus_a = str_replace("a", '', $str);  // bcde

For more string functions see:

    http://www.php.net/manual/ref.strings.php3


-------------------------------------------------------------
What's the best place to get IMAP documentation?
What should I read before using the IMAP functions?
http://www.faqts.com/knowledge-base/view.phtml/aid/670
-------------------------------------------------------------
Nathan Wallace
Mark Musone

The base you need to properly understand the PHP IMAP functions is to
know the c-client library, since the IMAP module is just a port of the
c-client library.

I'd suggest looking at the internals.txt file in the doc directory of
c-client.

Here is the PHP documentation for the IMAP functions:

    http://www.php.net/manual/ref.imap.php3


## Edited Entries ##############################################


-------------------------------------------------------------
What does the error 'Warning: 1 is not a valid MySQL-Link resource' mean?
http://www.faqts.com/knowledge-base/view.phtml/aid/548
-------------------------------------------------------------
Joshua Ariizumi, Matt Gregory, Nathan Wallace


This probably means that you are using a result index where an link 
index is expected.  Check your syntax.

example which gives this error: (assuming that MyDatabase exists)

$myconnection = mysql_connect("localhost", "user", "pass");
$Query = "SELECT * FROM MyDatabase";
$resultset = mysql_query($Query);
$numrowsaffected = mysql_affected_rows($resultset);
//this is wrong because mysql_affected_rows expects the link index 
//not the result index.  Fix the error by changin it to:
$numrowsaffected = mysql_affected_rows($myconnection);


-------------------------------------------------------------
Why does require($file_name) in a loop just include the first file repeatedly?
http://www.faqts.com/knowledge-base/view.phtml/aid/597
-------------------------------------------------------------
Nathan Wallace, Matt Gregory


If you want to include files within a loop you need to use include:

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

The difference is that include is done at run time, not parse time. 
When you use require the file is injected straight into the code when it
is being parsed, so only the first file name will be used many times.  

You can read more about the difference between include() and require()
here:

    http://www.faqts.com/knowledge-base/view.phtml/aid/6/fid/40



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