php-general Digest 3 Nov 2003 23:46:16 -0000 Issue 2394

Topics (messages 168382 through 168426):

Re: Mailing List
        168382 by: Lowell Allen
        168390 by: David T-G

Re: Web Applications and C++?
        168383 by: Jay Blanchard

Re: Japanese entry into MySQL and into emails
        168384 by: Dave G

Re: Call to undefined function:  xml_parser_create()... but CGI compiled --with-xml
        168385 by: Dave [Hawk-Systems]

XML DOM
        168386 by: Ian Williams
        168405 by: Burhan Khalid

How do i replace table names?
        168387 by: Bas
        168388 by: Jay Blanchard
        168391 by: Bas
        168393 by: Jay Blanchard
        168395 by: Bas
        168396 by: Jay Blanchard
        168397 by: zhuravlev alexander
        168398 by: Jay Blanchard
        168401 by: John W. Holmes

Re: time() & daylight savings
        168389 by: Jay Blanchard

Re: Problems with remote include
        168392 by: Pablo Zorzoli

Search and POST and keywords
        168394 by: Robert Sossomon
        168406 by: Burhan Khalid

Re: References and memory efficiency
        168399 by: Johnson, Kirk

Quickform Image validation
        168400 by: Ian P. Christian
        168419 by: Ian P. Christian

Problem connecting to remote MySQL Server
        168402 by: Donald Tyler
        168403 by: Rob Adams

JavaScript Newsgroup
        168404 by: Robb Kerr
        168407 by: Burhan Khalid

Re: String Array Creation and assigment
        168408 by: Dan

caveats for upgrade from 4.2.2 to 4.3
        168409 by: Dave [Hawk-Systems]

Re: How to remove new line character?
        168410 by: Don Read

mysql_field_type() ...
        168411 by: René Fournier
        168412 by: Jay Blanchard
        168414 by: Rob Adams

printer functions and pcl
        168413 by: Mark Newnham

Dates < then 1970
        168415 by: Mark McCulligh
        168426 by: John W. Holmes

Problems using gethostbyname() to resolve *.net.au
        168416 by: Dan Anderson
        168417 by: Boyan Nedkov
        168420 by: Dan Anderson
        168421 by: Rob Adams
        168423 by: Dan Anderson
        168424 by: Boyan Nedkov

Mail Delivery Acknowledgement
        168418 by: imran.pak-vision.com
        168422 by: Comex
        168425 by: imran.pak-vision.com

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
> I would like to setup a mailing list for my company.
> I have a database containing email address of my clients along with other
> details.
> How can I send them mails ?
> If i write a script containing the mail function and loop the address, I
> think that might generate a script timeout error. I feel increasing the
> script timeout is not a good solution. I would like to know how you manage
> such situations. I feel this is a common problem but i didnt find any
> solution on the net. Do I need to use any sw or are there any already
> available scripts.

I built a queuing system to email to a large list. The general approach is
to add a database table that stores the email message and tracks progress
through the list. A PHP script called by a crontab checks the database to
see if a mailing is in progress. If so, it selects a certain number of
addresses and sends the message. By controlling the number of addresses
selected and how often the crontab calls the script, the email rate is
controlled. And using a crontab makes it a background process. The email
message is created and list progress monitored through a content management
system.

--
Lowell Allen

--- End Message ---
--- Begin Message ---
PHPLover --

...and then PHPLover said...
% 
% Dear All,
% 
% I would like to setup a mailing list for my company.

Then set up a mailing list.


% I have a database containing email address of my clients along with other
% details.

That's good.


% How can I send them mails ?

I would highly recommend ezmlm for mailing list software.  It does a
fantastic job.

Now if you actually mean to send customized letters you'll have to inject
each one singly, which really gets time-consuming.

