Advertisement

04.02.2008 at 07:56AM PDT, ID: 23289507
[x]
Attachment Details

PHP MySQL query

Asked by fcruz5 in PHP and Databases, PHP Scripting Language

Tags: PHP, Firefox

Hi,

How can I display this:

echo "" . $row['status'] . ""; //only display this if the column 'status' = 1 & instead of showing 1, display this message: "CLOSED"

The column 'status' has either a value of 0 or 1. Right now it will show either 0 or 1 depending on the record. Below is the PHP code:Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
<?php
$sql = "SELECT
	company.id AS current,
    (SELECT MIN(company.id) AS nextRecord FROM company WHERE company.id > '$currentrow') AS next,
    (SELECT MAX(company.id) AS prevRecord FROM company WHERE company.id < '$currentrow') AS prev,
	info.id, info.status
FROM
  company, info
WHERE
  company.id = '$currentrow' AND info.id = '$currentrow'";
 
$result =  mysql_query($sql) or die("INVALID QUERY: " . mysql_error());
 
while($row = mysql_fetch_assoc($result))
{
 
echo "" . $row['status'] . ""; //only display this if the column 'status' = 1 & instead of showing 1, display this message: "CLOSED"
 
}
?>
[+][-]04.02.2008 at 08:01AM PDT, ID: 21263759

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.02.2008 at 08:01AM PDT, ID: 21263763

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04.02.2008 at 08:02AM PDT, ID: 21263778

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.02.2008 at 08:07AM PDT, ID: 21263826

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP and Databases, PHP Scripting Language
Tags: PHP, Firefox
Sign Up Now!
Solution Provided By: amacleod1983
Participating Experts: 3
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628