如何设置价格行是否很快合并而不是显示更新


how to set if price row is comming soon than show update soon

如何设置价格行是否很快合并而不是显示更新

如何设置价格行是否很快合并而不是显示更新

mysql

<?

    //connect to database
     mysql_connect('localhost','phone','pasword');
     mysql_select_db('phone');
//////Displaying Data/////////////
$id=$_GET['id']; // Collecting data from query string
if(!is_numeric($id)){ // Checking data it is a number or not
echo "Data Error"; 
exit;
}
$result = mysql_query("SET NAMES utf8"); //the main trick
$q=mysql_query("select * from price where id=$id AND TRIM(model) IS NOT NULL");
//Adds one to the counter
 mysql_query("UPDATE price SET counter = counter + 1 where id=$id ");
 //Retreives the current count
 $count = mysql_fetch_row(mysql_query("SELECT counter FROM price"));
$row=mysql_fetch_object($q);
echo mysql_error();
echo "<table class='hovertable'><tr><td><img src='admin/media/$row->photo' ></td></tr>";
echo "</table>";
?>

示例

我的行

2000
3000
comming soon
4900
and this code is showing like this
2000
2000
3000
Warning: number_format() expects parameter 1 to be double, string given in
4900

and i want like this
2000
2000
3000
update soon
4900

如何解决这个问题请帮我解决这个问题

<?php if($row->price):?><tr class='"style1'"><td width='200'><b>Price US $:</b></td><td>Price in Dollar: 
    <?php
    function currencyExchange($amount,$baseCurrency,$quoteCurrency) {
    $open = fopen("http://quote.yahoo.com/d/quotes.csv?s=$baseCurrency[0]$quoteCurrency[0]=X&f=sl1d1t1c1ohgv&e=.csv", "r");
    $exchangeRate = fread($open, 2000);
    fclose($open);
    $exchangeRate = str_replace("'"", "", $exchangeRate);
    $exchangeRate = explode(",", $exchangeRate);
    $results = ($exchangeRate[1]*$amount);
    $results = number_format ($results, 2);
    $amount = number_format ($amount);
    $timeStamp = strtotime($exchangeRate[2]);
    $timeStamp = date('F d, Y', $timeStamp);
    $timeStamp = "$timeStamp $exchangeRate[3]";

    echo "$results'n";
    }
    // for additional currency ticker symbols visit: http://finance.yahoo.com/currency-converter
    $usd = array('USD','US Dollars');
    $INR = array('INR','Indian Rupees');
    $usd = array('usd','US DOLLARS');
    $b = str_replace( ',', '', $row->price );
    if( is_numeric( $b ) ) {
        $row->price = $b;
    }

    currencyExchange("$b",$INR,$usd); 
    ?></td></tr><?php endif; ?>

在尝试使用仅适用于数字的函数之前,测试金额是否为数字。

替换:

$results = ($exchangeRate[1]*$amount);
$results = number_format ($results, 2);
$amount = number_format ($amount);

带有:

if (is_numeric($amount)) {
    $results = ($exchangeRate[1]*$amount);
    $results = number_format ($results, 2);
} else {
    $results = 'update soon';
}

您不需要在$amount上调用number_format(),因为您从不打印该值。

将列设置为9999999999(这将解决数字问题),然后测试这些数字的传入,如果找到,则很快返回