tags:

views:

52

answers:

2
<marquee behavior="alternate" scrolldelay="1" scrollamount="2">
  <?php do { ?>
     <?php echo $row_Recordset1['Name']; ?>:&nbsp;
     <?php echo $row_Recordset1['Text']; ?>&nbsp;
     &#8226;
  <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</marquee>

<?php mysql_free_result($Recordset1); ?>
+1  A: 

Print a friendly message to the user instead of NULL:

<?php echo (NULL === $row_Recordset1['Text']) ? "No value" : $row_Recordset1['Text']; ?>&nbsp;

As xil3 illustrates, you can also use this pattern (from the docs):

// While a row of data exists, put that row in $row as an associative array
// Note: If you're expecting just one row, no need to use a loop
// Note: If you put extract($row); inside the following loop, you'll
//       then create $userid, $fullname, and $userstatus
while ($row = mysql_fetch_assoc($result)) {
    echo $row["userid"];
    echo $row["fullname"];
    echo $row["userstatus"];
}
Dolph
`($row_Recordset1['Text']!='NULL')` This is wrong! This is correct: `($row_Recordset1['Text']!==NULL)` See: http://php.net/manual/en/language.operators.comparison.php
Dolph
+1  A: 

The way you have it written right now, $row_Recordset1 will be null the first time it goes into the loop.

I've rewritten it for you:

<marquee behavior="alternate" scrolldelay="1" scrollamount="2">
  <?php while($row_Recordset1 = mysql_fetch_assoc($Recordset1)) { ?>
     <?php echo (($row_Recordset1['Name'] != null) ? $row_Recordset1['Name'] : 'n/a'); ?>:&nbsp;
     <?php echo (($row_Recordset1['Text'] != null) ? $row_Recordset1['Text'] : 'n/a'); ?>&nbsp;
     &#8226;
  <?php } ?>
</marquee>

<?php mysql_free_result($Recordset1); ?>
xil3
sorry i mean in some Text fields are empty :)
mattes
I just updated the answer.
xil3