[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Inserting graphics based on conditions specified in recordsets (sql).

Posted on 2010-08-16
20
Medium Priority
?
506 Views
Last Modified: 2013-12-13
I've created a figure that shows levels of performance using PHP mysql and Dreamweaver recordsets to specify the criteria for selecting the appropriate figure. Each of the vertical cells in the figure could be occupied by a graphic if certain conditions were met. In the example, only one set of conditions is met (for the LDMA column). The other columns represent missing values. The values are indeed missing. There is not problem in that regard. The issue is: How do I get rid of the boxes with the question marks?
// Code for the graphics 


  <img src="../images/stars/ScaleNos.gif" width="38" height="430" hspace="0" align="top" /><img src="<?php echo $row_rsLasartEthics['stars']; ?>" width="38" height="430" hspace="0" border="0" align="top" class="scalelera" /><img src="<?php echo $row_rsLasartEthics2['stars']; ?>" alt="" width="38" height="430" hspace="0" border="0" align="top" class="scalelera" /><img src="<?php echo $row_rsLasartEthics3['stars']; ?>" alt="" width="38" height="430" hspace="0" border="0" align="top" class="scalelera" /><img src="<?php echo $row_rsLasartEthics4['stars']; ?>" alt="" width="38" height="430" hspace="0" border="0" align="top" class="scalelera" /></div>

Recordset sql for one of the images:


$colname_rsLasartSelf = "-1";
if (isset($_SESSION['kt_login_id'])) {
  $colname_rsLasartSelf = $_SESSION['kt_login_id'];
}
mysql_select_db($database_Assessment, $Assessment);
$query_rsLasartSelf = sprintf("SELECT Lasart.lasartkey, Lasart.lasname, Lasart.stars, LSUAscores.lsuakey, LSUAscores.lasname, LSUA.testtime, LSUA.UserNo, LSUA.lsuakey FROM Lasart, LSUAscores, LSUA WHERE LSUA.UserNo=%s AND Lasart.lasname = LSUAscores.lasname AND LSUAscores.lsuakey=LSUA.lsuakey AND LSUA.testtime=1", GetSQLValueString($colname_rsLasartSelf, "int"));
$rsLasartSelf = mysql_query($query_rsLasartSelf, $Assessment) or die(mysql_error());
$row_rsLasartSelf = mysql_fetch_assoc($rsLasartSelf);
$totalRows_rsLasartSelf = mysql_num_rows($rsLasartSelf);

Open in new window

Example.tiff
0
Comment
Question by:theodawson
  • 11
  • 9
20 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 33450127
Hi theodawson,

"The values are indeed missing."

This can be handled by a little bit of logic in the body of the file.  Without seeing the whole document, I'd have to guess but something like this:

<?php if (!is_null($row_rsLasartSelf['theFieldName'])) { ?>
    image HTML code here
<?php } else { ?>
    &nbsp;
<?php } ?>

So if theFieldName is not null, show image.  Otherwise, just put a non-breaking space or whatever.

0
 

Author Comment

by:theodawson
ID: 33457886
This did not help. I'm very good with Dreamweaver, but not so good with code. I know that I need a statement that says what to do if the return is null, but I don't know how to do it. I need to know exactly what to do in this instance. I've provided the code for the entire page so you can see how it is being handled now.
<?php require_once('../Connections/Assessment.php'); ?>
<?php
// Load the tNG classes
require_once('../includes/tng/tNG.inc.php');

// Make unified connection variable
$conn_Assessment = new KT_connection($Assessment, $database_Assessment);

//Start Restrict Access To Page
$restrict = new tNG_RestrictAccess($conn_Assessment, "../");
//Grand Levels: Level
$restrict->addLevel("1");
$restrict->addLevel("2");
$restrict->addLevel("3");
$restrict->addLevel("4");
$restrict->Execute();
//End Restrict Access To Page

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $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_rsRegistrants = "-1";
if (isset($_SESSION['kt_login_id'])) {
  $colname_rsRegistrants = $_SESSION['kt_login_id'];
}
mysql_select_db($database_Assessment, $Assessment);
$query_rsRegistrants = sprintf("SELECT UserNo, firstname, lastname FROM Registrants WHERE UserNo = %s", GetSQLValueString($colname_rsRegistrants, "int"));
$rsRegistrants = mysql_query($query_rsRegistrants, $Assessment) or die(mysql_error());
$row_rsRegistrants = mysql_fetch_assoc($rsRegistrants);
$totalRows_rsRegistrants = mysql_num_rows($rsRegistrants);

$colname_rsLasartRJ = "-1";
if (isset($_SESSION['kt_login_id'])) {
  $colname_rsLasartRJ = $_SESSION['kt_login_id'];
}
mysql_select_db($database_Assessment, $Assessment);
$query_rsLasartRJ = sprintf("SELECT Lasart.lasartkey, Lasart.lasname, Lasart.stars, LRJA.UserNo, LRJA.LRJAno, LRJAscores.LRJAno, LRJAscores.lasname, LRJA.testtime, LRJA.ManagerStatus FROM Lasart, LRJAscores, LRJA WHERE LRJA.UserNo=%s AND Lasart.lasname = LRJAscores.lasname AND LRJAscores.LRJAno=LRJA.LRJAno AND LRJA.testtime = 1", GetSQLValueString($colname_rsLasartRJ, "int"));
$rsLasartRJ = mysql_query($query_rsLasartRJ, $Assessment) or die(mysql_error());
$row_rsLasartRJ = mysql_fetch_assoc($rsLasartRJ);
$totalRows_rsLasartRJ = mysql_num_rows($rsLasartRJ);

$colname_rsLasartEthics = "-1";
if (isset($_SESSION['kt_login_id'])) {
  $colname_rsLasartEthics = $_SESSION['kt_login_id'];
}
mysql_select_db($database_Assessment, $Assessment);
$query_rsLasartEthics = sprintf("SELECT Lasart.lasartkey, Lasart.lasname, Lasart.stars, LERA.UserNo, LERA.lerakey, LERAscores.lerakey, LERAscores.lasname, LERA.testtime FROM Lasart, LERAscores, LERA WHERE LERA.UserNo=%s AND Lasart.lasname = LERAscores.lasname AND LERAscores.lerakey=LERA.lerakey AND LERA.testtime = 1", GetSQLValueString($colname_rsLasartEthics, "int"));
$rsLasartEthics = mysql_query($query_rsLasartEthics, $Assessment) or die(mysql_error());
$row_rsLasartEthics = mysql_fetch_assoc($rsLasartEthics);
$totalRows_rsLasartEthics = mysql_num_rows($rsLasartEthics);

$colname_rsLasartSelf = "-1";
if (isset($_SESSION['kt_login_id'])) {
  $colname_rsLasartSelf = $_SESSION['kt_login_id'];
}
mysql_select_db($database_Assessment, $Assessment);
$query_rsLasartSelf = sprintf("SELECT Lasart.lasartkey, Lasart.lasname, Lasart.stars, LSUAscores.lsuakey, LSUAscores.lasname, LSUA.testtime, LSUA.UserNo, LSUA.lsuakey FROM Lasart, LSUAscores, LSUA WHERE LSUA.UserNo=%s AND Lasart.lasname = LSUAscores.lasname AND LSUAscores.lsuakey=LSUA.lsuakey AND LSUA.testtime=1", GetSQLValueString($colname_rsLasartSelf, "int"));
$rsLasartSelf = mysql_query($query_rsLasartSelf, $Assessment) or die(mysql_error());
$row_rsLasartSelf = mysql_fetch_assoc($rsLasartSelf);
$totalRows_rsLasartSelf = mysql_num_rows($rsLasartSelf);

$colname_rsLasartDM = "-1";
if (isset($_SESSION['kt_login_id'])) {
  $colname_rsLasartDM = $_SESSION['kt_login_id'];
}
mysql_select_db($database_Assessment, $Assessment);
$query_rsLasartDM = sprintf("SELECT Lasart.lasartkey, Lasart.lasname, Lasart.stars, LDMA.UserNo, LDMA.ldmakey, LDMAscores.lasname, LDMAscores.ldmakey, LDMA.testtime, LDMA.manlevel FROM Lasart, LDMA, LDMAscores WHERE LDMA.UserNo=%s AND Lasart.lasname = LDMAscores.lasname AND LDMAscores.ldmakey=LDMA.ldmakey AND LDMA.testtime = 1", GetSQLValueString($colname_rsLasartDM, "int"));
$rsLasartDM = mysql_query($query_rsLasartDM, $Assessment) or die(mysql_error());
$row_rsLasartDM = mysql_fetch_assoc($rsLasartDM);
$totalRows_rsLasartDM = mysql_num_rows($rsLasartDM);

$colname_rsLasartLL = "-1";
if (isset($_SESSION['kt_login_id'])) {
  $colname_rsLasartLL = $_SESSION['kt_login_id'];
}
mysql_select_db($database_Assessment, $Assessment);
$query_rsLasartLL = sprintf("SELECT Lasart.lasartkey, Lasart.lasname, Lasart.stars, LLRA.UserNo, LLRA.llrakey, LLRAscores.lasname, LLRAscores.llrakey, LLRA.testtime FROM Lasart, LLRA, LLRAscores WHERE LLRA.UserNo=%s AND Lasart.lasname = LLRAscores.lasname AND LLRAscores.llrakey=LLRA.llrakey AND LLRA.testtime = 1", GetSQLValueString($colname_rsLasartLL, "int"));
$rsLasartLL = mysql_query($query_rsLasartLL, $Assessment) or die(mysql_error());
$row_rsLasartLL = mysql_fetch_assoc($rsLasartLL);
$totalRows_rsLasartLL = mysql_num_rows($rsLasartLL);

$colname_rsLasartIR = "-1";
if (isset($_SESSION['kt_login_id'])) {
  $colname_rsLasartIR = $_SESSION['kt_login_id'];
}
mysql_select_db($database_Assessment, $Assessment);
$query_rsLasartIR = sprintf("SELECT Lasart.lasartkey, Lasart.lasname, Lasart.stars, LIMA.UserNo, LIMA.limakey, LIMAscores.lasname, LIMAscores.limakey, LIMA.testtime FROM Lasart, LIMA, LIMAscores WHERE LIMA.UserNo=%s AND Lasart.lasname = LIMAscores.lasname AND LIMAscores.limakey=LIMA.limakey AND LIMA.testtime = 1", GetSQLValueString($colname_rsLasartIR, "int"));
$rsLasartIR = mysql_query($query_rsLasartIR, $Assessment) or die(mysql_error());
$row_rsLasartIR = mysql_fetch_assoc($rsLasartIR);
$totalRows_rsLasartIR = mysql_num_rows($rsLasartIR);

$colname_rsRegistrant = "-1";
if (isset($_SESSION['kt_login_id'])) {
  $colname_rsRegistrant = $_SESSION['kt_login_id'];
}
mysql_select_db($database_Assessment, $Assessment);
$query_rsRegistrant = sprintf("SELECT UserNo, firstname, lastname FROM Registrants WHERE UserNo = %s", GetSQLValueString($colname_rsRegistrant, "int"));
$rsRegistrant = mysql_query($query_rsRegistrant, $Assessment) or die(mysql_error());
$row_rsRegistrant = mysql_fetch_assoc($rsRegistrant);
$totalRows_rsRegistrant = mysql_num_rows($rsRegistrant);

$colname_rsLasartEthics2 = "-1";
if (isset($_SESSION['kt_login_id'])) {
  $colname_rsLasartEthics2 = $_SESSION['kt_login_id'];
}
mysql_select_db($database_Assessment, $Assessment);
$query_rsLasartEthics2 = sprintf("SELECT Lasart.lasartkey, Lasart.lasname, Lasart.stars, LERA.UserNo, LERA.lerakey, LERAscores.lerakey, LERAscores.lasname, LERA.testtime FROM Lasart, LERAscores, LERA WHERE LERA.UserNo=%s AND Lasart.lasname = LERAscores.lasname AND LERAscores.lerakey=LERA.lerakey AND LERA.testtime = 2", GetSQLValueString($colname_rsLasartEthics2, "int"));
$rsLasartEthics2 = mysql_query($query_rsLasartEthics2, $Assessment) or die(mysql_error());
$row_rsLasartEthics2 = mysql_fetch_assoc($rsLasartEthics2);
$totalRows_rsLasartEthics2 = mysql_num_rows($rsLasartEthics2);

$colname_rsLasartEthics3 = "-1";
if (isset($_SESSION['kt_login_id'])) {
  $colname_rsLasartEthics3 = $_SESSION['kt_login_id'];
}
mysql_select_db($database_Assessment, $Assessment);
$query_rsLasartEthics3 = sprintf("SELECT Lasart.lasartkey, Lasart.lasname, Lasart.stars, LERA.UserNo, LERA.lerakey, LERAscores.lerakey, LERAscores.lasname, LERA.testtime FROM Lasart, LERAscores, LERA WHERE LERA.UserNo=%s AND Lasart.lasname = LERAscores.lasname AND LERAscores.lerakey=LERA.lerakey AND LERA.testtime = 3", GetSQLValueString($colname_rsLasartEthics3, "int"));
$rsLasartEthics3 = mysql_query($query_rsLasartEthics3, $Assessment) or die(mysql_error());
$row_rsLasartEthics3 = mysql_fetch_assoc($rsLasartEthics3);
$totalRows_rsLasartEthics3 = mysql_num_rows($rsLasartEthics3);

$colname_rsLasartEthics4 = "-1";
if (isset($_SESSION['kt_login_id'])) {
  $colname_rsLasartEthics4 = $_SESSION['kt_login_id'];
}
mysql_select_db($database_Assessment, $Assessment);
$query_rsLasartEthics4 = sprintf("SELECT Lasart.lasartkey, Lasart.lasname, Lasart.stars, LERA.UserNo, LERA.lerakey, LERAscores.lerakey, LERAscores.lasname, LERA.testtime FROM Lasart, LERAscores, LERA WHERE LERA.UserNo=%s AND Lasart.lasname = LERAscores.lasname AND LERAscores.lerakey=LERA.lerakey AND LERA.testtime = 4", GetSQLValueString($colname_rsLasartEthics4, "int"));
$rsLasartEthics4 = mysql_query($query_rsLasartEthics4, $Assessment) or die(mysql_error());
$row_rsLasartEthics4 = mysql_fetch_assoc($rsLasartEthics4);
$totalRows_rsLasartEthics4 = mysql_num_rows($rsLasartEthics4);
?>
<div style="display:none"><%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%></div>
<!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"><!-- InstanceBegin template="/Templates/template2php.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>DTS: LERA lectagraph</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
.left {
	float: left;
	width: 370px;
}
.right {
	float: right; /* since this element is floated, a width must be given */
	width: 300px;
	margin: 0px;
	padding: 0px;
}
-->
</style>
<!-- InstanceEndEditable -->
<style type="text/css"> 
<!-- 
body  {
	margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
	padding: 0; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
	color: #474A47;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
	background-color: #929292;
}
.twoColFixRtHdr #container {
	width: 780px;
	margin: 0 auto;
	text-align: left;
	border: 1px solid #474A47;
	background-color: #F4F6F2;
} 
.twoColFixRtHdr #header {
	background-image: url(../images/skin/header2.jpg);
	height: 70px;
	padding-top: 0;
	padding-right: 0px;
	padding-bottom: 0;
	padding-left: 0px;
} 
.twoColFixRtHdr #menu1 {
	height: 20px;
	padding-top: 4;
	padding-right: 27px;
	padding-bottom: 0;
	padding-left: 17px;
	background-color: #777E79;
	background-image: url(../images/skin/menu2.jpg);
	color: #E2E2E2;
	margin-top: 0px;
} 
.twoColFixRtHdr #menu2 {
	height: 20px;
	padding-top: 0;
	padding-right: 0px;
	padding-bottom: 0;
	padding-left: 17px;
	background-color: #474A47;
	background-image: url(../images/skin/menu2.jpg);
} 
.twoColFixRtHdr #spacer1 {
	background-color: #E2E2E2;
	height: 20px;
} 
.twoColFixRtHdr #header h1 {
	margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
	padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
}
.twoColFixRtHdr #mainContent {
	margin-top: 0;
	margin-right: 0px;
	margin-bottom: 0;
	margin-left: 0;
	padding-top: 0;
	padding-right: 46px;
	padding-bottom: 0;
	padding-left: 46px;
} 
.twoColFixRtHdr #footer {
	background-image: url(../images/skin/footer2.jpg);
	height: 70px;
	padding-top: 0;
	padding-right: 10px;
	padding-bottom: 0;
	padding-left: 20px;
} 
.twoColFixRtHdr #footer p {
	margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
	padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
	float: right;
	margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page */
	float: left;
	margin-right: 8px;
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
	clear:both;
    height:0;
    font-size: 1px;
    line-height: 0px;
}
--> 
</style><!--[if IE 5]>
<style type="text/css"> 
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixRtHdr #sidebar1 { width: 220px; }
</style>
<![endif]--><!--[if IE]>
<style type="text/css"> 
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixRtHdr #sidebar1 { padding-top: 30px; }
.twoColFixRtHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->
<link href="../css/styleassessments.css" rel="stylesheet" type="text/css" />
<script src="../SpryAssetsTemplates1/SpryMenuBar.js" type="text/javascript"></script>
<link href="../SpryAssetsTemplates1/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
</head>

