Ask a Question related to Dreamweaver AppDev, Design and Development.
-
Ian50 #1
Dealing with empty fields from database query
Using the procedure in the Dreamweaver manual for building search/result pages
I'm trying to retrieve data from MYSQL database and put it into a column in my
results document aligned with a text item describing the result found eg text
is address line 1, address line 2, address line 3 etc and the corresponding
data is reported alongside
All works well unless address line 2 is a legitimate blank field in which case
data is returned against line 1 and line 2 only and my alignment goes all wrong
I'm sure it's so straightforward to resolve but I just can't find the answer
anywhere
Help would be sincerely appreciated
Regards
Ian
<?php require_once('../../Connections/dbconnect.php'); ?>
<?php
$colname_Recordset1 = "1";
if (isset($_GET['recordID'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['recordID'] :
addslashes($_GET['recordID']);
}
mysql_select_db($database_dbconnect, $dbconnect);
$query_Recordset1 = sprintf("SELECT * FROM profile WHERE ID = %s ORDER BY club
ASC", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $dbconnect) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<html>
<head>
<title>masterpage</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
font-family: Verdana;
font-size: 13px;
}
body {
margin-top: 0px;
margin-left: 25px;
}
.style3 {
color: #993366;
font-style: italic;
}
-->
</style>
</head>
<body>
<table width="710" border="0" align="center" cellpadding="2"
cellspacing="0">
<!--DWLayoutTable-->
<tr valign="top">
<td height="55" colspan="4" valign="top"><p align="left">You are here
> <span class="style3">Club Profile</span></p>
<div align="justify"><br>
</div>
</td>
</tr>
<tr valign="top">
<td width="126" height="300" valign="top">
<p>Club</p>
<p>Clubhouse phone</p>
<p>Address</p>
</td>
<td width="211" valign="top">
<p><?php echo $row_Recordset1['club']; ?></p>
<p><?php echo $row_Recordset1['phone']; ?></p>
<p><?php echo $row_Recordset1['add1']; ?></p>
<p><?php echo $row_Recordset1['add2']; ?></p>
<p><?php echo $row_Recordset1['add3']; ?></p>
<p><?php echo $row_Recordset1['add4']; ?></p>
<p><?php echo $row_Recordset1['add5']; ?></p>
</td>
<td width="146" valign="top">
<p>Principal contact</p>
<p>Designation</p>
<p>Phone</p>
<p>E-mail</p>
<p>Address</p>
</td>
<td width="211" valign="top">
<p><?php echo $row_Recordset1['contact']; ?></p>
<p><?php echo $row_Recordset1['designation']; ?></p>
<p><?php echo $row_Recordset1['cphone']; ?></p>
<p><?php echo $row_Recordset1['email']; ?></p>
<p><?php echo $row_Recordset1['cadd1']; ?></p>
<p><?php echo $row_Recordset1['cadd2']; ?></p>
<p><?php echo $row_Recordset1['cadd3']; ?></p>
<p><?php echo $row_Recordset1['cadd4']; ?></p>
<p><?php echo $row_Recordset1['cadd5']; ?></p>
</td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
Ian50 Guest
-
Empty Fields
I am new to CF. I am trying to figure out how to remove blank lines from my output when there are no values for a particular field in the database.... -
dealing with empty date strings
Have a query that pulls out the closest delivery date to today’s date, from two columns in a table. These columns are airdate and seadate and are... -
CFMX7 empty string in Database Query
Hi All, I am currently evaluating Coldfusion 7 for the company I work for to see if we can seamlessly upgrade from 6.1 to 7 without any code... -
How come if you use a rs.fields(0).value it sometimes is empty?
Why does this happen: the code below works fine as-is. If I take out tempValue = rs.fields(i).value and put rs.fields(i).value everywhere... -
Omitting form fields if empty
I have a form I'm putting together. The processing will be on a PHP script that will take all the field names and print them out on the email it...



Reply With Quote

