Re: [PHP-DB] Search witin text.

2007-02-11 Thread Christopher Blöcker

you can use  explode

from php.net:
 array *explode* ( string $delimiter, string $string [, int $limit] )
Returns an array of strings, each of which is a substring of /string/ 
formed by splitting it on boundaries formed by the string /delimiter/. 
If /limit/ is set, the returned array will contain a maximum of /limit/ 
elements with the last element containing the rest of /string/. 


as delimiter you would use a space character in this case. for example:

the user input is   $input = Chris Carter;
now you can  $split = explode( , $input);
so $split would be an array that contains  [Chris, Carter]

now you can persorm your search using $split[0] and/or $split[1]

;) I hope that's what you're looking for

Chris Carter wrote:

Thanks much ... this has been achieved now. However, there is another issue.
Say for example, the user wants to search 'Chriscarter' but puts into the
search field 'Chris Carter' how is it that I can take only the 'Chris' out
of the search string and present the matching searches from the database?

Any clue or link would be of great assistance.

Thanks again.


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] help with mysql connect error

2007-02-11 Thread Chris

Tim McGeary wrote:



Chris wrote:

Tim McGeary wrote:

Stut wrote:

Ok, so I did the recommended process of:

mysql UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')
- WHERE Host = 'some_host' AND User = 'some_user';
mysql FLUSH PRIVILEGES;

This allows the CLI script to run successfully, but the web php file 
still gives me the original error.  Any ideas?  The error again is:


Warning: mysql_connect(): Can't connect to local MySQL server through 
socket '/var/lib/mysql/mysql.sock' (13) in 
/var/www/html/software/index.php on line 18
Can't connect to local MySQL server through socket 
'/var/lib/mysql/mysql.sock' (13)


'13' means permission denied.

$ perror 13
System error:  13 = Permission denied

What are the permissions on the /var/lib/mysql/ directory? Maybe php 
can't get into that, thus it can't get to the socket file.


Try

chmod 755 /var/lib/mysql

to allow any user to be able to read files in that folder (but not 
change anything)...


You are correct, it was the directory permissions!  Thank you so much. 
That is also great information about what the error numbers mean.  Where 
or how can I find out what those numbers mean for future reference?


With a *nix / *bsd shell, pass it to 'perror':

perror XXX

and if perror knows what it is, it will let you know... mysql (or other 
apps) might use numbers that perror doesn't know, then it becomes a bit 
tougher but a search usually helps.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php