Please help me on how to edit this to display the picture field with an image from my db.
Thanks
MySQL
<?php require_once('Connections/conn_hostels.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;
}
}
$colname_rsEresults = "-1";
if (isset($_POST['hostel_name'])) {
$colname_rsEresults = $_POST['hostel_name'];
}
$colname2_rsEresults = "-1";
if (isset($_POST['institution_nearest'])) {
$colname2_rsEresults = $_POST['institution_nearest'];
}
$colname3_rsEresults = "-1";
if (isset($_POST['category'])) {
$colname3_rsEresults = $_POST['category'];
}
$colname4_rsEresults = "-1";
if (isset($_POST['district'])) {
$colname4_rsEresults = $_POST['district'];
}
mysql_select_db($database_conn_hostels, $conn_hostels);
$query_rsEresults = sprintf("SELECT * FROM hostel_details WHERE hostel_name = %s OR institution_nearest = %s OR category = %s OR district = %s", GetSQLValueString($colname_rsEresults, "text"),GetSQLValueString($colname2_rsEresults, "text"),GetSQLValueString($colname3_rsEresults, "text"),GetSQLValueString($colname4_rsEresults, "text"));
$rsEresults = mysql_query($query_rsEresults, $conn_hostels) or die(mysql_error());
$row_rsEresults = mysql_fetch_assoc($rsEresults);
$totalRows_rsEresults = mysql_num_rows($rsEresults);
?><!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 border="1">
<tr>
<td>hostel_id</td>
<td>hostel_name</td>
<td>institution_nearest</td>
<td>direction_from_institution</td>
<td>distance_from_institution</td>
<td>category</td>
<td>location</td>
<td>district</td>
<td>price_per_sem</td>
<td>contact_person</td>
<td>contact_numbers</td>
<td>address</td>
<td>remarks</td>
<td>picture</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_rsEresults['hostel_id']; ?></td>
<td><?php echo $row_rsEresults['hostel_name']; ?></td>
<td><?php echo $row_rsEresults['institution_nearest']; ?></td>
<td><?php echo $row_rsEresults['direction_from_institution']; ?></td>
<td><?php echo $row_rsEresults['distance_from_institution']; ?></td>
<td><?php echo $row_rsEresults['category']; ?></td>
<td><?php echo $row_rsEresults['location']; ?></td>
<td><?php echo $row_rsEresults['district']; ?></td>
<td><?php echo $row_rsEresults['price_per_sem']; ?></td>
<td><?php echo $row_rsEresults['contact_person']; ?></td>
<td><?php echo $row_rsEresults['contact_numbers']; ?></td>
<td><?php echo $row_rsEresults['address']; ?></td>
<td><?php echo $row_rsEresults['remarks']; ?></td>
<td><?php echo $row_rsEresults['picture']; ?></td>
</tr>
<?php } while ($row_rsEresults = mysql_fetch_assoc($rsEresults)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($rsEresults);
?>
Edited by WingedPanther, 04 September 2010 - 04:24 AM.
add code tags (the # button)


Sign In
Create Account

Back to top









