PHP Help

Associate
Joined
5 Feb 2006
Posts
129
Location
Birmingham
Just after a little help, extract a number from a website using eregi() the pattern i use is $pattern = '([0-9][,][0-9][0-9][0-9])'; and the number is 0,000 it works fine but i am worried if the number ever drops below 1000 or higher than 9,999 it will break because of the [,] could anyone help me with this!
 
im also having a problem, im trying to make a counter by using MySQL, and am getting told what to do by a VTM

i type in this:

<?php
require ($_server ["DOCUMENT_ROOT"]. "C:/Documents and Settings/Adam-Paul/My Documents/Website/Webroot/config/db_config.php");
$connection = mysql_connect ($db_host, $db_user, $db_password) or die ("error getting connection");
echo "connection successful";

?>

and get this messege when viewing it on a browser:

Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in c:\documents and settings\adam-paul\my documents\website\webroot\temp_con.php on line 3
error getting connection

Does anyone know what could be wrong with this? I have tried it with something else but i still get the same messege about the mysql_connect() part, am i doing something wrong?
 
anotherF said:
Just after a little help, extract a number from a website using eregi() the pattern i use is $pattern = '([0-9][,][0-9][0-9][0-9])'; and the number is 0,000 it works fine but i am worried if the number ever drops below 1000 or higher than 9,999 it will break because of the [,] could anyone help me with this!

Anybody help with my question please, the one i started the thread for before being hijacked.
 
Thanks another question on the same subject is it possible to match a somthing if you dont know how many characters there are example i want to mach a number 12121 or 12121212121 it changes everytime the code before is the same always though!
 
Yup. I don't know about POSIX (eregi()) but in PCRE (preg_match()) you can use the * operator to mean "0 or more of the preceding character" or + to mean "1 or more of the preceding character" and you can use brackets to group. So something like (12)+ :)

preg_match is supposed to be quicker, too :)
 
addy_010 said:
ok smartypants, whats the solution? havent noticed you post in my other thread. I dont see much so sos if you already have
Well if you're going to be rude I'm not going to help much :p

Check out DJ_Jester's link - it looks like you're using different versions of MySQL/PHP and you need to do some fiddling. How old is the tutorial? (ie, which versions of PHP/MySQL is it using to teach you)
 
Beansprout said:
Check out DJ_Jester's link - it looks like you're using different versions of MySQL/PHP and you need to do some fiddling. How old is the tutorial? (ie, which versions of PHP/MySQL is it using to teach you)

oh gosh my tutorial is like 4 years old now, im using 3dbuzz free ones, there using i think mySQL version 4.1.1 if thats correct? it has a 4 in it, and cant remember which PHP but again i beleive it was an old version. Ill check out that place you suggested now. thanks.
 
Back
Top Bottom