Jump to content

GET and query string


dflow

Recommended Posts

dflow, please post ALL the relevant code.  We don't know how $row_RsPDetails['CountryID'] is created.  Do you have debugging on for both PHP and your query statements? 

 

Like Yesideez said, we need more information or we're just guessing!

Link to comment
https://forums.phpfreaks.com/topic/138169-get-and-query-string/#findComment-722503
Share on other sites

CountryID is VARCHAR

 

here is the code

 

<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $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;
}
}

$colname_RsPDetails = "-1";
if (isset($_GET['ProductID'])) {
  $colname_RsPDetails = $_GET['ProductID'];
}
mysql_select_db($database_international, $international);
$query_RsPDetails = sprintf("SELECT * FROM products WHERE ProductID = %s", GetSQLValueString($colname_RsPDetails, "int"));
$RsPDetails = mysql_query($query_RsPDetails, $international) or die(mysql_error());
$row_RsPDetails = mysql_fetch_assoc($RsPDetails);
$totalRows_RsPDetails = mysql_num_rows($RsPDetails);

mysql_select_db($database_international, $international);
$query_RsCountry = "SELECT * FROM country_list WHERE CountryID = $row_RsPDetails['CountryID']";
$RsCountry = mysql_query($query_RsCountry, $international) or die(mysql_error());
$row_RsCountry = mysql_fetch_assoc($RsCountry);
$totalRows_RsCountry = mysql_num_rows($RsCountry);
?>

Link to comment
https://forums.phpfreaks.com/topic/138169-get-and-query-string/#findComment-723140
Share on other sites

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.