Forum Moderators: coopster

Message Too Old, No Replies

Whats the problem..? i want to create a multiple seach, plz help me

Whats the problem..? i want to create a multiple seach, plz help me

         

sp00ky

1:56 pm on Apr 7, 2003 (gmt 0)

10+ Year Member



mysql_select_db($database_CONNgram, $CONNgram);
$query_RSa2 = "SELECT * FROM a2";
$RSa2 = mysql_query($query_RSa2, $CONNgram) or die(mysql_error());
$row_RSa2 = mysql_fetch_assoc($RSa2);
$totalRows_RSa2 = mysql_num_rows($RSa2);

$maxRows_RSsearcha2 = 10;
$pageNum_RSsearcha2 = 0;
if (isset($HTTP_GET_VARS['pageNum_RSsearcha2'])) {
$pageNum_RSsearcha2 = $HTTP_GET_VARS['pageNum_RSsearcha2'];
}
$startRow_RSsearcha2 = $pageNum_RSsearcha2 * $maxRows_RSsearcha2;

$varaddress_RSsearcha2 = "%";
if (isset(Request.QueryString("%a2.address%"))) {
$varaddress_RSsearcha2 = (get_magic_quotes_gpc())? Request.QueryString("a2.address") : addslashes(Request.QueryString("a2.address"));
}
$varafm_RSsearcha2 = "%";
if (isset(Request.QueryString("a2.afm"))) {
$varafm_RSsearcha2 = (get_magic_quotes_gpc())? Request.QueryString("a2.afm") : addslashes(Request.QueryString("a2.afm"));
}
$varcity_RSsearcha2 = "%";
if (isset(Request.QueryString("a2.city"))) {
$varcity_RSsearcha2 = (get_magic_quotes_gpc())? Request.QueryString("a2.city") : addslashes(Request.QueryString("a2.city"));
}
$varcompany_RSsearcha2 = "%%";
if (isset(Request.QueryString("a2.companyn"))) {
$varcompany_RSsearcha2 = (get_magic_quotes_gpc())? Request.QueryString("a2.companyn") : addslashes(Request.QueryString("a2.companyn"));
}
$varepagelma_RSsearcha2 = "%%";
if (isset(Request.QueryString("a2.epagelma"))) {
$varepagelma_RSsearcha2 = (get_magic_quotes_gpc())? Request.QueryString("a2.epagelma") : addslashes(Request.QueryString("a2.epagelma"));
}
mysql_select_db($database_CONNgram, $CONNgram);
$query_RSsearcha2 = sprintf("SELECT a2.companyn, a2.epagelma, a2.address, a2.city, a2.afm, a2.doy, a2.thl, a2.fax, a2.email FROM a2 WHERE a2.companyn LIKE '%%%s%%' AND a2.epagelma LIKE '%s' AND a2.address LIKE '%s' AND a2.city LIKE '%s' AND a2.afm LIKE '%s' AND a2.doy LIKE 'vardoy' AND a2.thl LIKE 'varthl' AND a2.fax LIKE 'varfax' AND a2.email LIKE 'varemail'", $varcompany_RSsearcha2,$varepagelma_RSsearcha2, $varaddress_RSsearcha2, $varcity_RSsearcha2, $varafm_RSsearcha2);
$query_limit_RSsearcha2 = sprintf("%s LIMIT %d, %d", $query_RSsearcha2, $startRow_RSsearcha2, $maxRows_RSsearcha2);
$RSsearcha2 = mysql_query($query_limit_RSsearcha2, $CONNgram) or die(mysql_error());
$row_RSsearcha2 = mysql_fetch_assoc($RSsearcha2);

[edited by: jatar_k at 1:59 pm (utc) on April 7, 2003]
[edit reason] sidescroll [/edit]

jatar_k

2:00 pm on Apr 7, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld sp00ky,

well, that's a whole ton of code but what might be the problem/question?

Birdman

2:00 pm on Apr 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I looks like you are mixing some ASP in there.(Request.QueryString)

sp00ky

7:39 am on Apr 8, 2003 (gmt 0)

10+ Year Member



Yes, i have tangled little ASP here, i want make a multiple search but i do not know how to define the default VALUE and the run time VALUE generally variables.. i works with ASP and for a little time i work with PHP and mysql. plz help..

Birdman

12:22 pm on Apr 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's really to easy to reference your variables in PHP. They should already be set.

If your refering url was...

http*//yoursite.com?id=1234&name=widget

...the variables $id and $name are already set. No need for the QueryString thing.

PHP variables Manual [php.net]

sp00ky

1:08 pm on Apr 8, 2003 (gmt 0)

10+ Year Member



SELECT a2.companyn, a2.epagelma, a2.address, a2.city, a2.afm, a2.doy, a2.thl, a2.fax, a2.email
FROM a2
WHERE a2.companyn LIKE 'varcompany'
AND a2.epagelma LIKE 'varepagelma'
AND a2.address LIKE 'varaddress'
AND a2.city LIKE 'varcity'
AND a2.afm LIKE 'varafm'
AND a2.doy LIKE 'vardoy'
AND a2.thl LIKE 'varthl'
AND a2.fax LIKE 'varfax'
AND a2.email LIKE 'varemail'

----------------------------------------------------------
NAME DEFAULT VALUE RUN TIME VALUE
varcompany ? "a2.companyn" right?

The syntax is ok?
I wrote this as multiple criteria in DreamWeaverMX.
What about default value, what suppose to right there?
I'm a little bit comfused working with PHP cause i used to work with ASP..I mean ,how do you define the variables?

Birdman

1:26 pm on Apr 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



SpOOky,

You've got me confused. I really think you should browse the manual at [php.net...]

Click "documentation" at the top and you can choose any language.