home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 2862
Discussions: 188,380, Posts: 2,243,466, Members: 232,608
Old August 11th, 2002, 03:07 PM   Digg it!   #1 (permalink)
Member
 
grandma's Avatar
 
Join Date: Mar 2002
Location: Northern Michigan
Posts: 89
IF statement with MYSQL

If Statement with MYSQL
I have a simple page that prints out a Mysql database. The fields are type VARCHAR(255).

Some of the fields are blank/empty. Can someone help me with the IF statement that will not print/display it.

....
....
print "<tr><td width=\"20%\" > <B> Hours </B></td>". "<td width=\"75%\">". $row["Hours"] . "</td></tr>";
print "<tr><td width=\"20%\" > <B> Contact </B></td>". "<td width=\"75%\">". $row["Contact"] . "</td></tr>";
print "<tr><td width=\"20%\" > <B> Address </B></td>". "<td width=\"75%\">". $row["Address"] . "</td></tr>";
print "<tr><td width=\"20%\" > <B> Phone </B></td>". "<td width=\"75%\">". $row["Phone"] . "</td></tr>";
print "<tr><td width=\"20%\" > <B> Fax </B></td>". "<td width=\"75%\">". $row["Fax"] . "</td></tr>";
....

TIA

Grandma

grandma is offline   Reply With Quote
Old August 11th, 2002, 10:22 PM     #2 (permalink)
Member
 
gothic's Avatar
 
Join Date: Oct 2001
Location: Palatine, IL
Posts: 375
Er...Where is the 'if' statement?

gothic is offline   Reply With Quote
Old August 12th, 2002, 12:35 AM     #3 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
[deleted]
existing answer, better.
[/deleted]

qball is offline   Reply With Quote
Old August 12th, 2002, 08:25 AM     #4 (permalink)
Member
 
grandma's Avatar
 
Join Date: Mar 2002
Location: Northern Michigan
Posts: 89
Wink

That's exactly it. I was looking for one

Anyway, problem was solved. Rather simple and I'm embarrassed I couldn't get it on my own.


if ($row["Hours"] != "")
{
print "<tr><td width=\"20%\" > <B> Hours </B></td>". "<td width=\"75%\">". $row["Hours"] . "</td></tr>";
}

Thanks for asking

Grandma
grandma is offline   Reply With Quote
Old August 13th, 2002, 05:16 PM     #5 (permalink)
Member
 
gothic's Avatar
 
Join Date: Oct 2001
Location: Palatine, IL
Posts: 375
Ooooh...hah...Hey, maybe I should learn to read, huh?

=]
gothic is offline   Reply With Quote
Old August 13th, 2002, 10:33 PM     #6 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
well lump me with gothic, doh.

Had I read properly, would have realized the question is actually PHP, working on resultset from MySQL db.

Glad we could be so unhelpful and you got a sufficient answer...
qball is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Most Active Discussions
Is It Just Me? (2885)
The United States Debt (20)
Looks like Burris will get his Sena.. (8)
I think I just killed my computer w.. (24)
Upgrading RAM (5)
Folderchat Weekday thread (439)
Antec 300 bulk purchase? (11)
Worth the upgrade?? (14)
Help with an Ati Radeon HD 4850 512.. (25)
Recent Discussions
RCA 52Inch HDTV wont turn on (1)
Building a gaming computer advi.. (1)
Best digital camera for under 2.. (14)
Help with an Ati Radeon HD 4850.. (25)
Install Problem for Windows Def.. (0)
New Build ( Finally ) (1)
dual monitors wont boot (0)
Folderchat Weekday thread (439)
MSN Hotmail Down??? (7)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 08:49 PM.
TechIMO Copyright 2008 All Enthusiast, Inc.



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