473,748 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

When a field value is empty how do you not show it...

Hi thanks for the help in advanced!.. To further explain what i want it to
do is:

go from:

Body Conscious
1815 Division St # 101
Nashville TN, 37203
615-321-8555
<blank field>
Touching Nashville since 1989, seven days a week.
to:

Body Conscious
1815 Division St # 101
Nashville TN, 37203
615-321-8555
Touching Nashville since 1989, seven days a week.

below is the code that I've been trying to work with:
<?php
$color1 = "#FFFFFF";
$color2 = "#FFFFCC";
$row_count = "0";

$query = mysql_query("SE LECT DISTINCT * FROM itl WHERE city='$city2'
AND state='$state2' ORDER BY company") or die (mysql_error()) ;
if (mysql_num_rows ($query) < 1) { echo ''; }
while ($row = mysql_fetch_ass oc($query)) {
$row_color = ($row_count % 2) ? $color1 : $color2;

?>
<tr>
<td width="400" bgcolor="<?php echo
$row_color; ?>"><ul>
<?php
echo('<font size="1" face="Verdana, Arial,
Helvetica,
sans-serif"><b>' . $row['company'] . '</b>' . '<br>' .
$row['address'] . '<br>' . $row['city'] . ' ' . $row['state'] . ', '
.. $row['zip'] . '<br>' . $row['phone'] . '<br>' . '<a href="http://'

.. $row['website'] . '">' . $row['website'] . '</a><br>' .

$row['description'] . '</font></li></p>');
?>
</ul></td>
</tr>
<?php
$row_count++;
}
}
?>

Jul 17 '05 #1
2 1620
ph*********@com cast.net wrote:
Hi thanks for the help in advanced!.. To further explain what i want it to
do is:

go from:

Body Conscious
1815 Division St # 101
Nashville TN, 37203
615-321-8555
<blank field>
Touching Nashville since 1989, seven days a week.
to:

Body Conscious
1815 Division St # 101
Nashville TN, 37203
615-321-8555
Touching Nashville since 1989, seven days a week.

below is the code that I've been trying to work with:
<?php
$color1 = "#FFFFFF";
$color2 = "#FFFFCC";
$row_count = "0";

$query = mysql_query("SE LECT DISTINCT * FROM itl WHERE city='$city2'
AND state='$state2' ORDER BY company") or die (mysql_error()) ;
if (mysql_num_rows ($query) < 1) { echo ''; }
while ($row = mysql_fetch_ass oc($query)) {
$row_color = ($row_count % 2) ? $color1 : $color2;

?>
<tr>
<td width="400" bgcolor="<?php echo
$row_color; ?>"><ul>
<?php
echo('<font size="1" face="Verdana, Arial,
Helvetica,
sans-serif"><b>' . $row['company'] . '</b>' . '<br>' .
$row['address'] . '<br>' . $row['city'] . ' ' . $row['state'] . ', '
. $row['zip'] . '<br>' . $row['phone'] . '<br>' . '<a href="http://'

. $row['website'] . '">' . $row['website'] . '</a><br>' .

$row['description'] . '</font></li></p>');
?>
</ul></td>
</tr>
<?php
$row_count++;
}
}
?>


Try something like this:

<?php
$color1 = "#FFFFFF";
$color2 = "#FFFFCC";
$row_count = "0";