<body class="twoColFixRtHdr">

<div id="container">
  <div id="spacer1">
  <!-- end #spacer1 --></div>
  <div id="header">
  <!-- end #header --></div>
  <div id="menu1">
    <div align="right" class="logintext">
      <!-- end #menu1 -->
      You are logged in as <?php echo $row_rsRegistrants['firstname']; ?> <?php echo $row_rsRegistrants['lastname']; ?></div>
  </div>
  <div id="mainContent"> <!-- InstanceBeginEditable name="main" -->
    <h1>LERA Lectagraph for  <?php echo $row_rsRegistrant['firstname']; ?> <?php echo $row_rsRegistrant['lastname']; ?> </h1>
    <p>More lectagraphs: <a href="lectagraph1.php">test time 1</a> | <a href="lectagraph2.php">test time 2</a> | <a href="lectagraph3.php">test time 3</a> | <a href="lectagraph_ldma.php">LDMA</a> | <a href="lectagraph_lera.php">LERA</a> | <a href="lectagraph_llra.php">LLRA</a> | <a href="lectagraph_lrja.php">LRJA</a> | <a href="lectagraph_lsua.php">LSUA</a> | <a href="lectagraph_lima.php">LIMA</a> | <a href="../assessments/select_assess.php">select an assessment</a></p>
    <p>&nbsp;</p>
    <p></p>
