LMPX.COM |
Home | Linux | Mysql | PHP | XML | ||
|
|
|||
From: Nathan Wallace Date: Mon Aug 9 00:11:51 1999 Subject: PHP Knowledge Base Update -- August 8th, 1999
Jim Winstead today announced that there is now a news server running at
news.php.net with the php-dev and php3 mailing lists bidirectionally
gatewayed to newsgroups.
The newsgroups have been pre-populated with archives of the lists going
back quite a while (October 1997 for the php3 list, August 1998 for the
php-dev list).
If you feel the need to test posting via the news server, you can
subscribe to the php-test@lists.php.net mailing list and post to the
php.test newsgroup. Anybody posting testing messages to the real
groups will get five demerits.
Cheers,
Nathan
------------------------------------------------------------
How can I make a link automatically open a new window?
http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/554
------------------------------------------------------------
Mark Maggelet
Try like this:
echo "<a href=\"javascript:window.open(
'page.php3?bno=$bno')\">Keywords Management</a>";
------------------------------------------------------------
How can I redirect different browsers to different pages?
How can I show a different page to each different browser?
http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/555
------------------------------------------------------------
Robert Aden
I guess you could use $HTTP_USER_AGENT to get the browser and then:
if($browser == 'netscape') {
Header("Location: http://the.server.com/netscape.html");
} elseif ($browser == 'ie'{
Header("Location: http://the.server.com/explorer.html");
} else {
Header("Location: http://the.server.com/default.html");
}
I know netscape.com has a pretty uptodate javascript on their server
that you might have a look at to see exactly how the matching should be
done.
------------------------------------------------------------
Can I use imap_mail_move and imap_mail_copy to transfer messages from one mail server to another?
http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/557
------------------------------------------------------------
Chuck Hagenbuch
No, that's not supported by the imap protocol, and c-client doesn't
(afaik) provide an abstraction for it (you'd need a function that took
two full imap streams, for auth purposes). What you can do is fetch the
full message (imap_fetchheader . imap_fetchbody) and then imap_append it
to the new server. Not that nice, but it works.
------------------------------------------------------------
How can I copy a remote file without going through the fopen, fputs stuff?
How can I copy a remote file?
http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/558
------------------------------------------------------------
Robert Aden
You have to use fopen and fputs to copy a remote file:
function copyFromRemote($remote,$local){
$fp1 = fopen($remote,"r");
$fp2 = fopen($local,"w");
while(!feof($fp1)) {
$line = fgets($fp1, 1024);
fputs($fp2,$line,strlen($line));
}
}
I think that would work but i haven't tested it .....
** OTHER RANDOMLY SELECTED PHPKB ENTRIES **
------------------------------------------------------------
How can I change the sender of mail sent from PHP?
Why is the sender of all my mail messages "apache"?
http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/210
------------------------------------------------------------
From http://www.php.net/manual/function.mail.php3
Example 2. Sending mail with extra headers:
mail("nobody@aol.com", "the subject", $message,
"From: webmaster@$SERVER_NAME\nReply-To:
webmaster@$SERVER_NAME\nX-Mailer:
PHP/" . phpversion());
------------------------------------------------------------
What does mysql_query return if the select returns no (0) rows?
When does mysql_query return false?
http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/194
------------------------------------------------------------
This function returns TRUE or FALSE to indicate the success of
UPDATE, INSERT, and DELETE queries. For SELECT queries it returns a
new result identifier.
If you do a SELECT that returns no rows, you won't get a false, you'll
still get an index returned. You only get a false on an error, not on an
empty SELECT.
mysql_query() returns false (0) if the query fails. That means it
has a syntax error or cannot be executed for some reason. If
mysql_query() returns true (non-zero), it means it succeeded but not
necessarily that it returned any rows. A successful INSERT will return
non-zero, so will a successful SELECT.
Remember, a SELECT can succeed and return no rows (e.g., "SELECT *
FROM tbl_name WHERE 1=0" will succeed, but won't ever return anything.)
http://www.php.net/manual/function.mysql-query.php3
------------------------------------------------------------
Why does my Oracle SQL get committed even if I don't call commit?
http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/472
------------------------------------------------------------
Oracle will do an automatic commit at the end of your php3 script if you
don't do a rollback before then. This is Oracle behavior, not php.
This is the same behaviour you would see in SQL*PLus. If you run your
procedure from SQL*Plus and then exit, your changes will be committed
even though you never explicitly committed.
------------------------------------------------------------
Why isn't eregi_replace() working?
http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/361
------------------------------------------------------------
A common error when using eregi_replace() is forgetting to assign the
processed string to a variable. In the following example, we need to
replace the angle brackets with their corresponding HTML representations
so the brackets will show up in the browser:
<?php
$one = "String like this <with stuff in brackets>";
eregi_replace("<", "<", $one);
eregi_replace(">", ">", $one);
echo "$one\n\n"
?>
When we echo $one to the browser, this is all we see:
String like this
The brackets haven't been replaced, so the rest of the string is hidden.
The solution: assign the results of eregi_replace() back to the
original variable:
<?php
$one = "String like this <with stuff in brackets>";
$one = eregi_replace("<", "<", $one);
$one = eregi_replace(">", ">", $one);
echo "$one\n\n"
?>
This time when we echo to the browser, we see this:
String like this <with stuff in brackets>
In the first example, eregi_replace() had nowhere to return the
processed string. In the second example, we returned the process string
back to $one, and the changes were saved.
------------------------------------------------------------
Why is my text insert into MSSQL being truncated?
http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/491
------------------------------------------------------------
the mssql module uses two parameters in php3.ini to control the size and
limit of text columns.
mssql.textsize = 4096 (0-64kb)
mssql.textlimit = 4096 (0-2Gb)
try setting one or both params.
The max total length of a row on MSSQLServer 6.5 is 1738 or so chars
(~8100 on 7.0). If you are inserting into a BLOB (VARCHAR or VARBINARY)
you have to issue a set textsize=(up to 32768 or whatever the max
configured in the SQLServer) statement to tell it the maximum amount you
will transfer at a time. Plus you have to do an insert on the row where
the blob is to be stored and then a select to get the textpointer for
the just inserted row followed by a writetext loop to insert the actual
data. You end up assembling a series of writetext statements with
offsets, lengths, and data in the servers buffer then hit it with an
execute. It is not real clean but we do it all the time in production.
Have been using the same code since 4.21.08. It came out in the
SQLServer programmers toolkit as a VB image insert/read example.
| Navigate in group php.kb at sever news.php.net | |
| Previous | Next |
| © No Copyright You are free to use Anything |
Site Maintained by Zareef Ahmed
Powered By PHP Consultants |