$query = mysql_query("SE LECT DISTINCT * FROM itl WHERE city='$city2'
AND state='$state2' ORDER BY company") or die (mysql_error()) ;

if (mysql_num_rows ($query) < 1) { exit; }

while ($row = mysql_fetch_ass oc($query)) {
$row_color = ($row_count % 2) ? $color1 : $color2;
?>

<tr bgcolor="<?php echo $row_color; ?>">
<td width="400">
<font size="1" face="Verdana, Arial, Helvetica, sans-serif">

<?php
if ($row["company"] != "") { echo "<b>".$row["company"]."</b>" }
if ($row["address"] != "") { echo "<br>".$row["address"] }
if ($row["city"] != "") { echo "<br>".$row["city"] }
if ($row["state"] != "") { echo " ".$row["state"] }
if ($row["zip"] != "") { echo ", ".$row["zip"] }
if ($row["phone"] != "") { echo "<br>".$row["phone"] }
echo "<br>".'<a href="http://';
if ($row["website"] != "") { echo $row["website"].'">'.$row["website"] }
echo "</a>";
if ($row["descriptio n"] != "") { echo "<br>".$row["descriptio n"] }
?>

</font>
</td>
</tr>

<?php
$row_count++;
}
?>
Jul 17 '05 #2
<ph*********@co mcast.net> wrote in message
news:BD440097.7 19A%ph********* @comcast.net...
Hi thanks for the help in advanced!.. To further explain what i want it to
do is:

go from:

Body Conscious
1815 Division St # 101
Nashville TN, 37203
615-321-8555
<blank field>
Touching Nashville since 1989, seven days a week.
to:

Body Conscious
1815 Division St # 101
Nashville TN, 37203
615-321-8555
Touching Nashville since 1989, seven days a week.

below is the code that I've been trying to work with:
<?php
$color1 = "#FFFFFF";
$color2 = "#FFFFCC";
$row_count = "0";

$query = mysql_query("SE LECT DISTINCT * FROM itl WHERE city='$city2'
AND state='$state2' ORDER BY company") or die (mysql_error()) ;
if (mysql_num_rows ($query) < 1) { echo ''; }
while ($row = mysql_fetch_ass oc($query)) {
$row_color = ($row_count % 2) ? $color1 : $color2;

?>
<tr>
<td width="400" bgcolor="<?php echo
$row_color; ?>"><ul>
<?php
echo('<font size="1" face="Verdana, Arial, Helvetica,
sans-serif"><b>' . $row['company'] . '</b>' . '<br>' .
$row['address'] . '<br>' . $row['city'] . ' ' . $row['state'] . ', '
. $row['zip'] . '<br>' . $row['phone'] . '<br>' . '<a href="http://'

. $row['website'] . '">' . $row['website'] . '</a><br>' .

$row['description'] . '</font></li></p>');
?>
</ul></td>
</tr>
<?php
$row_count++;
}
}
?>


For situation like this I like to stick the variables into an array, run it
through array_filter(), then either loop through it or hand it to implode().
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
1963
by: jason | last post by:
Access 2000 I need some help interogatting a table and extracting via ASP the final field in a row which has a value. In other words, I have a maximum of 10 fields but, at the user level he may he only enter values into the first four. I need to ALWAYS extract the final or last field that has a value. In the example below this would be PriceField5 which has a value of $162,000. The user stopped at this field and left the rest blank.
2
2887
by: Robin | last post by:
Ok, I have a form that on clicking of the Update button first updates the specific record in the db, then Inserts if the vMemo field is not empty. The problem that I'm having is that After updating if you hit the key (refresh) it inserts another record ... I have tried: 1. Clearing the vMemo field after the insert is done (vMemo = "") 2. Setting the value on the form for this field to "" Neither of these are working. It's not...
6
9634
by: WindAndWaves | last post by:
Hi Gurus In my quest in putting my first javascript together, I am now trying to conquer something that seems trivial, but has taken me hours. I would like to format a field in a form once the person has completed it. The format should be "00". For example, if the person puts 1 then it should become 01 and if the person puts 12 in the field then it should stay like that. If the person puts 2004 then it should become 04, and if the...
11
8669
by: Alan Silver | last post by:
Hello, I am using this validator on a textbox, and have discovered that if I set the InitialValue property, then the validator correctly fires if the user does not change the initial value of the textbox, but does NOT fire if the textbox is empty!! I thought the whole point of this validator was to ensure the control being validated had some text. Am I doing something stupid? It looks like I am going to need *two* validators for this,...
6
11252
by: Mark Kamoski | last post by:
Hi Everyone-- Please help. What is the difference between a Field and a Property? Here is the context. In the VS.NET 2002 documentation, in the "String Members" section, we have the following...
18
4743
by: JohnR | last post by:
From reading the documentation, this should be a relatively easy thing. I have an arraylist of custom class instances which I want to search with an"indexof" where I'm passing an instance if the class where only the "searched" property has a value. I expected to get the index into the arraylist where I could then get the entire class instance. However, the 'indexof' is never calling my overloaded, overrides Equals method. Here is the...
3
2132
by: JaRudzik | last post by:
Hello Try to add some blank text field and refresh window in IE it is ok but in firefox input hide_show works wrong , why ? Somebody can help me ? I'm not good in JS beacause I'm PHP coder The completly code (mix of PHP and JS):
3
14929
by: jmarr02s | last post by:
Hi, How do I replace with when the field is empty? Thanks! jmarr02s
12
2214
by: lawrence k | last post by:
I've a form that starts off like this: <form method="post" action="profile.php? id=5&formName=my_story_edit.htm" enctype="multipart/form-data"> <p>Email address:<br /> <input type="text" name="totalFormInputs" value="lawrence@krubner.com" /></p>
7
2909
by: robert.waters | last post by:
I have an Access database frontend linked via ODBC to a large (gigabytes) mysql database. I need to view a large amount of data in a a textbox (variable up to 300K), but I receive a 'there isnt enough memory' error whenever I scroll past N number of bytes in a textbox that has been filled with a lot of data. I am not sure what N is, but for a large chunk of data it occurs at about the halfway scroll, and smaller chunks might not throw...
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.