<div class="left">
  <img src="../images/stars/ScaleNos.gif" width="38" height="430" hspace="0" align="top" /><img src="<?php echo $row_rsLasartEthics['stars']; ?>" width="38" height="430" hspace="0" border="0" align="top" class="scalelera" /><img src="<?php echo $row_rsLasartEthics2['stars']; ?>" alt="" width="38" height="430" hspace="0" border="0" align="top" class="scalelera" /><img src="<?php echo $row_rsLasartEthics3['stars']; ?>" alt="" width="38" height="430" hspace="0" border="0" align="top" class="scalelera" /><img src="<?php echo $row_rsLasartEthics4['stars']; ?>" alt="" width="38" height="430" hspace="0" border="0" align="top" class="scalelera" /></div>
<div class ="right">
	<h3>Reports</h3>
    <p>Select one of the following links to view the report associated with a given score: </p>
    <p><a href="../codingLERA/lerareport.php?lerakey=<?php echo $row_rsLasartEthics['lerakey']; ?>&amp;lasname=<?php echo $row_rsLasartEthics['lasname']; ?>">LERA 1</a> | <a href="../codingLERA/lerareport.php?lerakey=<?php echo $row_rsLasartEthics2['lerakey']; ?>&amp;lasname=<?php echo $row_rsLasartEthics['lasname']; ?>">LERA 2</a> | <a href="../codingLERA/lerareport.php?lerakey=<?php echo $row_rsLasartEthics3['lerakey']; ?>&amp;lasname=<?php echo $row_rsLasartEthics3['lasname']; ?>">LERA 3</a> | <a href="../codingLERA/lerareport.php?lerakey=<?php echo $row_rsLasartEthics4['lerakey']; ?>&amp;lasname=<?php echo $row_rsLasartEthics4['lasname']; ?>">LERA 4</a></p>
    </div>
