RE: [PHP-DB] SELECT string
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 ; '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:[EMAIL PROTECTED] > 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/ministrydirectory/ 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
Re: [PHP-DB] SELECT string
cmiiw.. since i don't the visual what u said bellow - Original Message - From: "Ron Piggott" <[EMAIL PROTECTED]> 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/ministrydirectory/ 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
[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/ministrydirectory/ 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
RE: [PHP-DB] Select string.
$login = mysql_query("SELECT * FROM Users WHERE Username ='$User_Name'"); > -Original Message- > From: Shiloh Madsen [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, July 10, 2002 4:48 PM > To: php-db > Subject: [PHP-DB] Select string. > > > Yet another thing i need some quick help with. What is the > proper way to > generate a select string in php. I know if youre trying to select a > value from a column you need to enclose it in double quotes if youre > doing it directly in sql. in this case the value in question is being > passed as a variable from a previous page. i have the current > line for > selection in my page, but i dont think it is correct. any help? > > $login = mysql_query("SELECT * FROM Users WHERE Username =". > $User_Name) > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Select string.
Yet another thing i need some quick help with. What is the proper way to generate a select string in php. I know if youre trying to select a value from a column you need to enclose it in double quotes if youre doing it directly in sql. in this case the value in question is being passed as a variable from a previous page. i have the current line for selection in my page, but i dont think it is correct. any help? $login = mysql_query("SELECT * FROM Users WHERE Username =". $User_Name) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php