Ask a Question related to Dreamweaver AppDev, Design and Development.
-
cp:fusion #1
Dynamic removal of text if field is empty using PHP
I have a mySQL database which has some fields which may, or may not be empty. I
wish to display them in the following way using PHP:- Result 1; Result 2;
Result 3; Result 4 and so on. My question is, if the fields for 'Result 2'
and 'Result 3' are empty, can I dynamically remove the ';' so that my results
read:- Result 1; Result4 instead of the results I am currently getting:-
Result 1; ; ; Result 4 I would appreciate any help on this one, as I can't
seem to find anything which can help. Cheers :confused;
cp:fusion Guest
-
#39134 [NEW]: PHP + FreeTDS 0.64 crashes when TEXT field with empty string encountered
From: jr-phpbugs at cedric dot unob dot cz Operating system: linux (irrelevant) PHP version: 4.4.4 PHP Bug Type: MSSQL... -
File Size From Dynamic Link & If Field is Empty
1. i have an access database set up with a pdf file link in one field on the actual page the user has the option to view the pdf or save it. ... -
load external text to dynamic text field in levels
Dear Sir I found the Tech Noe Index #16238 is useful in creating dynamically loaded text from external text file. However, the method mentioned... -
Dynamic text in smooth scrolling text field - help
here's links to the files. http://www.anicespot.com/test/ http://www.anicespot.com/test/easing_textScroller-01.html... -
SQL - Updating Empty Text Field is enterring -1
> "Update set userid = '" & REquest.form("userid") & Response.write this to the screen, instead of executing it, and examine the result. -
David Powers #2
Re: Dynamic removal of text if field is empty using PHP
cp:fusion wrote:
if (!empty($variable_that_contains_result)) {> My question is, if the fields for 'Result 2'
> and 'Result 3' are empty, can I dynamically remove the ';' so that my results
> read:- Result 1; Result4
echo $variable_that_contains_result.'; ';
}
The expression !empty() checks that the variable passed to it has a value.
If the result is empty, nothing will be displayed, thereby omitting the
redundant semicolon and following space.
--
David Powers
Author, "Foundation PHP 5 for Flash" (friends of ED)
Co-author "PHP Web Development with DW MX 2004" (Apress)
[url]http://computerbookshelf.com[/url]
David Powers Guest
-
cp:fusion #3
Re: Dynamic removal of text if field is empty using PHP
Hi David, thanks for the reply, I am however struggling with the placement of
the code in my Dreamweaver generated PHP. Is there any chance you could let me
know where I should be putting your code in the following example:- Other:
<?php echo $row_rsCCAPsearch['Orig_Desig']; ?>; <?php echo
$row_rsCCAPsearch['Equiv_Strains']; ?>; <?php echo
$row_rsCCAPsearch['Other_Desigs']; ?>; <strong><?php echo
$row_rsCCAPsearch['Type_Culture']; ?></strong>; <?php echo
$row_rsCCAPsearch['Extra_Info_1']; ?>; <strong><?php echo
$row_rsCCAPsearch['Pathogen']; ?></strong>; FORM A MUST ACCOMPANY ORDER<br>
Many thanks in advance, Craig
cp:fusion Guest
-
cp:fusion #4
Re: Dynamic removal of text if field is empty using PHP
Hi David, thanks for the reply, I am however struggling with the placement of
the code in my Dreamweaver generated PHP. Is there any chance you could let me
know where I should be putting your code in the following example:- Other:
<?php echo $row_rsCCAPsearch['Orig_Desig']; ?>; <?php echo
$row_rsCCAPsearch['Equiv_Strains']; ?>; <?php echo
$row_rsCCAPsearch['Other_Desigs']; ?>; <strong><?php echo
$row_rsCCAPsearch['Type_Culture']; ?></strong>; <?php echo
$row_rsCCAPsearch['Extra_Info_1']; ?>; <strong><?php echo
$row_rsCCAPsearch['Pathogen']; ?></strong>; FORM A MUST ACCOMPANY ORDER<br>
Many thanks in advance, Craig
cp:fusion Guest
-
David Powers #5
Re: Dynamic removal of text if field is empty using PHP
cp:fusion wrote:
<?php if (!empty($row_rsCCAPsearch['Orig_Desig']))> Is there any chance you could let me
> know where I should be putting your code in the following example:- Other:
> <?php echo $row_rsCCAPsearch['Orig_Desig']; ?>; <?php echo
> $row_rsCCAPsearch['Equiv_Strains']; ?>;
echo $row_rsCCAPsearch['Orig_Desig'].'; ';
if (!empty($row_rsCCAPsearch['Equiv_Strains']))
echo $row_rsCCAPsearch['Equiv_Strains'].'; ';
and so on.
--
David Powers
Author, "Foundation PHP 5 for Flash" (friends of ED)
Co-author "PHP Web Development with DW MX 2004" (Apress)
[url]http://computerbookshelf.com[/url]
David Powers Guest
-
cp:fusion #6
Re: Dynamic removal of text if field is empty using PHP
Thanks very much for your help David, you are a star!
Craig
cp:fusion Guest
-
Michael Fesser #7
Re: Dynamic removal of text if field is empty using PHP
.oO(David Powers)
It would probably be easier to loop through the record set ...>cp:fusion wrote:>>> Is there any chance you could let me
>> know where I should be putting your code in the following example:- Other:
>> <?php echo $row_rsCCAPsearch['Orig_Desig']; ?>; <?php echo
>> $row_rsCCAPsearch['Equiv_Strains']; ?>;
><?php if (!empty($row_rsCCAPsearch['Orig_Desig']))
> echo $row_rsCCAPsearch['Orig_Desig'].'; ';
>if (!empty($row_rsCCAPsearch['Equiv_Strains']))
> echo $row_rsCCAPsearch['Equiv_Strains'].'; ';
Micha
Michael Fesser Guest
-
David Powers #8
Re: Dynamic removal of text if field is empty using PHP
Michael Fesser wrote:
I agree, but the original poster wanted to adapt DW-generated code, and> It would probably be easier to loop through the record set ...
had difficulty in understanding how to apply !empty(). One step at a time...
--
David Powers
Author, "Foundation PHP 5 for Flash" (friends of ED)
Co-author "PHP Web Development with DW MX 2004" (Apress)
[url]http://computerbookshelf.com[/url]
David Powers Guest



Reply With Quote

