Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Feb 2006
    Posts
    149
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Something easy, no room to explain NEED HELP

    Hello and good morning ,

    Right now when I use this script

    <? '; echo $row['name']; echo '- ' ?><? '; echo $row['category']; echo '- ' ?>TITLE OF MY SITE
    I get this when there is no 'name' or 'category'

    --TITLE OF SITE

    I want it so that - only shows if there is indead a 'name' or 'category'

    hopfully i wasn't to confusing, any help would be greatly appriciated, thanks in advance!

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    <?= $row['name'].'- '.$row['category'].'- '; ?>TITLE OF MY SITE
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    PHP Code:
    <?
    if($row['name'])
    {
      echo 
    "{$row['name']} - ";
    }
    if(
    $row['category'])
    {
      echo 
    "{$row['category']} - ";
    }
    ?> TITLE OF SITE

  • #4
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,798
    Thanks
    19
    Thanked 156 Times in 147 Posts
    PHP Code:
     <? 

    if (!empty($row['name']))
    {
    echo 
    $row['name'] . '- ' $row['category'] . '- ';
    }

    ?>TITLE OF MY SITE
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #5
    Regular Coder
    Join Date
    Feb 2006
    Posts
    149
    Thanks
    0
    Thanked 0 Times in 0 Posts
    lol thanks felgall, NancyJ, chump2877


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •