Jump to content

[SOLVED] Need to replace data from mysql query using php


bobbybowyer

Recommended Posts

Hi bobbybowyer,

 

Just use str_replace (http://us2.php.net/str_replace)

 

i.e.

 

$newoutput = str_replace("-1.00", "N/A", $output);

echo $newoutput;

 

The above example assumes $output is the variable you are using to display the data containing the -1.00 figure.

 

Hope this helps

<?php require_once('Connections/bilz.php'); ?>

 

<?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

  if (PHP_VERSION < 6) {

    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  }

 

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

 

  switch ($theType) {

    case "text":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;   

    case "long":

    case "int":

      $theValue = ($theValue != "") ? intval($theValue) : "NULL";

      break;

    case "double":

      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";

      break;

    case "date":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;

    case "defined":

      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

      break;

  }

  return $theValue;

}

}

 

mysql_select_db($database_bilz, $bilz);

$query_Recordset1 = "SELECT tbldomainpricing.id, tbldomainpricing.extension, tbldomainpricing.`order`, tblpricing.type, tblpricing.relid, tblpricing.msetupfee, tblpricing.qsetupfee FROM tbldomainpricing, tblpricing WHERE tblpricing.relid = tbldomainpricing.id  AND tblpricing.type = 'domainregister' ";

$Recordset1 = mysql_query($query_Recordset1, $bilz) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

 

<title>Untitled Document</title>

</head>

 

<body>

 

<table width="280" border="0" class="data">

  <tr>

    <td nowrap="nowrap">typeTLD</td>

    <td nowrap="nowrap">1 Year</td>

    <td nowrap="nowrap">2 Year</td>

  </tr>

  <?php do { ?>

    <tr>

      <td nowrap="nowrap"><?php echo $row_Recordset1['extension']; ?></td>

      <td nowrap="nowrap">$<?php echo $row_Recordset1['msetupfee']; ?></td>

      <td nowrap="nowrap">$<?php echo $row_Recordset1['qsetupfee']; ?></td>

    </tr>

    <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>

</table>

 

</body>

</html>

<?php

mysql_free_result($Recordset1);

?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.