In either case, I would avoid having php do your actual mailing; use the
web interface for selecting recipients, creating your message body, and
whatnot, but then hand off the actual mailing work to a separate process
(and don't expect to wait until it finishes).


% If i write a script containing the mail function and loop the address, I
% think that might generate a script timeout error. I feel increasing the
% script timeout is not a good solution. I would like to know how you manage

We run a fan / marketing site for various clients (bands, video game
companies, whatnot) which offer content for those interested, a vanity
email address, and regular newsletters offsite to the "base" addresses.
Through moderate but not insane tuning I've managed to get our mail
processing down to about 120ms per message; that gives me in excess of
25k messages queued per hour, which is near our target of 60k emails
within two hours (and of course some of those take longer because of
timeouts and retries and such).  Even so, there's obviously no way that a
web browser would wait around for that kind of delay.

We follow a model similar to that of another poster; our subscribers are
in a database along with the massmail info and a cron job checks for
queued jobs and processes them.  It would be a lot easier if we could
send out a general letter, but fans like it when you address them by name
and so on :-/


% such situations. I feel this is a common problem but i didnt find any
% solution on the net. Do I need to use any sw or are there any already
% available scripts.

I agree that it's a common problem.  The reason you didn't find your
answers was because you looked for the wrong ones :-)


% 
% Thanks a Lot !!
% Long Live PHP !!
% 
% Thanks & Regards, 
% ___________________________ 
% PHPLover
% "Göd döësn't pläy dícë." 
% - Älbërt Ëínstëín

Is there something wrong with your vowels?


HTH & HAND

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00000.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
[snip]
Inappropirate but intruiging nonetheless.
[/snip]

Maybe not so inappropriate as you could use C++ dll's ...calling them
from PHP, passing variables, etc.

--- End Message ---
--- Begin Message ---
        The issue of entering Japanese into email from a PHP script has
been resolved. A key point was that when creating a header for an email,
not only should \r\n be used to separate lines, but immediately
preceding \r\n should be a space.
        The end result was to create a variable that goes into the final
space in the mail() command where one puts additional headers which
looks like this:

$headers = $fromaddress . " \r\nContent-Type: text/plain;
charset=iso-2022-jp";

        Thanks Marek, Eugene, and Edwin for their advice on this matter,
and of storing kanji in a MySQL database.

-- 
Cheers!
Dave G
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
>a production box running 4.2.2 recently had a script added to it requiring use
>of xml functionality.  The box was already compiled (a few versions earlier)
>with the --with-xml option.  Since then, have upgraded this box twice
>(though it
>is due for another) using config.nice to ensure the same options are installed.
>
>have configured this as an apache module and as the CGI...  the apache module
>uses the XML functions just fine.  The CGI however gives the error in the
>subject.
>
>Have compared phpinfo() on each, and added extension_dir and include_dir to the
>standalone php's php.ini so that it matches the apache module version, still no
>joy.
>
>Any thoughts, recommendations, or hints as to what I may be missing which would
>cause the cgi version not to compile with the xml features even when
>the --with-xml option is and has been specified since 4.0.x and through every
>upgrade since then thanks to using the same config.nice.

any takers on this?

Dave

--- End Message ---
--- Begin Message ---
I have an XML document as a string $strXml, that looks a little like this:

<recordset>
    <row>
        <userid>1</userid>
        <username>Bob</username>
        <password>Rover</username>
    </row>
    <row>
        <userid>2</userid>
        <username>Fred</username>
        <password>Fido</username>
    </row>
</recordset>

What's the best way to grab a single value from this document? In the past
(in
VB), I have loaded the XML into a DOM Document, and used an XPath query to
select the data I want, and then bung the output into a string.

Any suggestions?

Thanks
Ian

--- End Message ---
--- Begin Message --- Ian Williams wrote:
I have an XML document as a string $strXml, that looks a little like this:

<recordset>
    <row>
        <userid>1</userid>
        <username>Bob</username>
        <password>Rover</username>
    </row>
    <row>
        <userid>2</userid>
        <username>Fred</username>
        <password>Fido</username>
    </row>
</recordset>

What's the best way to grab a single value from this document? In the past
(in
VB), I have loaded the XML into a DOM Document, and used an XPath query to
select the data I want, and then bung the output into a string.

Any suggestions?

You can do the same bunging in PHP if your php setup has domxml enabled. Or you can use the (faster, but batch-like) SAX parser.

More information : http://www.php.net/xml

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com

--- End Message ---
--- Begin Message ---
I want to replace something like this:

$sql = "CREATE TABLE bas_table (
            )";

With this:

"CREATE TABLE hugo_table (
)";

And do the same for INSERT INTO... How do i do this?

Regards,

Bas

--- End Message ---
--- Begin Message ---
[snip]
I want to replace something like this:

$sql = "CREATE TABLE bas_table (
            )";

With this:

"CREATE TABLE hugo_table (
)";

And do the same for INSERT INTO... How do i do this?
[/snip]

Top of the morning to you Bas!

I have a couple of questions for you.

1. Have you read <em>any</em> of the manual?
2. Are you subscribed to the MySQL list?

All queries are run in the same way. If you have permissions in the
database you can do this (for example);

$sqlInsert = "INSERT INTO tableBAS (php, mysql) ":
$sqlInsert .= "VALUES ('knowledge from having read PHP manual', ";
$sqlInsert .= "'knowledge from having read MySQL manual') ";

$dbInsert = mysql_query($sqlInsert, $connectionInformation);

HTH!

--- End Message ---
--- Begin Message ---
No, i mean to replace the names in the string... And then execute them...
"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
I want to replace something like this:

$sql = "CREATE TABLE bas_table (
            )";

With this:

"CREATE TABLE hugo_table (
)";

And do the same for INSERT INTO... How do i do this?
[/snip]

Top of the morning to you Bas!

I have a couple of questions for you.

1. Have you read <em>any</em> of the manual?
2. Are you subscribed to the MySQL list?

All queries are run in the same way. If you have permissions in the
database you can do this (for example);

$sqlInsert = "INSERT INTO tableBAS (php, mysql) ":
$sqlInsert .= "VALUES ('knowledge from having read PHP manual', ";
$sqlInsert .= "'knowledge from having read MySQL manual') ";

$dbInsert = mysql_query($sqlInsert, $connectionInformation);

HTH!

--- End Message ---
--- Begin Message ---
[snip]
No, i mean to replace the names in the string... And then execute
them...
[snip]

*slaps forehead* Duh, just do it?

$sqlCreateTable = "CREATE TABLE `dumBas` ( ";
$sqlCreateTable .= "`ai` int(11) NOT NULL AUTO_INCREMENT, ";
$sqlCreateTable .= "`thing` char(32) default NULL, ";
$sqlCreateTable .= "`stuff` char(16) default NULL, ";
$sqlCreateTable .= "PRIMARY KEY  (`ai`), ";
$sqlCreateTable .= "KEY `thing` (`thing`) ";
$sqlCreateTable .= ") ";
$dbCreateTable = mysql_query($sqlCreateTable, $connectionStuff);

--- End Message ---
--- Begin Message ---
OKAY, I WANT TO REPLACE IN THE TABLENAME THE TEXT BAS_ WITH DUMMY_

SUCH LIKE THAT "CREATE TABLE BAS_DATA" BECOMES "CREATE TABLE DUMMY_DATA"

I AM NOT THAT DUMB... I JUST WANT TO REPLACE 1 TABLE PREFIX BY ANOTHER!!!


"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
No, i mean to replace the names in the string... And then execute
them...
[snip]

*slaps forehead* Duh, just do it?

$sqlCreateTable = "CREATE TABLE `dumBas` ( ";
$sqlCreateTable .= "`ai` int(11) NOT NULL AUTO_INCREMENT, ";
$sqlCreateTable .= "`thing` char(32) default NULL, ";
$sqlCreateTable .= "`stuff` char(16) default NULL, ";
$sqlCreateTable .= "PRIMARY KEY  (`ai`), ";
$sqlCreateTable .= "KEY `thing` (`thing`) ";
$sqlCreateTable .= ") ";
$dbCreateTable = mysql_query($sqlCreateTable, $connectionStuff);

--- End Message ---
--- Begin Message ---
[snip]
OKAY, I WANT TO REPLACE IN THE TABLENAME THE TEXT BAS_ WITH DUMMY_

SUCH LIKE THAT "CREATE TABLE BAS_DATA" BECOMES "CREATE TABLE DUMMY_DATA"

I AM NOT THAT DUMB... I JUST WANT TO REPLACE 1 TABLE PREFIX BY
ANOTHER!!!
[/snip]

Then do it! And quit top posting! And quit yelling! 

--- End Message ---
--- Begin Message ---
On Mon, Nov 03, 2003 at 04:37:41PM +0100, Bas wrote:
> OKAY, I WANT TO REPLACE IN THE TABLENAME THE TEXT BAS_ WITH DUMMY_
> 
> SUCH LIKE THAT "CREATE TABLE BAS_DATA" BECOMES "CREATE TABLE DUMMY_DATA"
> 
> I AM NOT THAT DUMB... I JUST WANT TO REPLACE 1 TABLE PREFIX BY ANOTHER!!!

        sed -i.bak -e s'/BAS_/DUMMY_/g' your_sql_file.sql 

        
                                     -- zhuravlev alexander
                                           u l s t u  n o c

