[PHP] Array query - finding the key for a value

2002-08-16 Thread Tim Fountain
I know I can use in_array() to check whether, say, 'orange' is in the array; but how do I then find out which index 'orange' is at? -- Tim Fountain ([EMAIL PROTECTED]) http://www.tfountain.co.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] preg_match() occurence position

2002-07-25 Thread Tim Fountain
a test'; > if(preg_match("/(.*)test/",$mem,$matches)) { > echo strlen($matches[1]); > } > Of course, if "test" occurs more than once then the above won't > work, since regex's are "greedy"... If you add a ? after the * then that'll mak

Re: [PHP] Using PHP with MySQL - Can I supress MySQL errors?

2002-07-23 Thread Tim Fountain
ment, storing the message in your array, e.g.: $result = @mysql_connect('blah','blah','blah') or some_error_function(); or I guess you could also do: $result = @mysql_connect('blah','blah','blah'); if (!$result) { $error_array[] = mysql_error