How to get regex split from other var

Posted by Dean on Stack Overflow See other posts from Stack Overflow or by Dean
Published on 2011-01-10T05:51:58Z Indexed on 2011/01/10 5:53 UTC
Read the original article Hit count: 198

Filed under:
|

Hi,

$dbLink = mysql_connect('localhost', 'root', 't');
mysql_select_db('pc_spec', $dbLink);
$html = file_get_contents('http://localhost/pc_spec/scrape.php?q=amd+955'); 
echo $html; 
$html = strip_tags($html);
$price = ereg("\$.{6}", $html);
$html = mysql_real_escape_string($html);
$price = mysql_real_escape_string($price);
$insert = mysql_query("INSERT INTO parts(part, price) values('$html','$price')") or  var_dump(mysql_error());

How can I get $price to match $.{6} and insert this value (eg. $111.11) into a database and remove it from $html? Do I need to use explode?

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql