php-windows Digest 1 Feb 2003 23:14:30 -0000 Issue 1567

Topics (messages 18288 through 18291):

Re: error - permissions?
        18288 by: Stephen Edmonds

Re: Multiple MySQL Queries
        18289 by: Stephen Edmonds

Re: Something like trim()
        18290 by: Cam Dunstan
        18291 by: Cam Dunstan

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 ---
It probably means that your MySQL is not configured to allow for 'root' to
login. If you have phpMyAdmin, you can use it to login to your MySQL server
and set up the user.

Stephen

----- Original Message -----
From: "Pat Johnston" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 01, 2003 3:14 AM
Subject: [PHP-WIN] error - permissions?


> Hi
> I get this error in a login page I've created. I am using root for testing
> purposes only on localhost, but it keeps comming up with access denied.
>
> I am wondering if this is a Windows 2000 permissions problem or are new
> users denied in MySQL? Any idea?
>
> Regards, PJ
>
>
> Warning: mysql_connect() [function.mysql-connect]: Access denied for user:
> 'root@localhost' (Using password: YES) in
c:\web\saddlerat\create_users.php
> on line 19
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--- End Message ---
--- Begin Message ---
Not that I know of. Try taking a look in the php manual (http://www.php.net)
for the MySQL Section. If you can find a method there, then use it.
Otherwise I believe you are better off doing each query one by one. On
another note, if you did do them all at the same time and something went
wrong it makes de-bugging harder...

Stephen

----- Original Message -----
From: "Uttam" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 01, 2003 10:16 AM
Subject: [PHP-WIN] Multiple MySQL Queries


> in MySQL client i can run multiple queries in a single statement like:
>
> "CREATE TEMPORARY TABLE x (a CHAR(6), b FLOAT(12,4)); INSERT INTO x SELECT
> a, sum(*blah*)..FROM y ; SELECT * FROM x INNER JOIN z ....;"
>
> but in PHP ";" is not allowed in function mysql_query().
>
> Is there some workaround for running the above query in PHP in a SINGLE
> mysql_query() call?
>
>
> thanx!
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--- End Message ---
--- Begin Message ---
Cybot, try this ....


function string_dryclean($dirtystring) {
$cleanstring = str_replace("\n", " ", $dirtystring);
$cleanstring = trim(str_replace("\t", " ", $cleanstring));
do {
$cleanstring = str_replace("  ", " ", $cleanstring);
} while (strpos($cleanstring, "  ") > 0);
return $cleanstring;
}


use it like this...

$ugly_evil_string = "      hello    \n\n \n\t   world      \n\n\t   ";

$decent_law_abiding_string = string_dryclean($ugly_evil_string);







----- Original Message -----
From: "cybot" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 01, 2003 1:58 AM
Subject: Re: [PHP-WIN] Something like trim()


> is there no more complicated solution for this? ;-)
>
> nothing for bad!
>
> B.A.T. Svensson wrote:
> > Something like (not tested and compiled - please find the bugs :))
> > will remove white space dups:
> >
> > char *TrimInString(char *pzWashMe)
> > {
> >   if (!pzWashMe) return NULL;
> >
> >   register char *pzMarker = pzWashMe;
> >   bool bStillTrimingString = false;
> >
> >   while (StrReplacee("\t", " ", pzMarkerrReplacee("\n", " ", pzMarker))
> >      ;;
> >
> >   while (*pzMarker) { // loop 1
> >     bool bStillTrimingString = false;
> >
> >     while (*pzMarker && !isspace(*(pzMarker++))  // loop 2
> >      ;;
> >
> >     register int nIndex = 0;
> >     while (isspace(*(pzMarker+nIndex++)) { // loop 3
> >       bStillTrimingString = true;
> >     }
> >
> >     if (nIndex) {
> >       strcpy(pzMarker, (pzMarker + nIndex));
> >     }
> >
> >    }
> >
> >    return pzMarker;
> >
> > }
> >
> > First it replace tabs and newlines with blank spaces, then
> > the function will scann the string after a whitespace (loop 2).
> > If it finds one. Then it will try to justify the hypothese H that
> > this white space is followed by another white space (loop 3). If
> > H is true it will count the number of whitepace, and then move
> > the moving down data to just leave the first white space left.
> >
> > After that it falls into loop 1 again and check if we reach the
> > end of the string or not, if not, we do all the things once again.
> >
> >
> >
> >>-----Original Message-----
> >>From: Bobo Wieland [mailto:[EMAIL PROTECTED]]
> >>Sent: Thursday, January 30, 2003 8:26 AM
> >>To: [EMAIL PROTECTED]
> >>Subject: [PHP-WIN] Something like trim()
> >>
> >>
> >>Is there an easy way to get rid off white space characters in a string?
Like
> >>trim() but for the whole string and leaving single white spaces as they
are
> >>but removing all occurences of '\t','\n' and '     '(leaving a single '
> >>')...
> >>
> >>I've tried the manual but couldn't find anything...
> >>
> >>
> >>
> >>. bobo . www.elstudion.com . www.elstudion.com/bobo .
> >>
> >>
> >>--
> >>PHP Windows Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
>
> --
> Sebastian Mendel
>
> [EMAIL PROTECTED]
>
> www.sebastianmendel.de
> www.tekkno4u.de
> www.nofetish.com
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--- End Message ---
--- Begin Message ---
Yep, that`s better still - a nice succinct little one liner Jill.

I avoid the ereg_ function family like the plague myself but that`s my
problem, your solution  is entirely correct.



----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 01, 2003 9:50 PM
Subject: RE: [PHP-WIN] Something like trim()


> Or just
>
> $cleanstring = ereg_replace("[ \t\n]+"," ",trim($dirtystring));
>
> Jill
>


--- End Message ---

Reply via email to