--- End Message ---
--- Begin Message ---
[snip]
I AM NOT THAT DUMB... I JUST WANT TO REPLACE 1 TABLE PREFIX BY
ANOTHER!!!
[/snip]

http://www.php.net/str_replace

--- End Message ---
--- Begin Message --- Bas wrote:
I want to replace something like this:

$sql = "CREATE TABLE bas_table (
            )";

With this:

"CREATE TABLE hugo_table (
)";

And do the same for INSERT INTO... How do i do this?

If you know that "bas_" will not appear within your data, then a simple str_replace() will do.

$new_data = str_replace('bas_','dummy_',$old_data);

If you're not sure, then a regular expression or more inclusive str_replace() would be necessary.

$new_data = str_replace('CREATE TABLE bas','CREATE TABLE dummy',$old_data);

or

$new_data = preg_replace('^CREATE TABLE bas','CREATE TABLE dummy',$old_data);

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
[snip]
does anybody know how php handles daylight saving issues ? 
[/snip]

I am pretty sure that PHP does not 'handle' daylight savings issues at
all, but relies on the server settings for its time base.

--- End Message ---
--- Begin Message ---
On Thu, 2003-10-30 at 17:00, Chris Shiflett wrote:
> So the server where you're running the PHP script can't connect to
> the server you specify in your include() call. So, you can now remove
> PHP from the problem and work on that.
>
> [...]
>
> Hope that helps.
>
> Chris

Thank you Chris..i solved the problem with an etry in /etc/hosts in the
webserver.

Pablo

--- End Message ---
--- Begin Message ---
I have been modifying the quote system I have been writing like mad and
have hit another brick wall of sorts.

I am trying to do a couple of things...
The search is now up and running on just a DESCRIPTION field.  Anything
else at this point is unwieldy.  It works perfectly however I am trying
to add a piece to the puzzle.

What I would LIKE it to do is pass along the keywords back to itself so
that when it is called from within itself it can be on the same search
terms.

I have made the code do this:
<input type=\"hidden\" name=\"url\" value=\"$_SERVER[PHP_SELF]\"> <input
type=\"hidden\" name=\"keyword\" value=\"keyword\">

These are inputs to another form, which just passed this back
   header("Location:$_POST[url]");

I guess what I am missing is another way to pass the KEYWORD from the
first form to the next part to make it seen by the script.

http://www.garlandcnorris.com/quotes

I have completely blown the numbers out of proportion, but you can still
play with it to see what I mean.

I can shoot source out if need be, but this is probably just a stupid
mistake on my part.

TIA!!

Robert

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are three kinds of economist. Those who can count, and those who
can't.

-Eddie George. 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--- End Message ---
--- Begin Message --- Robert Sossomon wrote:

[ snipped ]

What I would LIKE it to do is pass along the keywords back to itself so
that when it is called from within itself it can be on the same search
terms.

I have made the code do this:
<input type=\"hidden\" name=\"url\" value=\"$_SERVER[PHP_SELF]\"> <input
type=\"hidden\" name=\"keyword\" value=\"keyword\">

These are inputs to another form, which just passed this back
   header("Location:$_POST[url]");

I guess what I am missing is another way to pass the KEYWORD from the
first form to the next part to make it seen by the script.

Have you looked at sessions? I don't see why you don't want to use hidden fields, but sessions would be the next thing to look at.


-- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com

--- End Message ---
--- Begin Message ---
> I've been working on a database wrapper class for a while 
> now, MySQL to 
> be specific. Until  now, I've simply had a fetch function 
> that returned 
> an array of all the rows that the database returned, only 
> because I have 
> gotten so tired of always writing the same while loop to 
> iterate through 
> all the rows.
> 
> However, I have discovered that the method I'm using, passing around 
> large multidimensional arrays of text by copy, is extremely memory 
> inefficient, so I am working on a new method. Tell me if this 
> is any better:

[...snip...]

