SELECT string

SELECT string

am 24.04.2007 06:31:14 von Ron Piggott

--=-V6/hDxupxBvQdkkcJxQ6
Content-Type: text/plain
Content-Transfer-Encoding: 7bit


I am looking for help to write a SELECT syntax to help me process a
directory searching query tool I am developing.

If you start at
http://www.actsministrieschristianevangelism.org/ministrydir ectory/ and
under 'Step 1:' click Business a form is displayed.

My question is how would you generate the SELECT syntax for the search
results "Could Include" a given category and "Must Include" a given
category based on what the user has inputted through this form?

Ron


--=-V6/hDxupxBvQdkkcJxQ6--

Re: SELECT string

am 24.04.2007 06:53:21 von bedul

cmiiw.. since i don't the visual what u said bellow
----- Original Message -----
From: "Ron Piggott"
To: "PHP DB"
Sent: Tuesday, April 24, 2007 11:31 AM
Subject: [PHP-DB] SELECT string


>
> I am looking for help to write a SELECT syntax to help me process a
> directory searching query tool I am developing.
you have a dir like this??
root
-include
-main
-body
--admin
--user

u want to search a file inside the dir?
why don't you create a function that read inside the dir and return query
for insert as database
1. read all file inside
2. create an insert query
3. refresh the query (repair the table?)

and then.. u can use select but target it to the database not the directory

>
> If you start at
> http://www.actsministrieschristianevangelism.org/ministrydir ectory/ and
> under 'Step 1:' click Business a form is displayed.
>
> My question is how would you generate the SELECT syntax for the search
> results "Could Include" a given category and "Must Include" a given
must include?? require u mean?

> category based on what the user has inputted through this form?
>
> Ron
>
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: SELECT string

am 24.04.2007 17:35:05 von Dwight Altman

Businesses
----------
id
businessName
isChristianBookstore
isGift
isHomeDecor
isSkinCareAndCosmetics
isThriftStore


CREATE TABLE `Businesses` (
`id` BIGINT NOT NULL AUTO_INCREMENT ,
`businessName` VARCHAR( 64 ) NOT NULL ,
`isChristianBookstore` TINYINT( 1 ) NOT NULL ,
`isGift` TINYINT( 1 ) NOT NULL ,
`isHomeDecor` TINYINT( 1 ) NOT NULL ,
`isSkinCareAndCosmetics` TINYINT( 1 ) NOT NULL ,
`isThriftStore` TINYINT( 1 ) NOT NULL ,
PRIMARY KEY ( `id` )
) TYPE = MYISAM ;


$DbFieldByFormFieldMap = array(
'category_1' => 'isChristianBookstore',
'category_42' => 'isGift',
'category_44' => 'isHomeDecor',
'category_43' => 'isSkinCareAndCosmetics',
'category_17' => 'isThriftStore'
);
$sql = "SELECT `id`, `businessName` FROM `Businesses` WHERE ";
foreach($_POST as $formField => $formValue){
if(substr($formField, 0, 9) == "category_" && substr($formValue, -1)
== "a"){//Handle any Not Selected
$sql .= "`" . $DbFieldByFormFieldMap[$formField] . "` = '0'
AND ";
}
if(substr($formField, 0, 9) == "category_" && substr($formValue, -1)
== "b"){//Handle any Must Include
$sql .= "`" . $DbFieldByFormFieldMap[$formField] . "` = '1'
AND ";
}
}
if(substr($sql, -4) == "AND "){
$sql = substr($sql, 0, -4);
}else{
$sql .= "1";
}
echo "SQL:$sql";
?>

It was getting a tad complicated with the "Could Include" using "OR" and
testing for the end of the existing $sql string, but the "Could Include"'s
just need to be omitted from the SQL query altogether.

Regards,
Dwight

God Bless!

> -----Original Message-----
> From: Ron Piggott [mailto:ron.php@actsministries.org]
> Sent: Monday, April 23, 2007 11:31 PM
> To: PHP DB
> Subject: [PHP-DB] SELECT string
>
>
> I am looking for help to write a SELECT syntax to help me process a
> directory searching query tool I am developing.
>
> If you start at
> http://www.actsministrieschristianevangelism.org/ministrydir ectory/ and
> under 'Step 1:' click Business a form is displayed.
>
> My question is how would you generate the SELECT syntax for the search
> results "Could Include" a given category and "Must Include" a given
> category based on what the user has inputted through this form?
>
> Ron

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php