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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
grudz
Forum Commoner
Posts: 68
Joined: Thu Dec 04, 2003 12:52 pm

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

Post 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
basdog22
Forum Contributor
Posts: 158
Joined: Sun Nov 30, 2003 3:03 pm
Location: Greece

Post by basdog22 »

use a switch ($case)

statement. :wink:
User avatar
lazy_yogi
Forum Contributor
Posts: 243
Joined: Fri Jan 24, 2003 3:27 am

Post 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;
}
grudz
Forum Commoner
Posts: 68
Joined: Thu Dec 04, 2003 12:52 pm

Post 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
Post Reply