Page 1 of 1

HELP PLEASE!!!!! PLEASE......ive been at this a long time

Posted: Wed Jan 14, 2004 11:30 am
by grudz
I am have trouble with a simple task but cant figure out a way to solve the problem. I have a main page that lists my records. However, i also have other pages that query to that main page. Now i dont want to have to create a dozen other pages, i want everything to happen on that main page.

Code: Select all

<?php
SELECT name, address, smalldescription, type, location, icons, smallpic, blackline
FROM listing
WHERE type = 'coltype' OR address LIKE '%coladdress%'
ORDER BY name ASC
?>
now the problem is when i add the OR.........the 'address' part might work, but the 'type' doesnt (it doesnt filter my information).......i dont know if u understand my problem. But what it boils down to is that i have numerous pages that when i click on a query (lets say, sort by name, or show me the records according to...... ) i want them ALL to go to my main page, i dont want to have to create a bunch of other pages

thank you in advance

Posted: Wed Jan 14, 2004 2:31 pm
by basdog22
use a switch ($case)

statement. :wink:

Posted: Wed Jan 14, 2004 10:12 pm
by lazy_yogi
yea ... use a switch statment http://au.php.net/manual/en/control-str ... switch.php

Code: Select all

$i = $_GET['query_num']; // if getting from a url
switch ($i) {
   case 1:    // if $_GET['query_num'] was 1
       // do query 1
       break;
   case 2:    // if $_GET['query_num'] was 2
       // do query 2
       break;
   case 3:    // if $_GET['query_num'] was 3
       // do query 2
       break;
}

Posted: Tue Jan 20, 2004 11:33 am
by grudz
is there (other than the site u gave me at php.net) another tutorial of some sort? cuz im new at PHP coding, i use DreamWeaver MX, with MySQL statements. DreamWeaver creates all the code for me...I am, however, willing to learn as much as i can.

thank you