All pastes #917084 Raw Edit

Untitled

public text v1 · immutable
#917084 ·published 2008-02-25 03:26 UTC
rendered paste body
<?php
$_SESSION['last_memberId'] = 22;

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_Recordset1 = "-1";
if (isset($_SESSION['last_memberId'])) {
  $colname_Recordset1 = $_SESSION['last_memberId'];
}
mysql_select_db($database_Monqiboy, $Monqiboy);
$query_Recordset1 = sprintf("SELECT members_addresses.*, citystatezip.stateAb, citystatezip.city, citystatezip.state FROM (members_addresses LEFT JOIN citystatezip ON citystatezip.zip=members_addresses.zip)  WHERE members_addresses.member_id = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $Monqiboy) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

mysql_free_result($Recordset1);
?>