Hi
I am having trouble displaying the the CONCAT line in my webpage, it works within the Dreamweaver test enviroment but not on the web page, here is the error -
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ']' in /home/phcleani/public_html/database.php on line 74
Any pointers for a newbie please.
Thanks,
Phil
and here is the script -
<php require_once('Connections/zen.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;
}
}
$maxRows_recordset2 = 10;
$pageNum_recordset2 = 0;
if (isset($_GET['pageNum_recordset2'])) {
$pageNum_recordset2 = $_GET['pageNum_recordset2'];
}
$startRow_recordset2 = $pageNum_recordset2 * $maxRows_recordset2;
mysql_select_db($database_zen, $zen);
$query_recordset2 = "SELECT CONCAT(zen_address_book.entry_firstname, ' ', zen_address_book.entry_lastname), zen_address_book.entry_street_address, zen_address_book.entry_suburb, zen_address_book.entry_city, zen_address_book.entry_postcode FROM zen_address_book";
$query_limit_recordset2 = sprintf("%s LIMIT %d, %d", $query_recordset2, $startRow_recordset2, $maxRows_recordset2);
$recordset2 = mysql_query($query_limit_recordset2, $zen) or die(mysql_error());
$row_recordset2 = mysql_fetch_assoc($recordset2);
if (isset($_GET['totalRows_recordset2'])) {
$totalRows_recordset2 = $_GET['totalRows_recordset2'];
} else {
$all_recordset2 = mysql_query($query_recordset2);
$totalRows_recordset2 = mysql_num_rows($all_recordset2);
}
$totalPages_recordset2 = ceil($totalRows_recordset2/$maxRows_recordset2)-1;
?><!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="100%" border="1">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<?php do { ?>
<tr>
<td> </td>
<td><?php echo $row_recordset2['CONCAT(zen_address_book.entry_firstname, ' ', zen_address_book.entry_lastname)']; ?></td>
<td><?php echo $row_recordset2['entry_street_address']; ?></td>
<td><?php echo $row_recordset2['entry_suburb']; ?></td>
<td><?php echo $row_recordset2['entry_city']; ?></td>
<td><?php echo $row_recordset2['entry_postcode']; ?></td>
<td> </td>
<td> </td>
</tr>
<?php } while ($row_recordset2 = mysql_fetch_assoc($recordset2)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($recordset2);