By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,808 Members | 1,612 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,808 IT Pros & Developers. It's quick & easy.

show specific data from database with php

P: 89
Hello all

Hopefully someone can help me with this issue.

I have some information from a database which i show in a table. In this table i have various columns that are filled out with some of the data from the database.

I have a column named status where the information i get from the database can have 4 different values - Not released, Released, Inner layers, Shipped.

What i need is some php code that tells not to show data when the value is Shipped.

Here is some code i use to retrieve the information from the database, if it is any help:

[PHP]if (trim($_SESSION['StatusREL']) == "Y") {
$query = $query . " AND (TrackingStatus = '" . trim($_SESSION['StatusREL']) . "'";
$andused = true;
}

if (trim($_SESSION['StatusSHP']) == "S") {
if (!$andused) {
$query = $query . " AND (TrackingStatus = '" . trim($_SESSION['StatusSHP']) . "'";
$andused = true;
} else {
$query = $query . " OR TrackingStatus = '" . trim($_SESSION['StatusSHP']) . "'";
}
}

if (trim($_SESSION['StatusINV']) == "I") {
if (!$andused) {
$query = $query . " AND (TrackingStatus = '" . trim($_SESSION['StatusINV']) . "'";
$andused = true;
} else {
$query = $query . " OR TrackingStatus = '" . trim($_SESSION['StatusINV']) . "'";
}
}

if (trim($_SESSION['StatusNR']) == "NR") {
if (!$andused) {
$query = $query . " AND (TrackingStatus = ' '" ;
$andused = true;
} else {
$query = $query . " OR TrackingStatus = ' '";
}
}
if (trim($_POST['FromDate']) != "" AND trim($_POST['ToDate']) != "") {
$query = $query . " AND (DockDate >= '" . trim($_POST['FromDate']) . "' AND DockDate <= '" . trim($_POST['ToDate']) . "')";
}


// Now put on the closing paren
if (trim($_SESSION['StatusREL']) == "Y" || trim($_SESSION['StatusNR']) == "NR"
|| trim($_SESSION['StatusSHP']) == "S" || trim($_SESSION['StatusINV']) == "I" ) {
$query = $query . " )";[/PHP]

And

[PHP]<?php
if (trim(ads_result($jtsstatus,"TrackingStatus")) == "") { echo("Not Released"); }
if (trim(ads_result($jtsstatus,"TrackingStatus")) == "Y") { echo("Released"); }
if (trim(ads_result($jtsstatus,"TrackingStatus")) == "S") { echo("Shipped"); }
if (trim(ads_result($jtsstatus,"TrackingStatus")) == "I") { echo("Invoiced"); }
if (trim(ads_result($jtsstatus,"TrackingStatus")) == "L") { echo("Inner Layers"); }
?> [/PHP]
Dec 4 '07 #1
Share this Question
Share on Google+
1 Reply


Markus
Expert 5K+
P: 6,050
[php]
$query = "SELECT * FROM `table_name` WHERE `shipped_status` = 'no' "
[/php]

Something like that?
Dec 4 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.