Skip to main content
May 21, 2009
Question

Advanced recordset problems

  • May 21, 2009
  • 1 reply
  • 411 views

I have made an advanced recordset.  The select statement works fine when testing within Dreamweaver in the Advanced Recordset dialog.  It does select the right set of records.  But when put it on the web server, it errors out.  Here is the URL: http://profiles.studyusa.com/test_result.php?l=English

Any help on this would be very much appreciated.  I am familiar with using recordsets, but am not too deep of a programer, and this is beyond me to figure out.

Thanks,

John

And here is the page code:

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

<?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;

}

}

$varlang_Recordset1 = "english";

if (isset($_GET('l'))) {

  $varlang_Recordset1 = $_GET('l');

}

mysql_select_db($database_profiles, $profiles);

$query_Recordset1 = sprintf("SELECT * FROM profiles WHERE profile_States LIKE '%%multiple%%'  AND l = %s", GetSQLValueString($varlang_Recordset1, "text"));

$Recordset1 = mysql_query($query_Recordset1, $profiles) 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>

<?php do { ?>

  <?php echo $row_Recordset1['profile_SchoolName']; ?><br />

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

</body>

</html>

<?php

mysql_free_result($Recordset1);

?>

This topic has been closed for replies.

1 reply

May 21, 2009

Never mind, I finally figured it out.  Whew...