Ask a Question related to Dreamweaver AppDev, Design and Development.
-
Erik #1
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
-
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... -
"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... -
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... -
How to ensure if column A is null, column B has to be null
Thank you Delbert! -
Null > ''
In terms of database size, does a million records of NULL are more then million records of '' (empty string). Just wondering :-) -
Joe Makowiec #2
Re: IF NOT NULL, THEN WHAT?
On 12 Apr 2005 in macromedia.dreamweaver.appdev, Erik wrote:
Do it in PHP, not SQL. Your image code would look something like:> 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
<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
-
RobGT #3
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
-
Erik #4
Re: IF NOT NULL, THEN WHAT?
RobGT skrev:
OK, get it. Will try later, sorry for late response.> You need to use some scripting on the web page instead.
This group has some fine heads attached to it, thank you for being at
rescue point! :)
Erik the Viking
Erik Guest



Reply With Quote