> Where fetch($query, &$array) is the header. In the second case, the 
> fetch function would therefore write the rows directly to the array 
> which was passed as a reference rather than returning a copy. 
> Am I right 
> in thinking that this is a better method?

I hope your new method is the right one, because I do it the same way and
for the same reason :) I haven't done any benchmarks, though. I use
procedural code, but the idea is the same. The calling routine builds the
query string and passes it into a function that executes the query,
processes the results set, puts the results into a hash, and returns a
reference to the hash. The calling routine then gets what it needs out of
the hash. So, one simple scalar gets passed in both directions. I use that
one function for all queries.

Kirk

--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm using the following class for a form with an image in, but I need to use a
function to validate that an image was uploaded with the correct type and
that it's not too large.

I don't seem to be able to access the information about the file from within
the class witrhout using the $_FILES array.  Does anyone have any ideas?


<?php

  require_once 'HTML/QuickForm.php';

  class Form_addShop extends HTML_QuickForm
  {
    function Form_addShop($formName='addShop', $method = 'post', $target =
'_self', $attributes = null)
    {
      $this->HTML_QuickForm($formName, $method, '', $target, $attributes);
      $this->addElement('header', null, 'Add a Shop');
      $this->addElement('text', 'txtName', 'Name', array('size'=>20,
'maxlength'=>50));
      $this->addElement('textarea', 'txtDescription', 'Description');
      $this->addElement('file', 'fileImage', 'Image');
      $this->addElement('submit', null, 'Submit');

      $this->applyFilter('txtName', 'trim');
      $this->applyFilter('txtDescription', 'htmlspecialchars');
      $this->addRule('txtName', 'Name is required', 'required', null,
'server');
      $this->addRule('txtDescription', 'Description is required', 'required',
null, 'server');
      $this->addFormRule(array(&$this,'CheckUpload'));
    }

    function CheckUpload($stuff)
    {
      // shows MAX_FILE_SIZE
      var_dump($stuff);

      // shows nothing (probably due to form not having completed validation
      var_dump($this->exportValue('fileImage'));

      // shows what Iwant
      var_dump($_FILES);

      return array('fileImage' => 'This is not an image');
    }
  }
?>

Kind Regards,

- -- 
Ian P. Christian        
 - [EMAIL PROTECTED]
 - +44 (0) 7740 189415
 - http://www.pookey.co.uk/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/poCXEe6ncNCcEO0RAuoKAJ9KaX06C294btAyTiLI/XVWecrrqACglSiH
ls8Fnw/i89euWHWp5F/WQ20=
=NBo0
-----END PGP SIGNATURE-----

--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 03 November 2003 6:54 pm, Pablo Goose wrote:
> Hi Ian.  If you're trying to access an uploaded file then you have to
> use the $_FILES array.
>
> How is that you had hoped to access this information from outside the
> $_FILES array?

It seems to me that the class provides methods for accessing the uploaded 
file, the class should be providing abstraction from _GET and _POST 
variables, I'm assuming it shoudl do the same with uploaded files.

Or am I wrong?

- -- 
Ian P. Christian        
 - [EMAIL PROTECTED]
 - +44 (0) 7740 189415
 - http://www.pookey.co.uk/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/ptYeEe6ncNCcEO0RAjkFAJ9NaiEbTQ4c/WdNjhqxHBbc4uo2rACeO8bT
dxDaC4cNOGp+wWrTa7hnILE=
=Ws1s
-----END PGP SIGNATURE-----

--- End Message ---
--- Begin Message ---
Hi,

I am publishing a site I have developed and I am having problems with
the scripts being able to access the remote MySQL server. When I try to
connect using the PHP scripts I just get an error saying that access is
denied.

I can access it fine from my machine using PHPMyAdmin so I know that
remote access is being allowed.
I have also connected to the web hosting server via SSH and have
connected successfully to the MySQL server via the MySQL client at the
terminal from that machine. So I know the server that the scripts are
running on also has access to the MySQL server.

Here is my script. Please let me know if you have any ideas why this
would be happening:

-----------------------------------------

<?PHP

/***********************************************************************
**************
*                       Connects to a MySQL database using the Belvedere
account          *
************************************************************************
*************/
function DBMS_CONNECT()
        {
        global $Site_Settings;

        // Connect To DBMS
        $Connection = mysql_connect($Site_Settings['DB_Host'],
$Site_Settings['DB_UserName'], $Site_Settings['DB_Password'])
                or SQL_KillScript("Connecting to DBMS",$Connection);
                
        // Select DB
        if (!mysql_select_db($Site_Settings['DB_Name'],$Connection))
                SQL_KillScript("Selecting Database",$Connection);
                
        // Return the connection variable
        return $Connection;
        }

?>

-----------------------------------

Here is the error message:

MySQL Error 1044 : Access denied for user: '[EMAIL PROTECTED]' to database
'Belvedere'

-----------------------------------

My DB_Host is specified as a domain name. e.g. db1.myhost.com

--- End Message ---
--- Begin Message ---
"Donald Tyler" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I am publishing a site I have developed and I am having problems with
> the scripts being able to access the remote MySQL server. When I try to
> connect using the PHP scripts I just get an error saying that access is
> denied.
>
> I can access it fine from my machine using PHPMyAdmin so I know that
> remote access is being allowed.

PHPMyAdmin doesn't necessarily mean that remote access is allowed.  A user
in MySQL may be able to access the database from the localhost, but not from
anywhere else.  In your case it looks like you may have the same username
defined twice, but with different levels of access.

[EMAIL PROTECTED]     access allowed to database Belvedere.
[EMAIL PROTECTED]  access not allowed to database Belvedere.

Just a guess.

> I have also connected to the web hosting server via SSH and have
> connected successfully to the MySQL server via the MySQL client at the
> terminal from that machine. So I know the server that the scripts are
> running on also has access to the MySQL server.
>
> Here is my script. Please let me know if you have any ideas why this
> would be happening:
>
> -----------------------------------------
>
> <?PHP
>
> /***********************************************************************
> **************
> * Connects to a MySQL database using the Belvedere
> account *
> ************************************************************************
> *************/
> function DBMS_CONNECT()
> {
> global $Site_Settings;
>
> // Connect To DBMS
> $Connection = mysql_connect($Site_Settings['DB_Host'],
> $Site_Settings['DB_UserName'], $Site_Settings['DB_Password'])
> or SQL_KillScript("Connecting to DBMS",$Connection);
>
> // Select DB
> if (!mysql_select_db($Site_Settings['DB_Name'],$Connection))
> SQL_KillScript("Selecting Database",$Connection);
>
> // Return the connection variable
> return $Connection;
> }
>
> ?>
>
> -----------------------------------
>
> Here is the error message:
>
> MySQL Error 1044 : Access denied for user: '[EMAIL PROTECTED]' to database
> 'Belvedere'
>
> -----------------------------------
>
> My DB_Host is specified as a domain name. e.g. db1.myhost.com

--- End Message ---
--- Begin Message ---
What's your favorite JavaScript newsgroup? This group has been invaluable
in helping me learn PHP and need the same for JS.

Thanx,
-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com
http://www.cancerreallysucks.org

--- End Message ---
--- Begin Message --- Robb Kerr wrote:

What's your favorite JavaScript newsgroup? This group has been invaluable
in helping me learn PHP and need the same for JS.

I would highly recommend Evolt ( http://www.evolt.org ) -- I'm a member and a frequent lurker (and sometime poster) on their lists. A lot of expert minds on Evolt, and I see javascript questions on it all the time :)

You should try "The List" mailing list for web development questions.

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com

--- End Message ---
--- Begin Message ---
i found the problem myself, array has to be defined like this:

$b=array[0=>0];

then $b can be any array of any type of index and values as you wish to
"assign" to it.

"Dan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> please help with the following:
>
> I tried this first :
> $b[] = 'Book Worzel, Richard (1989). From Employee to Entrepreneur:  how
to
> turn your experience into a fortune.  Toronto:  Key Porter books.';
> $b[] = 'Book Ries, Al and Jack Trout (1994). The 22 Immutable Laws of
> Marketing.  New York:  Harper Business';
> ...
>
> then tried this :
> $b[0] = 'Book Worzel, Richard (1989). From Employee to Entrepreneur:  how
to
> turn your experience into a fortune.  Toronto:  Key Porter books.';
> $b[1] = 'Book Ries, Al and Jack Trout (1994). The 22 Immutable Laws of
> Marketing.  New York:  Harper Business';
> ...
>
> none of the above work, what's right?
>
> help will be appreciated.
>
> Dan

--- End Message ---
--- Begin Message ---
any warnings, problems, or other issues we should be aware of... production
server, already addressed the register_globals issue

Dave

--- End Message ---
--- Begin Message ---
On 02-Nov-2003 Koala Yeung wrote:
> Thanks a lot
> 
> I'd like to remove newline only.
> Is there any simple way?
> 

rtrim($str, "\r\n");

Regards,
-- 
Don Read                                     [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

--- End Message ---
--- Begin Message --- ...will say if a field is of type "ENUM", but not its possible values (including default). Does anyone know how I can fetch possible values of a field type of ENUM?

Thanks.

...Rene
--- End Message ---
--- Begin Message ---
[snip]
...will say if a field is of type "ENUM", but not its possible values 
(including default). Does anyone know how I can fetch possible values 
of a field type of ENUM?
[/snip]

You would have to use DESCRIBE. So if

DESCRIBE db; //in the mysql table

returns --

+-----------------+-----------------+------+-----+---------+-------+
| Field           | Type            | Null | Key | Default | Extra |
+-----------------+-----------------+------+-----+---------+-------+
| Host            | char(60) binary |      | PRI |         |       |
| Db              | char(64) binary |      | PRI |         |       |
| User            | char(16) binary |      | PRI |         |       |
| Select_priv     | enum('N','Y')   |      |     | N       |       |
| Insert_priv     | enum('N','Y')   |      |     | N       |       |
| Update_priv     | enum('N','Y')   |      |     | N       |       |
| Delete_priv     | enum('N','Y')   |      |     | N       |       |
| Create_priv     | enum('N','Y')   |      |     | N       |       |
| Drop_priv       | enum('N','Y')   |      |     | N       |       |
| Grant_priv      | enum('N','Y')   |      |     | N       |       |
| References_priv | enum('N','Y')   |      |     | N       |       |
| Index_priv      | enum('N','Y')   |      |     | N       |       |
| Alter_priv      | enum('N','Y')   |      |     | N       |       |
+-----------------+-----------------+------+-----+---------+-------+

you can get the info from the `Type` column

--- End Message ---
--- Begin Message ---
"René fournier" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> ...will say if a field is of type "ENUM", but not its possible values
> (including default). Does anyone know how I can fetch possible values
> of a field type of ENUM?

desc $tbl_name;

You'll have to parse it, but it will give you the list of available values.


>
> Thanks.
>
> ...Rene

--- End Message ---
--- Begin Message --- I'm trying to output HP PCL commeands using the printer_write command. For example:

$str=sprintf("\033&d0D"); // Underline Text
$str.="Text to print";
$str.=sprintf("\033cE"); // Reset printer

$handle = printer_open('\\\\DOMAIN\\PSERVER');
printer_write($handle,$str);
printer_close($handle);

The printer is configured for raw output. The output appears to be correct (I've compared the spooled job against one that works, so it would seem to be a problem with the job configuration e.g. the printer_set_option. I've tried using the MODE,"RAW" functio, but when I set this, the printer_write function no-longer works.

can anyone help?

TIA

Mark
--- End Message ---
--- Begin Message ---
What function(s) would you use if you want to take someone's birth day and
format it on display.

I have always used strtotime, then strftime but it doesn't work if someone
was born in 1939. strtotime returns -1.

What function would you use to take the input string "1939/11/23" and get
the timestamp so I can use functions like strftime or date.

Thanks,
Mark.

--- End Message ---
--- Begin Message --- Mark McCulligh wrote:

What function(s) would you use if you want to take someone's birth day and
format it on display.

I have always used strtotime, then strftime but it doesn't work if someone
was born in 1939. strtotime returns -1.

What function would you use to take the input string "1939/11/23" and get
the timestamp so I can use functions like strftime or date.

You'll have to tear it apart and do the math youself. Current year minus the first four digits. If current month/day is less than month/day from string, then subtract one (hasn't reached birthday yet).

If you're storing these dates in a database, you can use your query to calculate the age (unless it used unix timestamps, also).

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Some domain names on .net.au are not being resolved when I use
gethostbyname.  I can whois them on http://whois.ausregistry.net.au/and
fine them, but they can't be pinged.  

Anybody know why this might be?

Thanks in advance,

Dan

--- End Message ---
--- Begin Message ---
the firewall is configured to block pings from outside - security reasons - so called stealth mode



Dan Anderson wrote:
Some domain names on .net.au are not being resolved when I use
gethostbyname. I can whois them on http://whois.ausregistry.net.au/and
fine them, but they can't be pinged.

Anybody know why this might be?

Thanks in advance,

Dan


--- End Message ---
--- Begin Message ---
> the firewall is configured to block pings from outside - security reasons - so 
> called stealth mode

No, you are wrong.  gethostbyname($hostname) correctly resolves my
servers, and I have disabled pings for security reasons. 
gethostbyname($hostname) has nothing to do with pings as a matter of
fact.  It performs a whois lookup and returns the ip address of
$hostname.  

-Dan

--- End Message ---
--- Begin Message ---
"Dan Anderson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > the firewall is configured to block pings from outside - security
reasons - so
> > called stealth mode
>
> No, you are wrong.

If you're going to ask for help, you should take it in whatever form it
comes.  Perhaps he wasn't answering your primary question, but just stating
how it is possible to not have a ping request returned by a valid address.
In which case he is quite right.

 gethostbyname($hostname) correctly resolves my
> servers, and I have disabled pings for security reasons.
> gethostbyname($hostname) has nothing to do with pings as a matter of
> fact.  It performs a whois lookup and returns the ip address of
> $hostname.
>
> -Dan

--- End Message ---
--- Begin Message ---
> If you're going to ask for help, you should take it in whatever form it
> comes.  Perhaps he wasn't answering your primary question, but just stating
> how it is possible to not have a ping request returned by a valid address.
> In which case he is quite right.

I am thankful he answered my question, I am just pointing out that his
answer cannot be correct.  No offense was meant and I hope none was
taken.

-Dan

--- End Message ---
--- Begin Message ---

[snip] ... I can whois them on http://whois.ausregistry.net.au/and fine them, but they can't be pinged.

Anybody know why this might be?
[snip]

I'm just answering your question why they can't be pinged.

You are perfectly right that 'gethostbyname($hostname) has nothing to do with pings as a matter of fact' and then I just wonder why do you try to resolve your gethostname() problem by pinging the hosts, if you know what the answer is.

Possible reason for the problem could be that your DNS provider doesn't have a record in its database for the domain name you try to resolve. Solution - try to find a script (I have such class but written in Delphi) with functionality similar to nslookup so to be able to define another DNS server for the resolving query. This script should also be able to send queries to more than one DNS server if you wish to minimize the amount of the domains unresolved.

Or change your DNS provider with another one more reliable.

HTH

Boyan
--



Dan Anderson wrote:
the firewall is configured to block pings from outside - security reasons - so called stealth mode


No, you are wrong. gethostbyname($hostname) correctly resolves my
servers, and I have disabled pings for security reasons. gethostbyname($hostname) has nothing to do with pings as a matter of
fact. It performs a whois lookup and returns the ip address of
$hostname.

-Dan


--- End Message ---
--- Begin Message ---
Thank you for contacting me

Your e-mail has been forwarded to the appropriate person Mr. Imran Asghar.
  
We welcome all comments and suggestions. 

Due to the high volume of e-mails received, not all e-mails are responded to directly.

All e-mails that are responded to are handled in the order in which they are received. 
 If you need more immediate information or assistance, call us on following telephone 
numbers

+92 3009467711




--- End Message ---
--- Begin Message ---
<[EMAIL PROTECTED]>
[EMAIL PROTECTED]:
> Thank you for contacting me
>
> Your e-mail has been forwarded to the appropriate person Mr. Imran
> Asghar.
>
> We welcome all comments and suggestions.
>
> Due to the high volume of e-mails received, not all e-mails are
> responded to directly.
>
> All e-mails that are responded to are handled in the order in which
> they are received.  If you need more immediate information or
> assistance, call us on following telephone numbers
>
> +92 3009467711

???

--- End Message ---
--- Begin Message ---
Thank you for contacting me

Your e-mail has been forwarded to the appropriate person Mr. Imran Asghar.
  
We welcome all comments and suggestions. 

Due to the high volume of e-mails received, not all e-mails are responded to directly.

All e-mails that are responded to are handled in the order in which they are received. 
 If you need more immediate information or assistance, call us on following telephone 
numbers

+92 3009467711




--- End Message ---

Reply via email to