I have a line like this 2 661,38 € and I need an echo of 661,38 , but I can't get to the solution
I made the following code:
$connection=mysql_connect('localhost','root','****') or die(mysql_error()); mysql_select_db('DB',$connection) or die(mysql_error()); $sql = mysql_query("select distinct prod_price COL from TABLE") or die(mysql_error()); ?> <?php while($row=mysql_fetch_object($sql)):?> <?php if(mysql_num_rows($sql)>0){ $number = $row->COL; $temp=explode(' ',$number); $number = preg_replace("/[^0-9]/", '', $temp[0])/100; echo number_format($number, 2, ',', ' '). "<br />"; } ?> <?php endwhile;?>
Can anyone help me remove this 2 from first place?
The solution I got does not help me, so I put all the code in order to understand the situation I'm stuck in ... see the code snippet ... The above code gives me the following notification:
Note: Undefined offset: 2 in /var/www/html/login/str.php on line 26 0.00
php mysql
user3305327
source share