Jump to content

[SOLVED] Trouble bringing back data from database


spoco

Recommended Posts

I keep getting this error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<>' at line 1

 

The connection is working fine on other files, but this page will not load. Does anyone see anything?

 

<?php require_once('Connections/thinkingmaps.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;
}
}

mysql_select_db($database_thinkingmaps, $thinkingmaps);
$query_comments = "SELECT name, comments FROM survey ORDER BY name ASC<>";
$comments = mysql_query($query_comments, $thinkingmaps) or die(mysql_error());
$row_comments = mysql_fetch_assoc($comments);
$totalRows_comments = mysql_num_rows($comments);
?>
<!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>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
}
-->
</style></head>

<body>
<p> </p>
<table width="672" border="2" align="center" cellpadding="3" cellspacing="3" bordercolor="#000000">
  <tr>
    <td width="169"><strong>Teacher Name</strong></td>
    <td width="484"><strong>Comments</strong></td>
  </tr>
  <?php do { ?>
    <tr>
      <td><?php echo $row_comments['name']; ?></td>
      <td><?php echo $row_comments['comments']; ?></td>
    </tr>
    <?php } while ($row_comments = mysql_fetch_assoc($comments)); ?>
</table>
<p> </p>
</body>
</html>
<?php
mysql_free_result($comments);
?>

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.