Re: [PHP-DB] hiding blank MySQL results?
On Sat, 5 Jan 2002 01:12:21 - Nathon Jones "Nathon Jones" <[EMAIL PROTECTED]> wrote: > Hi. > > I have a PHP page calling a set of results from a MySQL database. > They > appear in the following format on the results page: > > Title > Description > Link > > Problem I'm having. When a db record has an empty field (for > example, no > description), the results page leaves a gap where the description > should be. > > How do I do a "hide if empty" thang to stop the gaps appearing? > > Really appreciate the help. > Regards > nathon > [EMAIL PROTECTED] When I do something like that, I test the results before displaying the page or the page section. Use your PHP to check the results. If empty, then don't display. -- Raquel Rarely do we find men who willingly engage in hard, solid thinking. There is an almost universal quest for easy answers and half-baked solutions. Nothing pains some people more than having to think. --Martin Luther King, Jr. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] hiding blank MySQL results?
ok i get your point. how about "; } if ($discription !=""){ $discription1=$discription""; } if ($link !=""){ $link1=$link""; } echo "$title1 $discription1 $link1"; ?> the != means if does not equal. so basically that should i think do. if the title does not equal nothing then add a to the end of it. (putting the return in html). So if it does equal nothing. then it will be nothing. does this make sense ? i wasnt sure on how to add to the end... i had a shot @ it. this code may not work just an idea. Neil - Original Message - From: Nathon Jones <[EMAIL PROTECTED]> To: 'Shooter' <[EMAIL PROTECTED]> Sent: Saturday, January 05, 2002 4:01 AM Subject: RE: [PHP-DB] hiding blank MySQL results? > Thanks Neil. > > Does this produce a message saying "Sorry no Result" if the field is > empty? > > What I am after is for it to just remain blank without inserting a blank > line where the field should be and without inserting an error message. > > Lets say my results are as follows: > > Blues Magazine <-- Title > Best Blues Magazine in the world. <-- Description > www.bluesmagazine.com <-- Link > > If one of my database records doesn't have a Description, how do I stop > the PHP page inserting a blank line where the description SHOULD have > been? Do you get my drift? Like, for certain records it might display: > > Blues Magazine > > www.bluesmagazines.com > > ...where there is no description for this record. Can't get my head > around it! > > Thanks for your help Neil. Much appreciated. > Regards > Nathon Jones > > -Original Message- > From: Shooter [mailto:[EMAIL PROTECTED]] > Sent: 05 January 2002 05:25 > To: Nathon Jones; [EMAIL PROTECTED] > Subject: Re: [PHP-DB] hiding blank MySQL results? > > i would suggest in your while you do someting like this > > while($myrow=MySQL_fetch_array($result)) > { > $time=$myrow["time"]; > > if ($time =="") > {$time ="Sorry No Result"; > } > echo "$time"; > > if u get my drift ? ? > > Nei;l > > > - Original Message - > From: Nathon Jones <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, January 04, 2002 5:12 PM > Subject: [PHP-DB] hiding blank MySQL results? > > > > Hi. > > > > I have a PHP page calling a set of results from a MySQL database. > They > > appear in the following format on the results page: > > > > Title > > Description > > Link > > > > Problem I'm having. When a db record has an empty field (for example, > no > > description), the results page leaves a gap where the description > should > be. > > > > How do I do a "hide if empty" thang to stop the gaps appearing? > > > > Really appreciate the help. > > Regards > > nathon > > [EMAIL PROTECTED] > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: > [EMAIL PROTECTED] > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] hiding blank MySQL results?
i would suggest in your while you do someting like this while($myrow=MySQL_fetch_array($result)) { $time=$myrow["time"]; if ($time =="") {$time ="Sorry No Result"; } echo "$time"; if u get my drift ? ? Nei;l - Original Message - From: Nathon Jones <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, January 04, 2002 5:12 PM Subject: [PHP-DB] hiding blank MySQL results? > Hi. > > I have a PHP page calling a set of results from a MySQL database. They > appear in the following format on the results page: > > Title > Description > Link > > Problem I'm having. When a db record has an empty field (for example, no > description), the results page leaves a gap where the description should be. > > How do I do a "hide if empty" thang to stop the gaps appearing? > > Really appreciate the help. > Regards > nathon > [EMAIL PROTECTED] > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] hiding blank MySQL results?
Hi. I have a PHP page calling a set of results from a MySQL database. They appear in the following format on the results page: Title Description Link Problem I'm having. When a db record has an empty field (for example, no description), the results page leaves a gap where the description should be. How do I do a "hide if empty" thang to stop the gaps appearing? Really appreciate the help. Regards nathon [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] hiding blank MySQL results?
Hi. I have a PHP page calling a set of results from a MySQL database. They appear in the following format on the results page: Title Description Link Problem I'm having. When a db record has an empty field (for example, no description), the results page leaves a gap where the description should be. How do I do a "hide if empty" thang to stop the gaps appearing? Really appreciate the help. Regards nathon [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]