IF NOT NULL, THEN WHAT?

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default IF NOT NULL, THEN WHAT?

    I'm making a reference list for my company. We have photos from most of
    our reference projects, but not all.

    When I create a recordset to present our reference list, pulling data
    from our mySQL projects database, I want to print a text instead of just
    showing an empty picture frame.

    SELECT *
    FROM projects
    IF projectPhotoURL IS NULL
    THEN PRINT 'Sorry, no photo'
    END IF
    WHERE customerID=colname

    Yes I know, this is not valid SQL syntax. I was hoping someone could
    catch my point better this way, and guide me to something that works :)


    Help greatly appreciated

    Erik
    Erik Guest

  2. Similar Questions and Discussions

    1. NULL NULL Error
      I have run out of things to check for and could use some help. We are on a unix box, CFMX 7, and have started to use the CFDOCUMENT tag. The tag...
    2. "null null" error on line -1
      Hi, A different, new, ocasional error this time. Since we are using CFMX7, occasionally we get this error: " Application Exception Monitor...
    3. Error: ?null? is null or not an object
      eloine: That is a bogus error message in that it probably refers to something you have done (or not done) on the page. So, looking in the...
    4. Null > ''
      In terms of database size, does a million records of NULL are more then million records of '' (empty string). Just wondering :-)
  3. #2

    Default Re: IF NOT NULL, THEN WHAT?

    On 12 Apr 2005 in macromedia.dreamweaver.appdev, Erik wrote:
    > I'm making a reference list for my company. We have photos from most
    > of our reference projects, but not all.
    >
    > When I create a recordset to present our reference list, pulling
    > data from our mySQL projects database, I want to print a text
    > instead of just showing an empty picture frame.
    >
    > SELECT *
    > FROM projects
    > IF projectPhotoURL IS NULL
    > THEN PRINT 'Sorry, no photo'
    > END IF
    > WHERE customerID=colname
    >
    > Yes I know, this is not valid SQL syntax. I was hoping someone could
    > catch my point better this way, and guide me to something that works
    Do it in PHP, not SQL. Your image code would look something like:

    <img src="<?php echo $row_Recordset1['filename']; ?>" alt="picture">

    You want something like:

    if (strlen($row_Recordset1['filename']) > 0) {
    // Regular image from database
    echo "<img src=\"$row_Recordset1['filename']\" alt=\"picture\">";
    } else {
    // Blank image
    echo '<img name="" src="sorry.gif" alt="Sorry, no picture">';
    }

    Should work, not tested.

    --
    Joe Makowiec
    [url]http://makowiec.net/[/url]
    Email: [url]http://makowiec.net/email.php[/url]
    Joe Makowiec Guest

  4. #3

    Default Re: IF NOT NULL, THEN WHAT?

    You need to use some scripting on the web page instead.
    Use your recordset as normal and before your image location in the code, add
    a little script.

    In ASP VBScript:

    <%
    varPhoto = rsRecordsetName.Fields.Item("projectPhoto").Value
    If varPhoto = "" Or IsNull(varPhoto) Then
    Response.Write("No Photo")
    Else
    %>

    <img src="../path/to/media/<%=varPhoto%>">

    <%
    End If
    %>

    Something like that - coffe has just arrived :)
    HTH
    Cheers,
    Rob
    [url]http://robgt.com[/url]


    RobGT Guest

  5. #4

    Default Re: IF NOT NULL, THEN WHAT?

    RobGT skrev:
    > You need to use some scripting on the web page instead.
    OK, get it. Will try later, sorry for late response.

    This group has some fine heads attached to it, thank you for being at
    rescue point! :)

    Erik the Viking
    Erik Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139