<br class="clearfloat" />   
<p>&nbsp;</p>
    <p>&nbsp;</p>
  <!-- InstanceEndEditable -->
  <!-- end #mainContent --></div>
	<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
  <div id="menu2">
<div>
  <ul id="MenuBar1" class="MenuBarHorizontal">
    <li><a href="../index.html">home</a></li>
    <li><a href="../assessments/select_assess.php">select an assessment</a></li>
    <li><a href="../logout.php">log out</a></li>
    <li><a href="../contactus.php">contact us</a></li>
  </ul>
</div>
<!-- end #menu2 --></div>
  <div id="footer">
    <p>&nbsp;</p>
  <!-- end #footer --></div>
  <!-- end #container -->
</div>
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"../SpryAssets/SpryMenuBarDownHover.gif", imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($rsLasartSelf);

mysql_free_result($rsLasartLL);

mysql_free_result($rsLasartIR);

mysql_free_result($rsRegistrant);

mysql_free_result($rsLasartEthics2);

mysql_free_result($rsLasartEthics3);

mysql_free_result($rsLasartEthics4);

mysql_free_result($rsLasartRJ);

mysql_free_result($rsLasartEthics);

mysql_free_result($rsRegistrants);

mysql_free_result($rsLasartDM);
?>

Open in new window

0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 1000 total points
ID: 33458085
Okay, so you have multiple recordsets (which is easier in this case).  So all you need to do is use the Show Region behavior to check if the recordset is empty.

Highlight one of the images in design view and the go to the Server Behaviors panel, hit the + icon, choose Show Region and then If RecordSet Is Not Empty.  Then just select the recordset that matches the column.  So for rsLasartEthics, the code would look like this after we apply the behavior:

<?php if ($totalRows_rsLasartEthics > 0) { // Show if recordset not empty ?>
    <img src="<?php echo $row_rsLasartEthics['stars']; ?>" width="38" height="430" hspace="0" border="0" align="top" class="scalelera" />
    <?php } // Show if recordset not empty ?>
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Closing Comment

by:theodawson
ID: 33458783
Exactly the kind of information I needed.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 33458817
Yeah, sorry about that.  I did say in my first post that I was just guessing based on the really restricted view of the code you gave.  Once I was able to see the whole thing it became a lot easier.
0
 

Author Comment

by:theodawson
ID: 33458858
I often have difficulty framing my question. Your first response helped me to do a better job.
0
 

Author Comment

by:theodawson
ID: 33458891
I'm wondering now if there is a way to add a placeholder image.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 33458915
Yes, absolutely.   Just add the image code below the other image.  Highlight it and do Show Region If Recordset is Empty.  The trick is not to nest the Show Region behaviors so make sure you have just the image tag highlighted before inserting the code.
0
 

Author Comment

by:theodawson
ID: 33459158
So, I did this:


      <?php if ($totalRows_rsLasartLL > 0) { // Show if recordset not empty ?>
        <img src="<?php echo $row_rsLasartLL['stars']; ?>" width="38" height="430" hspace="0" align="top" class="scalellra" />
        <?php } // Show if recordset not empty ?>
        <?php if ($totalRows_rsLasartLL == 0) { // Show if recordset empty ?>
          <a href="../images/stars/ScaleLLRA.png"><img src="<?php echo $row_rsLasartLL['stars']; ?>" width="38" height="430" hspace="0" align="top" class="scalellra" /></a>
          <?php } // Show if recordset empty ?>

And the image I intended shows up, but it has a box with a question mark in the middle...
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 33459167
Remove this part from the second set of code:

<img src="<?php echo $row_rsLasartLL['stars']; ?>

That's not going to work if the recordset is null :)
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 33459172
You need to use an actual placeholder image instead of the pull from the database...
0
 

Author Comment

by:theodawson
ID: 33459214
Yes. I've got it! Wonderful. Should I have asked my second question as a follow on? Am I depriving you of points?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 33459220
Check my profile.  I have enough points to survive a follow up now and again :)
0
 

Author Comment

by:theodawson
ID: 33459328
How might I go about hiring you for a specific job? Since the Developer Toolbox is no longer being supported by Adobe, we're really hurting. I have not found a good substitute for their feature-laded dynamic tables. We're thinking of hiring someone to make us a widget or extension.
0
 

Author Comment

by:theodawson
ID: 33459333
Dynamic lists, I mean.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 33459341
My email is in my profile.  If you are thinking of moving away from the ADDT, I highly recommend looking at WebAssist as a replacement.
0
 

Author Comment

by:theodawson
ID: 33459390
We aren't a commerce website and most of their stuff just doesn't fit what we do. I can't find your email.
0
 

Author Comment

by:theodawson
ID: 33459418
I found the email address.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 33459511
>> and most of their stuff just doesn't fit what we do. I can't find your email.

Not totally true, you just need to learn your way around their terminology
0
 

Author Comment

by:theodawson
ID: 33459582
sent a message from devtestservice
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question