Re: [PHP-DB] search of data base - again

2012-03-31 Thread Gonzalo
Why don´t you echo the $sql2 to see the query. That´s would be very
helpful. Also, are you closing the ')' in the 'values'?

Greetings

On Fri, Mar 30, 2012 at 3:55 PM, Gavin  wrote:

> |DATE| 
> >
> => MySQL permits some keywords to be used as unquoted identifiers because
> many people previously used them. Examples are those in the following list:
>
>  *
>
>   |ACTION|
>
>  *
>
>   |BIT| 
> 
> >
>
>  *
>
>   |DATE| 
> 
> >
>
>  *
>
>   |ENUM| 
> 
> >
>
>  *
>
>   |NO|
>
>  *
>
>   |TEXT| 
> 
> >
>
>  *
>
>   |TIME| 
> 
> >
>
>  *
>
>   |TIMESTAMP| 
> 
> >
>
> Best Regards,
>
> Gavin
>
>
> On 30/03/2012 19:48, Lars Nielsen wrote:
>
>> fre, 30 03 2012 kl. 20:00 +0200, skrev Matijn Woudt:
>>
>>> On Fri, Mar 30, 2012 at 7:49 PM, Jim Giner>> albanyhandball.com >  wrote:
>>>
 ""Jim Giner"">
  wrote in message
 news:**E44A0D84E492452DAB2BDEBC4C4B8A**58@laptop2...

> ===
> Martijn&  Jim -
>
>
> Is it just the date that is the problem?
>
> Yes.
>
> Tru dat.  But mySql doesn't want the dashes embedded.  The format
> string
> should be "Ymd" instead.
>
> That's what I am doing.  No luck.
>
> Ethan
>
> *
> You're using a format with just Ymd in it (no dashes)?  Can you post
> *just* the query as it is looks in your php code?
>
>
>
>  While waiting - I looked at your code again.  What is the (greater
 than)
 symbol doing in front of your $Date var?

> Date) VALUES(null, '$Site', '$MedRec', '$Notes', $Weight, $BMI,>
>> '$Date'";
>>
> Also - is it valid to use the word 'Date' as a field name?  Just
 wondering.

>>> It is valid, though It may require quotes (backtick ?)
>>>
>>>  Hi,
>>
>> Have you tried to write out the generated sql with var_dump() and then
>> feed it to an SQL interface? By using Mysql Query Browser you can easily
>> check it the sql-string is correct.
>>
>> Regards
>> Lars Nielsen
>> LFWeb
>>
>>
>>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP-DB] search of data base - again

2012-03-30 Thread Gavin
|DATE|  => MySQL 
permits some keywords to be used as unquoted identifiers because many 
people previously used them. Examples are those in the following list:


 *

   |ACTION|

 *

   |BIT| 

 *

   |DATE| 

 *

   |ENUM| 

 *

   |NO|

 *

   |TEXT| 

 *

   |TIME| 

 *

   |TIMESTAMP| 

Best Regards,

Gavin

On 30/03/2012 19:48, Lars Nielsen wrote:

fre, 30 03 2012 kl. 20:00 +0200, skrev Matijn Woudt:

On Fri, Mar 30, 2012 at 7:49 PM, Jim Giner  wrote:

""Jim Giner""  wrote in message
news:E44A0D84E492452DAB2BDEBC4C4B8A58@laptop2...

===
Martijn&  Jim -

Is it just the date that is the problem?

Yes.

Tru dat.  But mySql doesn't want the dashes embedded.  The format string
should be "Ymd" instead.

That's what I am doing.  No luck.

Ethan

*
You're using a format with just Ymd in it (no dashes)?  Can you post
*just* the query as it is looks in your php code?




While waiting - I looked at your code again.  What is the (greater than)
symbol doing in front of your $Date var?

Date) VALUES(null, '$Site', '$MedRec', '$Notes', $Weight, $BMI,>
'$Date'";

Also - is it valid to use the word 'Date' as a field name?  Just wondering.

It is valid, though It may require quotes (backtick ?)


Hi,

Have you tried to write out the generated sql with var_dump() and then
feed it to an SQL interface? By using Mysql Query Browser you can easily
check it the sql-string is correct.

Regards
Lars Nielsen
LFWeb




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



Re: [PHP-DB] search of data base - again

2012-03-30 Thread Lars Nielsen

fre, 30 03 2012 kl. 20:00 +0200, skrev Matijn Woudt:
> On Fri, Mar 30, 2012 at 7:49 PM, Jim Giner  
> wrote:
> >
> > ""Jim Giner""  wrote in message
> > news:E44A0D84E492452DAB2BDEBC4C4B8A58@laptop2...
> >> ===
> >> Martijn & Jim -
> >>
> >> Is it just the date that is the problem?
> >>
> >> Yes.
> >>
> >> Tru dat.  But mySql doesn't want the dashes embedded.  The format string
> >> should be "Ymd" instead.
> >>
> >> That's what I am doing.  No luck.
> >>
> >> Ethan
> >>
> >> *
> >> You're using a format with just Ymd in it (no dashes)?  Can you post
> >> *just* the query as it is looks in your php code?
> >>
> >>
> >>
> > While waiting - I looked at your code again.  What is the (greater than)
> > symbol doing in front of your $Date var?
> >> > Date) VALUES(null, '$Site', '$MedRec', '$Notes', $Weight, $BMI, >
> >> > '$Date'";
> >
> > Also - is it valid to use the word 'Date' as a field name?  Just wondering.
> 
> It is valid, though It may require quotes (backtick ?)
> 
Hi,

Have you tried to write out the generated sql with var_dump() and then
feed it to an SQL interface? By using Mysql Query Browser you can easily
check it the sql-string is correct.

Regards
Lars Nielsen 
LFWeb


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



Re: [PHP-DB] search of data base - again

2012-03-30 Thread Matijn Woudt
On Fri, Mar 30, 2012 at 7:49 PM, Jim Giner  wrote:
>
> ""Jim Giner""  wrote in message
> news:E44A0D84E492452DAB2BDEBC4C4B8A58@laptop2...
>> ===
>> Martijn & Jim -
>>
>> Is it just the date that is the problem?
>>
>> Yes.
>>
>> Tru dat.  But mySql doesn't want the dashes embedded.  The format string
>> should be "Ymd" instead.
>>
>> That's what I am doing.  No luck.
>>
>> Ethan
>>
>> *
>> You're using a format with just Ymd in it (no dashes)?  Can you post
>> *just* the query as it is looks in your php code?
>>
>>
>>
> While waiting - I looked at your code again.  What is the (greater than)
> symbol doing in front of your $Date var?
>> > Date) VALUES(null, '$Site', '$MedRec', '$Notes', $Weight, $BMI, >
>> > '$Date'";
>
> Also - is it valid to use the word 'Date' as a field name?  Just wondering.

It is valid, though It may require quotes (backtick ?)

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



Re: [PHP-DB] search of data base - again

2012-03-30 Thread Jim Giner

""Jim Giner""  wrote in message 
news:E44A0D84E492452DAB2BDEBC4C4B8A58@laptop2...
> ===
> Martijn & Jim -
>
> Is it just the date that is the problem?
>
> Yes.
>
> Tru dat.  But mySql doesn't want the dashes embedded.  The format string
> should be "Ymd" instead.
>
> That's what I am doing.  No luck.
>
> Ethan
>
> *
> You're using a format with just Ymd in it (no dashes)?  Can you post 
> *just* the query as it is looks in your php code?
>
>
>
While waiting - I looked at your code again.  What is the (greater than) 
symbol doing in front of your $Date var?
> > Date) VALUES(null, '$Site', '$MedRec', '$Notes', $Weight, $BMI, > 
> > '$Date'";

Also - is it valid to use the word 'Date' as a field name?  Just wondering.



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



Re: [PHP-DB] search of data base - again

2012-03-30 Thread Jim Giner

===
Martijn & Jim -

Is it just the date that is the problem?

Yes.

Tru dat.  But mySql doesn't want the dashes embedded.  The format string
should be "Ymd" instead.

That's what I am doing.  No luck.

Ethan

*
You're using a format with just Ymd in it (no dashes)?  Can you post *just* 
the query as it is looks in your php code?





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



Re: [PHP-DB] search of data base - again

2012-03-30 Thread Ethan Rosenberg

See below-
- Original Message - From: "Ethan Rosenberg" 
Newsgroups: php.db
To: "Matijn Woudt" 
Cc: "php-db-lists.php.net" 
; 

Sent: Friday, March 30, 2012 1:00 PM
Subject: Re: [PHP-DB] search of data base - again


At 07:15 PM 3/29/2012, Matijn Woudt wrote:

On Fri, Mar 30, 2012 at 1:10 AM, Ethan Rosenberg  wrote:
> Sending again, since no response on 1st try.
>
> Ethan
> ==
> Dear List
>
> I am trying to insert data into a table, with no success.
>
> I have two tables:
>
> mysql> describe Visit3;
> ++--+--+-+-++
> | Field  | Type         | Null | Key | 
Default | Extra        >  |

> ++--+--+-+-++
> | Indx   | int(4)       | NO   | PRI | NULL    | auto_increment |
> | Site   | varchar(6)   | YES  |     |
NULL Â  Â | Â  Â  Â  Â  Â  Â  Â  Â |
> | MedRec | int(6) Â  Â  Â  | YES Â | Â  Â  |
NULL Â  Â | Â  Â  Â  Â  Â  Â  Â  Â |
> | Notes  | text         | YES  |
    | NULL    |                |
> | Weight | int(4) Â  Â  Â  | YES Â | Â  Â  |
NULL Â  Â | Â  Â  Â  Â  Â  Â  Â  Â |
> | BMI Â  Â | decimal(3,1) | YES Â | Â  Â  |
NULL Â  Â | Â  Â  Â  Â  Â  Â  Â  Â |
> | Date   | date         | YES  |
    | NULL    |                |
> ++--+--+-+-++
>
> ++-+--+-+-+---+
> | Field  | Type        | Null | Key | Default | Extra |
> ++-+--+-+-+---+
> | Site   | varchar(6)  | NO   | PRI |         |       |
> | MedRec | int(6) Â  Â  Â | NO Â  | PRI | NULL Â  Â | Â  Â  Â  |
> | Fname  | varchar(15) | YES  |     | NULL    |       |
> | Lname  | varchar(30) | YES  |     | NULL    |       |
> | Phone  | varchar(30) | YES  |     | NULL    |       |
> | Height | int(4) Â  Â  Â | YES Â | Â  Â  | NULL Â  Â | Â  Â  Â  |
> | Sex    | char(7)     | YES  |     | NULL    |       |
> | Hx     | text        | YES  |     | NULL    |       |
> ++-+--+-+-+---+
>
> I calculate some values:
>
> Â  Â default_timezone_set('America/New_York');
>     $Date  = date('M d Y');
> Â  Â  $sql1 = "select MedRec, Height from Intake3 where (MedRec =
> '$_POST[MedRec]')";
> Â  Â  $result = mysqli_query($cxn, $sql1);
> Â  Â $row = mysqli_fetch_array($result);
> Â  Â $MedRec = $row[0];
> Â  Â $Height = $row[1];
> Â  Â $Weight = $_POST['Weight'];
>    $Notes  = $_POST['Notes'];
> Â  Â $sql4 = "select MedRec, Weight from Visit3 where (MedRec =
> $_POST[MedRec])";
> Â  Â $result4 = mysqli_query($cxn, $sql4);
> Â  Â $row4 = mysqli_fetch_array($result4);
> Â  Â $MedRec = $_POST['MedRec'];
> Â  Â $BMI = ($Weight*703)/($Height*$Height);
> Â  Â $BMI = round($BMI,1);
> Â  Â $fptr1 = fopen("/home/ethan/PHP/HRecnumSite", "r+");
> Â  Â fscanf($fptr1,"%d %s",$Num, $Site);
> Â  Â echo "$Site, $MedRec, $Notes, $Weight $BMI, $Date ";
> Â  Â $sql2 = Â "INSERT INTO Visit3(Indx, 
Site, MedRec, Notes, Weight, > BMI,

> Date) VALUES(null, '$Site', '$MedRec', '$Notes', $Weight, $BMI, > '$Date'";
> Â  Â $result2 = mysqli_query($cxn, $sql2);
>
> They display properly.
>
> $sql3 = "select max(Indx) from Visit3";
> $result3 = mysqli_query($cxn, $sql3);
> var_dump($result3);
> echo "result3 Â  ";
> print_r($result3);
> $row = mysqli_fetch_array($result3);
> $Indx = $row[0];
>
> echo "\n";
>
> echo " $Indx \n";
> echo " $Site \n";
> echo " $MedRec \n";
> echo " $Notes \n";
> echo " $Weight \n";
> echo " $BMI \n";
> echo " $Date \n";
>
> echo "\n";
> echo "";
>
> The date value is not inserted properly into the table:
>
> mysql> select * from Visit3;
> | 2416 | AA Â  | Â 10001 | uih s45t | Â  Â 125 | 19.0 | -00-00 |
> | 2417 | AA Â  | Â 1 | bnkjlolk | Â  Â 174 | 28.1 | -00-00 |
>
> Advice and help, please.
>
> Thanks.
>
> Ethan Rosenberg
>

I think MySQL wants the date in -M-D format, did you try changing
$Date  = date('M d Y');
to
$Date  = date('Y-m-d');

- Matijn

==
Martijn & Jim -

Thanks.

I made the suggested changes.  The date still is not in the database.

Advice and help, please.

Ethan

===
Martijn & Jim -

Is it just the date that is the problem?

Yes.

Tru dat.  But mySql doesn't want the dashes embedded.  The format string
should be "Ymd" instead.

That's what I am doing.  No luck.

Ethan 




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



Re: [PHP-DB] search of data base - again

2012-03-30 Thread Jim Giner
>
>I think MySQL wants the date in -M-D format, did you try changing
>$Date  = date('M d Y');
>to
>$Date  = date('Y-m-d');
>
>- Matijn

Tru dat.  But mySql doesn't want the dashes embedded.  The format string 
should be "Ymd" instead.



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



Re: [PHP-DB] search of data base - again

2012-03-30 Thread Ethan Rosenberg

At 07:15 PM 3/29/2012, Matijn Woudt wrote:

On Fri, Mar 30, 2012 at 1:10 AM, Ethan Rosenberg  wrote:
> Sending again, since no response on 1st try.
>
> Ethan
> ==
> Dear List
>
> I am trying to insert data into a table, with no success.
>
> I have two tables:
>
> mysql> describe Visit3;
> ++--+--+-+-++
> | Field  | Type         | Null | Key | Default | Extra          |
> ++--+--+-+-++
> | Indx   | int(4)       | NO   | PRI | NULL    | auto_increment |
> | Site   | varchar(6)   | YES  |     | 
NULL Â  Â | Â  Â  Â  Â  Â  Â  Â  Â |
> | MedRec | int(6) Â  Â  Â  | YES Â | Â  Â  | 
NULL Â  Â | Â  Â  Â  Â  Â  Â  Â  Â |
> | Notes  | text         | YES  | 
    | NULL    |                |
> | Weight | int(4) Â  Â  Â  | YES Â | Â  Â  | 
NULL Â  Â | Â  Â  Â  Â  Â  Â  Â  Â |
> | BMI Â  Â | decimal(3,1) | YES Â | Â  Â  | 
NULL Â  Â | Â  Â  Â  Â  Â  Â  Â  Â |
> | Date   | date         | YES  | 
    | NULL    |                |

> ++--+--+-+-++
>
> ++-+--+-+-+---+
> | Field  | Type        | Null | Key | Default | Extra |
> ++-+--+-+-+---+
> | Site   | varchar(6)  | NO   | PRI |         |       |
> | MedRec | int(6) Â  Â  Â | NO Â  | PRI | NULL Â  Â | Â  Â  Â  |
> | Fname  | varchar(15) | YES  |     | NULL    |       |
> | Lname  | varchar(30) | YES  |     | NULL    |       |
> | Phone  | varchar(30) | YES  |     | NULL    |       |
> | Height | int(4) Â  Â  Â | YES Â | Â  Â  | NULL Â  Â | Â  Â  Â  |
> | Sex    | char(7)     | YES  |     | NULL    |       |
> | Hx     | text        | YES  |     | NULL    |       |
> ++-+--+-+-+---+
>
> I calculate some values:
>
> Â  Â default_timezone_set('America/New_York');
>     $Date  = date('M d Y');
> Â  Â  $sql1 = "select MedRec, Height from Intake3 where (MedRec =
> '$_POST[MedRec]')";
> Â  Â  $result = mysqli_query($cxn, $sql1);
> Â  Â $row = mysqli_fetch_array($result);
> Â  Â $MedRec = $row[0];
> Â  Â $Height = $row[1];
> Â  Â $Weight = $_POST['Weight'];
>    $Notes  = $_POST['Notes'];
> Â  Â $sql4 = "select MedRec, Weight from Visit3 where (MedRec =
> $_POST[MedRec])";
> Â  Â $result4 = mysqli_query($cxn, $sql4);
> Â  Â $row4 = mysqli_fetch_array($result4);
> Â  Â $MedRec = $_POST['MedRec'];
> Â  Â $BMI = ($Weight*703)/($Height*$Height);
> Â  Â $BMI = round($BMI,1);
> Â  Â $fptr1 = fopen("/home/ethan/PHP/HRecnumSite", "r+");
> Â  Â fscanf($fptr1,"%d %s",$Num, $Site);
> Â  Â echo "$Site, $MedRec, $Notes, $Weight $BMI, $Date ";
> Â  Â $sql2 = Â "INSERT INTO Visit3(Indx, Site, MedRec, Notes, Weight, BMI,
> Date) VALUES(null, '$Site', '$MedRec', '$Notes', $Weight, $BMI, '$Date'";
> Â  Â $result2 = mysqli_query($cxn, $sql2);
>
> They display properly.
>
> $sql3 = "select max(Indx) from Visit3";
> $result3 = mysqli_query($cxn, $sql3);
> var_dump($result3);
> echo "result3 Â  ";
> print_r($result3);
> $row = mysqli_fetch_array($result3);
> $Indx = $row[0];
>
> echo "\n";
>
> echo " $Indx \n";
> echo " $Site \n";
> echo " $MedRec \n";
> echo " $Notes \n";
> echo " $Weight \n";
> echo " $BMI \n";
> echo " $Date \n";
>
> echo "\n";
> echo "";
>
> The date value is not inserted properly into the table:
>
> mysql> select * from Visit3;
> | 2416 | AA Â  | Â 10001 | uih s45t | Â  Â 125 | 19.0 | -00-00 |
> | 2417 | AA Â  | Â 1 | bnkjlolk | Â  Â 174 | 28.1 | -00-00 |
>
> Advice and help, please.
>
> Thanks.
>
> Ethan Rosenberg
>

I think MySQL wants the date in -M-D format, did you try changing
$Date  = date('M d Y');
to
$Date  = date('Y-m-d');

- Matijn

==
Martijn & Jim -

Thanks.

I made the suggested changes.  The date still is not in the database.

Advice and help, please.

Ethan 




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



Re: [PHP-DB] search of data base - again

2012-03-30 Thread Jim Giner
I agree with Martin's assessment.  Took me awhile to always remember to have 
the date in the correct format. 



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



Re: [PHP-DB] search of data base - again

2012-03-29 Thread Matijn Woudt
On Fri, Mar 30, 2012 at 1:10 AM, Ethan Rosenberg  wrote:
> Sending again, since no response on 1st try.
>
> Ethan
> ==
> Dear List
>
> I am trying to insert data into a table, with no success.
>
> I have two tables:
>
> mysql> describe Visit3;
> ++--+--+-+-++
> | Field  | Type         | Null | Key | Default | Extra          |
> ++--+--+-+-++
> | Indx   | int(4)       | NO   | PRI | NULL    | auto_increment |
> | Site   | varchar(6)   | YES  |     | NULL    |                |
> | MedRec | int(6)       | YES  |     | NULL    |                |
> | Notes  | text         | YES  |     | NULL    |                |
> | Weight | int(4)       | YES  |     | NULL    |                |
> | BMI    | decimal(3,1) | YES  |     | NULL    |                |
> | Date   | date         | YES  |     | NULL    |                |
> ++--+--+-+-++
>
> ++-+--+-+-+---+
> | Field  | Type        | Null | Key | Default | Extra |
> ++-+--+-+-+---+
> | Site   | varchar(6)  | NO   | PRI |         |       |
> | MedRec | int(6)      | NO   | PRI | NULL    |       |
> | Fname  | varchar(15) | YES  |     | NULL    |       |
> | Lname  | varchar(30) | YES  |     | NULL    |       |
> | Phone  | varchar(30) | YES  |     | NULL    |       |
> | Height | int(4)      | YES  |     | NULL    |       |
> | Sex    | char(7)     | YES  |     | NULL    |       |
> | Hx     | text        | YES  |     | NULL    |       |
> ++-+--+-+-+---+
>
> I calculate some values:
>
>    default_timezone_set('America/New_York');
>     $Date  = date('M d Y');
>     $sql1 = "select MedRec, Height from Intake3 where (MedRec =
> '$_POST[MedRec]')";
>     $result = mysqli_query($cxn, $sql1);
>    $row = mysqli_fetch_array($result);
>    $MedRec = $row[0];
>    $Height = $row[1];
>    $Weight = $_POST['Weight'];
>    $Notes  = $_POST['Notes'];
>    $sql4 = "select MedRec, Weight from Visit3 where (MedRec =
> $_POST[MedRec])";
>    $result4 = mysqli_query($cxn, $sql4);
>    $row4 = mysqli_fetch_array($result4);
>    $MedRec = $_POST['MedRec'];
>    $BMI = ($Weight*703)/($Height*$Height);
>    $BMI = round($BMI,1);
>    $fptr1 = fopen("/home/ethan/PHP/HRecnumSite", "r+");
>    fscanf($fptr1,"%d %s",$Num, $Site);
>    echo "$Site, $MedRec, $Notes, $Weight $BMI, $Date ";
>    $sql2 =  "INSERT INTO Visit3(Indx, Site, MedRec, Notes, Weight, BMI,
> Date) VALUES(null, '$Site', '$MedRec', '$Notes', $Weight, $BMI, '$Date'";
>    $result2 = mysqli_query($cxn, $sql2);
>
> They display properly.
>
> $sql3 = "select max(Indx) from Visit3";
> $result3 = mysqli_query($cxn, $sql3);
> var_dump($result3);
> echo "result3   ";
> print_r($result3);
> $row = mysqli_fetch_array($result3);
> $Indx = $row[0];
>
> echo "\n";
>
> echo " $Indx \n";
> echo " $Site \n";
> echo " $MedRec \n";
> echo " $Notes \n";
> echo " $Weight \n";
> echo " $BMI \n";
> echo " $Date \n";
>
> echo "\n";
> echo "";
>
> The date value is not inserted properly into the table:
>
> mysql> select * from Visit3;
> | 2416 | AA   |  10001 | uih s45t |    125 | 19.0 | -00-00 |
> | 2417 | AA   |  1 | bnkjlolk |    174 | 28.1 | -00-00 |
>
> Advice and help, please.
>
> Thanks.
>
> Ethan Rosenberg
>

I think MySQL wants the date in -M-D format, did you try changing
$Date  = date('M d Y');
to
$Date  = date('Y-m-d');

- Matijn

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



[PHP-DB] search of data base - again

2012-03-29 Thread Ethan Rosenberg

Sending again, since no response on 1st try.

Ethan
==
Dear List

I am trying to insert data into a table, with no success.

I have two tables:

mysql> describe Visit3;
++--+--+-+-++
| Field  | Type | Null | Key | Default | Extra  |
++--+--+-+-++
| Indx   | int(4)   | NO   | PRI | NULL| auto_increment |
| Site   | varchar(6)   | YES  | | NULL||
| MedRec | int(6)   | YES  | | NULL||
| Notes  | text | YES  | | NULL||
| Weight | int(4)   | YES  | | NULL||
| BMI| decimal(3,1) | YES  | | NULL||
| Date   | date | YES  | | NULL||
++--+--+-+-++

++-+--+-+-+---+
| Field  | Type| Null | Key | Default | Extra |
++-+--+-+-+---+
| Site   | varchar(6)  | NO   | PRI | |   |
| MedRec | int(6)  | NO   | PRI | NULL|   |
| Fname  | varchar(15) | YES  | | NULL|   |
| Lname  | varchar(30) | YES  | | NULL|   |
| Phone  | varchar(30) | YES  | | NULL|   |
| Height | int(4)  | YES  | | NULL|   |
| Sex| char(7) | YES  | | NULL|   |
| Hx | text| YES  | | NULL|   |
++-+--+-+-+---+

I calculate some values:

default_timezone_set('America/New_York');
 $Date  = date('M d Y');
 $sql1 = "select MedRec, Height from Intake3 where (MedRec = 
'$_POST[MedRec]')";

 $result = mysqli_query($cxn, $sql1);
$row = mysqli_fetch_array($result);
$MedRec = $row[0];
$Height = $row[1];
$Weight = $_POST['Weight'];
$Notes  = $_POST['Notes'];
$sql4 = "select MedRec, Weight from Visit3 where (MedRec = 
$_POST[MedRec])";

$result4 = mysqli_query($cxn, $sql4);
$row4 = mysqli_fetch_array($result4);
$MedRec = $_POST['MedRec'];
$BMI = ($Weight*703)/($Height*$Height);
$BMI = round($BMI,1);
$fptr1 = fopen("/home/ethan/PHP/HRecnumSite", "r+");
fscanf($fptr1,"%d %s",$Num, $Site);
echo "$Site, $MedRec, $Notes, $Weight $BMI, $Date ";
$sql2 =  "INSERT INTO Visit3(Indx, Site, MedRec, Notes, Weight, 
BMI, Date) VALUES(null, '$Site', '$MedRec', '$Notes', $Weight, $BMI, '$Date'";

$result2 = mysqli_query($cxn, $sql2);

They display properly.

$sql3 = "select max(Indx) from Visit3";
$result3 = mysqli_query($cxn, $sql3);
var_dump($result3);
echo "result3   ";
print_r($result3);
$row = mysqli_fetch_array($result3);
$Indx = $row[0];

echo "\n";

echo " $Indx \n";
echo " $Site \n";
echo " $MedRec \n";
echo " $Notes \n";
echo " $Weight \n";
echo " $BMI \n";
echo " $Date \n";

echo "\n";
echo "";

The date value is not inserted properly into the table:

mysql> select * from Visit3;
| 2416 | AA   |  10001 | uih 
s45t 
|125 | 19.0 | -00-00 |
| 2417 | AA   |  1 | 
bnkjlolk 
|174 | 28.1 | -00-00 |


Advice and help, please.

Thanks.

Ethan Rosenberg






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



[PHP-DB] Search relevance

2011-02-15 Thread Ron Piggott

I would like to have the search results display in order of relevance --- and 
essentially add these two lines to the query.  


HAVING relevance > 0.2 
ORDER BY relevance DESC


However with how I built the database and the search spanning several tables I 
am unsure how to do this.  Could someone help me please?

Ron



SELECT `ministry_profiles`.`reference`, `ministry_profiles`.`organization`, 
`ministry_profiles_activity`.`activity`
FROM
(
(
( `ministry_profiles` LEFT OUTER JOIN `ministry_profiles_listing_details` ON 
`ministry_profiles`.`reference` = 
`ministry_profiles_listing_details`.`ministry_profile_reference` )
LEFT OUTER JOIN `ministry_profiles_activity` ON 
`ministry_profiles`.`reference` = 
`ministry_profiles_activity`.`ministry_profiles_reference` )
LEFT OUTER JOIN `ministry_profile_categories` ON 
`ministry_profiles`.`reference` = 
`ministry_profile_categories`.`ministry_profiles_reference` )
LEFT OUTER JOIN `ministry_categories` ON 
`ministry_profile_categories`.`ministry_categories_reference` = 
`ministry_categories`.`reference`
WHERE

(

MATCH( `ministry_profiles`.`organization`, 
`ministry_profiles`.`address_line_1`, `ministry_profiles`.`address_line_2`, 
`ministry_profiles`.`city`, `ministry_profiles`.`province_state`, 
`ministry_profiles`.`postal_zip_code`, `ministry_profiles`.`country`, 
`ministry_profiles`.`telephone`, `ministry_profiles`.`toll_free`, 
`ministry_profiles`.`fax`, `ministry_profiles`.`email`, 
`ministry_profiles`.`website` )
AGAINST
('$search')
AND
`ministry_profiles`.`live` =1

)

OR

(

MATCH( `ministry_categories`.`category` )
AGAINST
('$search')

)

OR

(

MATCH( `ministry_profiles_activity`.`activity` )
AGAINST
('$search')

AND `ministry_profiles_activity`.`live` =1

)

OR

(

MATCH( `ministry_profiles_listing_details`.`contact`, 
`ministry_profiles_listing_details`.`year_founded`, 
`ministry_profiles_listing_details`.`volunteer_opportunities`, 
`ministry_profiles_listing_details`.`employment_opportunities`, 
`ministry_profiles_listing_details`.`members_of`, 
`ministry_profiles_listing_details`.`major_events`, 
`ministry_profiles_listing_details`.`associate_member_of`, 
`ministry_profiles_listing_details`.`registration_number`, 
`ministry_profiles_listing_details`.`fund_raising`,
`ministry_profiles_listing_details`.`accredited_by`,
`ministry_profiles_listing_details`.`facebook`,
`ministry_profiles_listing_details`.`twitter` )
AGAINST
('$search')
AND
`ministry_profiles_listing_details`.`live` =1
)

GROUP BY `ministry_profiles`.`reference`

[PHP-DB] Search function query

2009-11-01 Thread Ron Piggott
I am writing a search function.  Is there a way to enhance this query so
it will display the best matches first down to the least matches?  As
well I don't know how to handle if the user types in more than 1 word to
search.

SELECT * FROM `store_product_profile` WHERE `product_name` LIKE '%
$search_string%' AND `product_description` LIKE '%$search_string%' AND
`keywords` LIKE '%$search_string%'

Ron


Re: [PHP-DB] Search

2009-10-16 Thread Emiliano Boragina
Hello jack...

Is like you say... the ID in each table is not the same.
cupones.empresas is an INT field with the empresas.id number, the same with
rubros... for that reason I do that... I will try your solution, for me is
not e good solution that code I type too, but dont know how work with two or
mor tables yet..

Thanks

2009/10/16 Jack van Zanen 

> For starters try this
>
> FROM cupones
> INNER JOIN empresas ON (empresas.id =cupones.empresa)
> INNER JOIN rubros ON (rubros.id = cupones.rubro)
>
> I am not sure about the join criteria you have given us, they look a bit
> suss to me. What is the field/are the fields that join the tables?
>
> I would imagine the joining should be on the ID field that is present in
> all three tables, but the ID may not be the same meaning for the tables.
>
>
> Jack
>
>
>
> 2009/10/16 Emiliano Boragina 
>
>>  Hello
>> I’m using this code to a search:
>>
>> $sql = "SELECT empresas.id, empresas.nombre, rubros.id, rubros.nombre,
>> cupones.empresa, cupones.rubro, cupones.titulo, cupones.descripcion FROM
>> cupones INNER JOIN empresas INNER JOIN rubros ON (empresas.id =
>> cupones.empresa OR rubros.id = cupones.rubro) WHERE (empresas.nombre LIKE
>> '%$_GET[busqueda]%' OR rubros.nombre LIKE '%$_GET[busqueda]%' OR
>> cupones.titulo LIKE '%$_GET[busqueda]%' OR cupones.descripcion LIKE
>> '%$_GET[busqueda]%')";
>>
>> I have a input text with name “clave”.
>> I have three tables: empresas, rubros anda cupones.
>> The “empresa” table has got ID and NOMBRE The “rubro” table has got ID and
>> NOMBRE And the “cupones” table has got ID (from the coupon), EMPRESA
>> (int),
>> RUBRO (int) , TITULO, DESCRIPCION
>>
>> The client has got 100 coupons (CUPONES table) in the data base.
>> He wants to search in any of these fields, but with tath code the search
>> return 200 or 1000 results.
>>
>> If the total of coupons are 100, what should I do to the searching return
>> only one time the coupon with the keyword insert to search...
>> Thanks a lot
>>
>>
>> +
>> _
>>// Emiliano Boragina _
>>// Diseño & Comunicación //
>> +
>> _
>>// emiliano.borag...@gmail.com  /
>>// 15 40 58 60 02 ///
>> +
>> _
>>
>>
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> --
> Jack van Zanen
>
> -
> This e-mail and any attachments may contain confidential material for the
> sole use of the intended recipient. If you are not the intended recipient,
> please be aware that any disclosure, copying, distribution or use of this
> e-mail or any attachment is prohibited. If you have received this e-mail in
> error, please contact the sender and delete all copies.
> Thank you for your cooperation
>



-- 
+_
  Emiliano Boragina //
  Diseño y Comunicación /
+_
  emiliano.borag...@gmail.com 
  15 40 58 60 02 //
+_


Re: [PHP-DB] Search

2009-10-15 Thread Jack van Zanen
For starters try this

FROM cupones
INNER JOIN empresas ON (empresas.id =cupones.empresa)
INNER JOIN rubros ON (rubros.id = cupones.rubro)

I am not sure about the join criteria you have given us, they look a bit
suss to me. What is the field/are the fields that join the tables?

I would imagine the joining should be on the ID field that is present in all
three tables, but the ID may not be the same meaning for the tables.


Jack



2009/10/16 Emiliano Boragina 

> Hello
> I’m using this code to a search:
>
> $sql = "SELECT empresas.id, empresas.nombre, rubros.id, rubros.nombre,
> cupones.empresa, cupones.rubro, cupones.titulo, cupones.descripcion FROM
> cupones INNER JOIN empresas INNER JOIN rubros ON (empresas.id =
> cupones.empresa OR rubros.id = cupones.rubro) WHERE (empresas.nombre LIKE
> '%$_GET[busqueda]%' OR rubros.nombre LIKE '%$_GET[busqueda]%' OR
> cupones.titulo LIKE '%$_GET[busqueda]%' OR cupones.descripcion LIKE
> '%$_GET[busqueda]%')";
>
> I have a input text with name “clave”.
> I have three tables: empresas, rubros anda cupones.
> The “empresa” table has got ID and NOMBRE The “rubro” table has got ID and
> NOMBRE And the “cupones” table has got ID (from the coupon), EMPRESA (int),
> RUBRO (int) , TITULO, DESCRIPCION
>
> The client has got 100 coupons (CUPONES table) in the data base.
> He wants to search in any of these fields, but with tath code the search
> return 200 or 1000 results.
>
> If the total of coupons are 100, what should I do to the searching return
> only one time the coupon with the keyword insert to search...
> Thanks a lot
>
>
> +
> _
>// Emiliano Boragina _
>// Diseño & Comunicación //
> +
> _
>// emiliano.borag...@gmail.com  /
>// 15 40 58 60 02 ///
> +
> _
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Jack van Zanen

-
This e-mail and any attachments may contain confidential material for the
sole use of the intended recipient. If you are not the intended recipient,
please be aware that any disclosure, copying, distribution or use of this
e-mail or any attachment is prohibited. If you have received this e-mail in
error, please contact the sender and delete all copies.
Thank you for your cooperation


[PHP-DB] Search

2009-10-15 Thread Emiliano Boragina
Hello
I’m using this code to a search:

$sql = "SELECT empresas.id, empresas.nombre, rubros.id, rubros.nombre,
cupones.empresa, cupones.rubro, cupones.titulo, cupones.descripcion FROM
cupones INNER JOIN empresas INNER JOIN rubros ON (empresas.id =
cupones.empresa OR rubros.id = cupones.rubro) WHERE (empresas.nombre LIKE
'%$_GET[busqueda]%' OR rubros.nombre LIKE '%$_GET[busqueda]%' OR
cupones.titulo LIKE '%$_GET[busqueda]%' OR cupones.descripcion LIKE
'%$_GET[busqueda]%')";

I have a input text with name “clave”.
I have three tables: empresas, rubros anda cupones.
The “empresa” table has got ID and NOMBRE The “rubro” table has got ID and
NOMBRE And the “cupones” table has got ID (from the coupon), EMPRESA (int),
RUBRO (int) , TITULO, DESCRIPCION

The client has got 100 coupons (CUPONES table) in the data base.
He wants to search in any of these fields, but with tath code the search
return 200 or 1000 results.

If the total of coupons are 100, what should I do to the searching return
only one time the coupon with the keyword insert to search...
Thanks a lot


+      _
   // Emiliano Boragina _
   // Diseño & Comunicación //
+      _
   // emiliano.borag...@gmail.com  /
   // 15 40 58 60 02 ///
+      _



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



[PHP-DB] search line position in a file

2007-11-08 Thread Fahmi Basya
Dear All,


i have trouble to insert data to a file.


description:
-i have an application to sell product
-i want to add some products, but for now i still do it manually by
inserting data to mysql and  php file.

question:
how can i insert some data to application and the application update mysql
and php file ?


i will appreciate your help,
thanks,

-- 
Fahmi Basya
www.commentindonesia.com/omfahmi
YM : basya_fahmi
VOIP Rakyat Number : 34752


Re: [PHP-DB] Search for whole words in MySQL 3.23

2007-06-13 Thread Zeth Lietzau

TG -

This is exactly what I was looking for. Thanks a bunch.

Zeth

On 6/13/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:


I suck at regex, but looks like 3.23 may actually support it.  And most
regex implementations have a word boundary code for doing exactly what
you're talking about.

Referring to this page: http://dev.mysql.com/doc/refman/4.1/en/regexp.html

I found this example.. hopefully it'll help you (and work ok in 3.23):

[[:<:]], [[:>:]]

These markers stand for word boundaries. They match the beginning and end
of words, respectively. A word is a sequence of word characters that is not
preceded by or followed by word characters. A word character is an
alphanumeric character in the alnum class or an underscore (_).

mysql> SELECT 'a word a' REGEXP '[[:<:]]word[[:>:]]';   -> 1
mysql> SELECT 'a xword a' REGEXP '[[:<:]]word[[:>:]]';  -> 0


-TG

= = = Original message = = =

Hi all,

I'm setting up a database search on a site, where I will essentially be
BOOLEAN searching about 6 database fields. Unfortunately, the database I'm
using is MySQL version 3.23 (completely out of my control), so I cannot
use
IN BOOLEAN MODE to simplify the process on my end. I've been able to put
together a function that does almost everything that I want, but I'm
running
into a problem - searching for whole words that may or may not be in the
beginning or end of the database field. For example, syntax like this:

...WHERE `field` LIKE '%searchterm%'...

has the limitation that if the search term is 'car', it will also bring
back
'scar', 'cartoon', etc.

While if the syntax is:

...WHERE `field` LIKE '% searchterm %'... (with spaces)

it misses words that are the first or last words of the field, or words
that
are at the end of sentences, before commas, etc.

I've looked around and haven't been able to find a way to search only for
complete words within a block of text. Any help?

Thanks in advance,
Zeth


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.




Re: [PHP-DB] Search for whole words in MySQL 3.23

2007-06-13 Thread tg-php
I suck at regex, but looks like 3.23 may actually support it.  And most regex 
implementations have a word boundary code for doing exactly what you're talking 
about.

Referring to this page: http://dev.mysql.com/doc/refman/4.1/en/regexp.html

I found this example.. hopefully it'll help you (and work ok in 3.23):

[[:<:]], [[:>:]]

These markers stand for word boundaries. They match the beginning and end of 
words, respectively. A word is a sequence of word characters that is not 
preceded by or followed by word characters. A word character is an alphanumeric 
character in the alnum class or an underscore (_).

mysql> SELECT 'a word a' REGEXP '[[:<:]]word[[:>:]]';   -> 1
mysql> SELECT 'a xword a' REGEXP '[[:<:]]word[[:>:]]';  -> 0


-TG

= = = Original message = = =

Hi all,

I'm setting up a database search on a site, where I will essentially be
BOOLEAN searching about 6 database fields. Unfortunately, the database I'm
using is MySQL version 3.23 (completely out of my control), so I cannot use
IN BOOLEAN MODE to simplify the process on my end. I've been able to put
together a function that does almost everything that I want, but I'm running
into a problem - searching for whole words that may or may not be in the
beginning or end of the database field. For example, syntax like this:

...WHERE `field` LIKE '%searchterm%'...

has the limitation that if the search term is 'car', it will also bring back
'scar', 'cartoon', etc.

While if the syntax is:

...WHERE `field` LIKE '% searchterm %'... (with spaces)

it misses words that are the first or last words of the field, or words that
are at the end of sentences, before commas, etc.

I've looked around and haven't been able to find a way to search only for
complete words within a block of text. Any help?

Thanks in advance,
Zeth


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



[PHP-DB] Search for whole words in MySQL 3.23

2007-06-13 Thread Zeth Lietzau

Hi all,

I'm setting up a database search on a site, where I will essentially be
BOOLEAN searching about 6 database fields. Unfortunately, the database I'm
using is MySQL version 3.23 (completely out of my control), so I cannot use
IN BOOLEAN MODE to simplify the process on my end. I've been able to put
together a function that does almost everything that I want, but I'm running
into a problem - searching for whole words that may or may not be in the
beginning or end of the database field. For example, syntax like this:

...WHERE `field` LIKE '%searchterm%'...

has the limitation that if the search term is 'car', it will also bring back
'scar', 'cartoon', etc.

While if the syntax is:

...WHERE `field` LIKE '% searchterm %'... (with spaces)

it misses words that are the first or last words of the field, or words that
are at the end of sentences, before commas, etc.

I've looked around and haven't been able to find a way to search only for
complete words within a block of text. Any help?

Thanks in advance,
Zeth


Re: [PHP-DB] Search

2007-03-12 Thread Micah Stevens
There's so many correct answers to your question that I don't really 
want to broach the subject. There's enough to that question that could 
fill several volumes.


Take a look at the FULLTEXT search functionality of MySQL just for a 
taste of what goes into such things. This is likely not your answer, but 
the description of the functionality can introduce you to some of the 
concepts.


-Micah

On 03/12/2007 08:45 PM, MIGUEL ANTONIO GUIRAO AGUILERA wrote:

Hi my friends,

I have a web site where visitor should be able to look for specific documents: 
articles, sermons, etc I want to provide the capability to search by keywords, 
but I have never worked with this kind of search.

Any ideas of what I should store in my tables?
How to create my query?? Should I have a keywords field in he table??

Best Regards,


MIGUEL GUIRAO AGUILERA
Logistica R8 - Telcel
Tel: (999) 960.7994


Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.

  


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



[PHP-DB] Search

2007-03-12 Thread MIGUEL ANTONIO GUIRAO AGUILERA


Hi my friends,

I have a web site where visitor should be able to look for specific documents: 
articles, sermons, etc I want to provide the capability to search by keywords, 
but I have never worked with this kind of search.

Any ideas of what I should store in my tables?
How to create my query?? Should I have a keywords field in he table??

Best Regards,


MIGUEL GUIRAO AGUILERA
Logistica R8 - Telcel
Tel: (999) 960.7994


Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.

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

Re: [PHP-DB] Search witin text.

2007-02-11 Thread Christopher Blöcker

you can use  explode

from php.net:
>> array *explode* ( string $delimiter, string $string [, int $limit] )
Returns an array of strings, each of which is a substring of /string/ 
formed by splitting it on boundaries formed by the string /delimiter/. 
If /limit/ is set, the returned array will contain a maximum of /limit/ 
elements with the last element containing the rest of /string/. <<


as delimiter you would use a space character in this case. for example:

the user input is   $input = "Chris Carter";
now you can  $split = explode(" ", $input);
so $split would be an array that contains  ["Chris", "Carter"]

now you can persorm your search using $split[0] and/or $split[1]

;) I hope that's what you're looking for

Chris Carter wrote:

Thanks much ... this has been achieved now. However, there is another issue.
Say for example, the user wants to search 'Chriscarter' but puts into the
search field 'Chris Carter' how is it that I can take only the 'Chris' out
of the search string and present the matching searches from the database?

Any clue or link would be of great assistance.

Thanks again.


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



Re: [PHP-DB] Search witin text.

2007-02-10 Thread Chris Carter

Thanks much ... this has been achieved now. However, there is another issue.
Say for example, the user wants to search 'Chriscarter' but puts into the
search field 'Chris Carter' how is it that I can take only the 'Chris' out
of the search string and present the matching searches from the database?

Any clue or link would be of great assistance.

Thanks again.


Micah Stevens wrote:
> 
> Send your query out on the list. That would give us something to work 
> on. This should be very easy..
> 
> select * from tablename where column like '%$search%'
> 
> or something of that nature. What are you doing?
> 
> -Micah
> 
> On 02/10/2007 08:49 PM, Chris Carter wrote:
>> Hi,
>>
>> I have to send results to the users based on their search. Have got a
>> combined serach option in which data is searched from two different
>> fields
>> and based on the match the result is sent or an error message (quite
>> simple). Now I need to change this, the one column of data is from a
>> VARCHAR
>> field and have to seach for a perticular text from another column that is
>> TEXT. So there could be data like "Apparel | Footwear | Toys | Watches".
>> If
>> the data matches the "Toys" the result is sent. The issue I have is quite
>> simple, its not working. Is there anything special that needs to be done
>> with the TEXT column?
>>
>> Please advice, many thanks.
>>
>> Chris
>>   
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Search-witin-text.-tf3207710.html#a8908170
Sent from the Php - Database mailing list archive at Nabble.com.

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



Re: [PHP-DB] Search witin text.

2007-02-10 Thread Micah Stevens
Send your query out on the list. That would give us something to work 
on. This should be very easy..


select * from tablename where column like '%$search%'

or something of that nature. What are you doing?

-Micah

On 02/10/2007 08:49 PM, Chris Carter wrote:

Hi,

I have to send results to the users based on their search. Have got a
combined serach option in which data is searched from two different fields
and based on the match the result is sent or an error message (quite
simple). Now I need to change this, the one column of data is from a VARCHAR
field and have to seach for a perticular text from another column that is
TEXT. So there could be data like "Apparel | Footwear | Toys | Watches". If
the data matches the "Toys" the result is sent. The issue I have is quite
simple, its not working. Is there anything special that needs to be done
with the TEXT column?

Please advice, many thanks.

Chris
  


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



[PHP-DB] Search witin text.

2007-02-10 Thread Chris Carter

Hi,

I have to send results to the users based on their search. Have got a
combined serach option in which data is searched from two different fields
and based on the match the result is sent or an error message (quite
simple). Now I need to change this, the one column of data is from a VARCHAR
field and have to seach for a perticular text from another column that is
TEXT. So there could be data like "Apparel | Footwear | Toys | Watches". If
the data matches the "Toys" the result is sent. The issue I have is quite
simple, its not working. Is there anything special that needs to be done
with the TEXT column?

Please advice, many thanks.

Chris
-- 
View this message in context: 
http://www.nabble.com/Search-witin-text.-tf3207710.html#a8907729
Sent from the Php - Database mailing list archive at Nabble.com.

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



Re: [PHP-DB] search result error message

2006-12-21 Thread Niel Archer
Hi,

there's no 'logic' error at all that I can see.  It's more a design
error as it doesn't do the job the way that you describe it at all. 
  What actually happens is that the starting HTML (heading and table
start)  is output before the database is even contacted, so there's no
way for you to take the table back if you don't receive any relevant
hits.

try something more like this:


Your favorites search resultYou are here:  index.htm Home  >
Your favorites

Sub-category search result 



Shop name



$shopname
";
$i++;
}

?> index.htm < Back to search  


} else {

echo "

  The search criteria you entered did not generate any
result,  index.htm please try again .
";

}

You'll probably need to polish this some, because I quickly cut/pasted
it before I go down the pub.

Niel

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



Re: [PHP-DB] search result error message

2006-12-21 Thread tg-php
Sorry, don't have time to test and noodle through why yours may or may not be 
working, but I see some differences in how you're doing it and how we tend to 
do it here.

After doing the connection and database selection, this is how we handle stuff 
(simplified):

$query = "select * from sometable";

$result = mysql_query($query);

$count = mysql_affected_rows();

while ($row = mysql_fetch_assoc($result)) {
  // do some stuff
  $address = $row['address'];  // example of how to get/use data returned
}

Nothing inside the while construct should execute if you get zero results.

You really don't need to use the mysql_affected_rows() either unless you want 
to test for zero results and display an error message, like I believe you 
wanted to do.

-TG

= = = Original message = = =

Hi,

The below mentioned code works fine. Connects to the database, fetches the
result, and displays neatly in a table. If there is no data then it jumps to
the if condition and displays the error message. BUT if the 'if' condition
is running and no data is present the Table headings and the bottm of empty
table is still displayed above the error message. Can you please check and
share with me as in where exactly the logic is wrong.

-- -- Code --- 

Your favorites search resultYou are here:  index.htm Home  >
Your favorites~~

~~~Sub-category search result~~
~
~
Shop name



$shopname
";
$i++;


?> index.htm < Back to search  



  The search criteria you entered did not generate any
result,  index.htm please try again .
~";

?>
~
.
-- 
View this message in context: 
http://www.nabble.com/search-result-error-message-tf2867391.html#a8014018
Sent from the Php - Database mailing list archive at Nabble.com.



___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



[PHP-DB] search result error message

2006-12-21 Thread Chris Carter

Hi,

The below mentioned code works fine. Connects to the database, fetches the
result, and displays neatly in a table. If there is no data then it jumps to
the if condition and displays the error message. BUT if the 'if' condition
is running and no data is present the Table headings and the bottm of empty
table is still displayed above the error message. Can you please check and
share with me as in where exactly the logic is wrong.

-- -- Code --- 

Your favorites search resultYou are here:  index.htm Home  >
Your favorites

Sub-category search result 



Shop name



$shopname
";
$i++;
}

?> index.htm < Back to search  



  The search criteria you entered did not generate any
result,  index.htm please try again .
";

}?>

.
-- 
View this message in context: 
http://www.nabble.com/search-result-error-message-tf2867391.html#a8014018
Sent from the Php - Database mailing list archive at Nabble.com.

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



Re: Re: Fwd: Re: [PHP-DB] search error

2006-11-24 Thread chris smith

--
$query1 = "SELECT distinct link_id, url, title, description,  $fulltxt, size
FROM ".$mysql_table_prefix."links WHERE link_id in ($inlist)";
  $result = mysql_query($query1);
  echo mysql_error();


and what does $fulltxt contain when you get the error?

I suspect you have a problem with the quotes in that string.

--
Postgresql & php tutorials
http://www.designmagick.com/

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



Fwd: Re: Fwd: Re: [PHP-DB] search error

2006-11-22 Thread Asif Qureshi


Note: forwarded message attached.
 
-
Sponsored Link

Mortgage rates near 39yr lows. $420,000 Mortgage for $1,399/mo - Calculate new 
house payment--- Begin Message ---
I have this code already, have a look at this few lines of code, which is 
already existing.
  --  
  $query1 = "SELECT distinct link_id, url, title, description,  $fulltxt, size 
FROM ".$mysql_table_prefix."links WHERE link_id in ($inlist)";
  $result = mysql_query($query1);
  echo mysql_error();
  -
  I have experience of past I would get number of responses, and php database 
mailing list had many members world wide, only single response, why?
  --
  In previous code, posted, can you have a look in case tables have been joined 
properly to respond to query and give proper search results.
  

Chris <[EMAIL PROTECTED]> wrote:
  Asif Qureshi wrote:
> Here I narrow down the problem.

I meant narrow down the problem in your code.

Add

echo "mysql error? " . mysql_error() . "
";

after your mysql_query calls for example.

-- 
Postgresql & php tutorials
http://www.designmagick.com/


 
-
Everyone is raving about the all-new Yahoo! Mail beta.--- End Message ---
-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Fwd: Re: [PHP-DB] search error

2006-11-22 Thread Chris

Asif Qureshi wrote:

Here I narrow down the problem.


I meant narrow down the problem in your code.

Add

echo "mysql error? " . mysql_error() . "";

after your mysql_query calls for example.

--
Postgresql & php tutorials
http://www.designmagick.com/

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



Fwd: Re: [PHP-DB] search error

2006-11-22 Thread Asif Qureshi
Here I narrow down the problem.
  www.multipurposechain.com
   
  I enter for example search word,
  world, Its giving error.
   
  However previously, was giving proper output and search results from tables 
in database. 

 __
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com --- Begin Message ---

Asif Qureshi wrote:

Got error 28 from table handler
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result 
resource in /home2/wwwabcde/public_html/multipurposechain/searchfuncs.php on 
line 294
Got error 28 from table handlerDisplaying results 1-10 of 4541 matches (12.77 seconds) 


We're not going to go through all of your code. Narrow down the problem 
and we'll be able to help.


--
Postgresql & php tutorials
http://www.designmagick.com/

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

Re: [PHP-DB] search error

2006-11-22 Thread Chris

Asif Qureshi wrote:

Got error 28 from table handler
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result 
resource in /home2/wwwabcde/public_html/multipurposechain/searchfuncs.php on 
line 294
Got error 28 from table handlerDisplaying results 1-10 of 4541 matches (12.77 seconds) 


We're not going to go through all of your code. Narrow down the problem 
and we'll be able to help.


--
Postgresql & php tutorials
http://www.designmagick.com/

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



[PHP-DB] search error

2006-11-22 Thread Asif Qureshi
Got error 28 from table handler
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result 
resource in /home2/wwwabcde/public_html/multipurposechain/searchfuncs.php on 
line 294
Got error 28 from table handlerDisplaying results 1-10 of 4541 matches (12.77 
seconds) 
  Result page: 1 2 3 4 5 6 7 8 9 10 Next
   
  

   
 $b['weight']) ? -1 : 1;
 }
   function addmarks($a) {
  $a = eregi_replace("[ ]+", " ", $a);
  $a = str_replace(" +", "+", $a);
  $a = str_replace(" ", "+", $a);
  return $a;
 }
   function makeboollist($a) {
  global $entities;
  while ($char = each($entities)) {
   $a = eregi_replace($char[0], $char[1], $a);
  }
  $a = trim($a);
  $a = eregi_replace(""", "\"", $a);
  $returnWords = array();
  //get all phrases
  $regs = Array();
  while (eregi("([-]?)\"([^\"]+)\"", $a, $regs)) {
   if ($regs[1] == '') {
$returnWords['+s'][] = $regs[2];
$returnWords['hilight'][] = $regs[2];
   } else {
$returnWords['-s'][] = $regs[2];
   }
   $a = str_replace($regs[0], "", $a);
  }
  $a = strtolower(eregi_replace("[ ]+", " ", $a));
//  $a = remove_accents($a);
  $a = trim($a);
  $words = explode(' ', $a);
  if ($a=="") {
   $limit = 0;
  } else {
  $limit = count($words);
  }
  
  $k = 0;
  //get all words (both include and exlude)
  $includeWords = array();
  while ($k < $limit) {
   if (substr($words[$k], 0, 1) == '+') {
$includeWords[] = substr($words[$k], 1);
   } else if (substr($words[$k], 0, 1) == '-') {
$returnWords['-'][] = substr($words[$k], 1);
   } else {
$includeWords[] = $words[$k];
$returnWords['hilight'][] =  $words[$k];
   }
   $k++;
  }
  //add words from phrases to includes
  if (isset($returnWords['+s'])) {
   foreach ($returnWords['+s'] as $phrase) {
$phrase = strtolower(eregi_replace("[ ]+", " ", $phrase));
$phrase = trim($phrase);
$temparr = explode(' ', $phrase);
foreach ($temparr as $w)
 $includeWords[] = $w;
   }
  }
foreach ($includeWords as $word) {
   if (!($word =='')) {
if (ignoreWord($word)) {
   $returnWords['ignore'][] = $word;
} else {
 $returnWords['+'][] = $word;
} 
   }
}
return $returnWords;
 }
   function ignoreword($word) {
  global $common;
  global $min_word_length;
  global $index_numbers;
  if ($index_numbers == 1) {
   $pattern = "[a-z0-9]+";
  } else {
   $pattern = "[a-z]+";
  }
  if (strlen($word) < $min_word_length || (!eregi($pattern, 
remove_accents($word))) || ($common[$word] == 1)) {
   return 1;
  } else {
   return 0;
  }
 }
   function search($searchstr, $category, $start, $per_page, $type) {
  global $length_of_link_desc,$mysql_table_prefix, $show_meta_description;
//find all sites that should not be included in the result
  if (count($searchstr['+']) == 0) {
   return null;
  }
  $wordarray = $searchstr['-'];
  $notlist = array();
  $not_words = 0;
  while ($not_words < count($wordarray)) {
   $searchword = addslashes($wordarray[$not_words]);
 $query1 = "SELECT link_id from ".$mysql_table_prefix."link_keyword, 
".$mysql_table_prefix."keywords where 
".$mysql_table_prefix."link_keyword.keyword_id= 
".$mysql_table_prefix."keywords.keyword_id and keyword='$searchword'";
   echo mysql_error();
   $result = mysql_query($query1);
 while ($row = mysql_fetch_row($result)) { 
$notlist[$not_words]['id'][$row[0]] = 1;
   }
   $not_words++;
  }
  
//find all sites containing the search phrase
  $wordarray = $searchstr['+s'];
  $phrase_words = 0;
  while ($phrase_words < count($wordarray)) {
   $searchword = addslashes($wordarray[$phrase_words]);
   $query1 = "SELECT link_id from ".$mysql_table_prefix."links where fulltxt 
like '% $searchword%'";
   echo mysql_error();
   $result = mysql_query($query1);
   $num_rows = mysql_num_rows($result);
   if ($num_rows == 0) {
return null;
   }
   while ($row = mysql_fetch_row($result)) { 
$phraselist[$phrase_words]['id'][$row[0]] = 1;
   }
   $phrase_words++;
  }
  
if ($category> 0) {
   $allcats = get_cats($category);
   $catlist = implode(",", $allcats);
   $query1 = "select link_id from ".$mysql_table_prefix."links, 
".$mysql_table_prefix."sites, ".$mysql_table_prefix."categories, 
".$mysql_table_prefix."site_category where ".$mysql_table_prefix."links.site_id 
= ".$mysql_table_prefix."sites.site_id and ".$mysql_table_prefix."sites.site_id 
= ".$mysql_table_prefix."site_category.site_id and 
".$mysql_table_prefix."site_category.category_id in ($catlist)";
   $result = mysql_query($query1);
   echo mysql_error();
   $num_rows = mysql_num_rows($result);
   if ($num_rows == 0) {
return null;
   }
   while ($row = mysql_fetch_row($result)) { 
$category_list[$row[0]] = 1;
   }
  }
//find all sites that include the search word 
  $wordarray = $searchstr['+'];
  $words = 0;
  $starttime = getmicrotime();
  while ($words < count($wordarray)) {
   $searchword = addslashes($wordarray[$words]);
   $query1 = "SEL

[PHP-DB] search error

2006-11-22 Thread Asif Qureshi
search error and code has been posted
  --
  Got error 28 from table handler
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result 
resource in /home2/wwwabcde/public_html/multipurposechain/searchfuncs.php on 
line 294
Got error 28 from table handlerDisplaying results 1-10 of 4541 matches (12.77 
seconds) 
  Result page: 1 2 3 4 5 6 7 8 9 10 Next
   
  

   
 $b['weight']) ? -1 : 1;
 }
   function addmarks($a) {
  $a = eregi_replace("[ ]+", " ", $a);
  $a = str_replace(" +", "+", $a);
  $a = str_replace(" ", "+", $a);
  return $a;
 }
   function makeboollist($a) {
  global $entities;
  while ($char = each($entities)) {
   $a = eregi_replace($char[0], $char[1], $a);
  }
  $a = trim($a);
  $a = eregi_replace(""", "\"", $a);
  $returnWords = array();
  //get all phrases
  $regs = Array();
  while (eregi("([-]?)\"([^\"]+)\"", $a, $regs)) {
   if ($regs[1] == '') {
$returnWords['+s'][] = $regs[2];
$returnWords['hilight'][] = $regs[2];
   } else {
$returnWords['-s'][] = $regs[2];
   }
   $a = str_replace($regs[0], "", $a);
  }
  $a = strtolower(eregi_replace("[ ]+", " ", $a));
//  $a = remove_accents($a);
  $a = trim($a);
  $words = explode(' ', $a);
  if ($a=="") {
   $limit = 0;
  } else {
  $limit = count($words);
  }
  
  $k = 0;
  //get all words (both include and exlude)
  $includeWords = array();
  while ($k < $limit) {
   if (substr($words[$k], 0, 1) == '+') {
$includeWords[] = substr($words[$k], 1);
   } else if (substr($words[$k], 0, 1) == '-') {
$returnWords['-'][] = substr($words[$k], 1);
   } else {
$includeWords[] = $words[$k];
$returnWords['hilight'][] =  $words[$k];
   }
   $k++;
  }
  //add words from phrases to includes
  if (isset($returnWords['+s'])) {
   foreach ($returnWords['+s'] as $phrase) {
$phrase = strtolower(eregi_replace("[ ]+", " ", $phrase));
$phrase = trim($phrase);
$temparr = explode(' ', $phrase);
foreach ($temparr as $w)
 $includeWords[] = $w;
   }
  }
foreach ($includeWords as $word) {
   if (!($word =='')) {
if (ignoreWord($word)) {
   $returnWords['ignore'][] = $word;
} else {
 $returnWords['+'][] = $word;
} 
   }
}
return $returnWords;
 }
   function ignoreword($word) {
  global $common;
  global $min_word_length;
  global $index_numbers;
  if ($index_numbers == 1) {
   $pattern = "[a-z0-9]+";
  } else {
   $pattern = "[a-z]+";
  }
  if (strlen($word) < $min_word_length || (!eregi($pattern, 
remove_accents($word))) || ($common[$word] == 1)) {
   return 1;
  } else {
   return 0;
  }
 }
   function search($searchstr, $category, $start, $per_page, $type) {
  global $length_of_link_desc,$mysql_table_prefix, $show_meta_description;
//find all sites that should not be included in the result
  if (count($searchstr['+']) == 0) {
   return null;
  }
  $wordarray = $searchstr['-'];
  $notlist = array();
  $not_words = 0;
  while ($not_words < count($wordarray)) {
   $searchword = addslashes($wordarray[$not_words]);
 $query1 = "SELECT link_id from ".$mysql_table_prefix."link_keyword, 
".$mysql_table_prefix."keywords where 
".$mysql_table_prefix."link_keyword.keyword_id= 
".$mysql_table_prefix."keywords.keyword_id and keyword='$searchword'";
   echo mysql_error();
   $result = mysql_query($query1);
 while ($row = mysql_fetch_row($result)) { 
$notlist[$not_words]['id'][$row[0]] = 1;
   }
   $not_words++;
  }
  
//find all sites containing the search phrase
  $wordarray = $searchstr['+s'];
  $phrase_words = 0;
  while ($phrase_words < count($wordarray)) {
   $searchword = addslashes($wordarray[$phrase_words]);
   $query1 = "SELECT link_id from ".$mysql_table_prefix."links where fulltxt 
like '% $searchword%'";
   echo mysql_error();
   $result = mysql_query($query1);
   $num_rows = mysql_num_rows($result);
   if ($num_rows == 0) {
return null;
   }
   while ($row = mysql_fetch_row($result)) { 
$phraselist[$phrase_words]['id'][$row[0]] = 1;
   }
   $phrase_words++;
  }
  
if ($category> 0) {
   $allcats = get_cats($category);
   $catlist = implode(",", $allcats);
   $query1 = "select link_id from ".$mysql_table_prefix."links, 
".$mysql_table_prefix."sites, ".$mysql_table_prefix."categories, 
".$mysql_table_prefix."site_category where ".$mysql_table_prefix."links.site_id 
= ".$mysql_table_prefix."sites.site_id and ".$mysql_table_prefix."sites.site_id 
= ".$mysql_table_prefix."site_category.site_id and 
".$mysql_table_prefix."site_category.category_id in ($catlist)";
   $result = mysql_query($query1);
   echo mysql_error();
   $num_rows = mysql_num_rows($result);
   if ($num_rows == 0) {
return null;
   }
   while ($row = mysql_fetch_row($result)) { 
$category_list[$row[0]] = 1;
   }
  }
//find all sites that include the search word 
  $wordarray = $searchstr['+'];
  $words = 0;
  $starttime = getmicrotime();
  while ($words < count($wordarray))

Re: [PHP-DB] Search engine

2006-09-29 Thread Niel Archer
Hi Ron

This doesn't sound like a Db problem then.

You could open each page and use a regex to search for the links. 
Something like:

   preg_match_all("/(.*)<\a>/", $page, $matches, 
PREG_PATTERN_ORDER);

which would produce an array ($matches[1]) of the addresses and a array
($matches[2]) of corresponding link text, but only for a basic link, without
additional attributes

Niel

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



Re: [PHP-DB] Search engine

2006-09-29 Thread Rezvan
It's not that complicated, after crawling your website at a specific 
time you can check for content created in your database after that time.
Then you can search specific fields from that content for words and 
index them. If you need to find  tags you'ld best use regular 
expressions to search through the text and then follow those links.


You can keep an index of links crawled and date they were crawled to 
ensure you don't crawl pages that haven't changed.


I wrote a crawling engine for bittorrent site so if you need some sample 
code let me know.



Ron Piggott (PHP) wrote:

What I haven't figured out is how to crawl my site.  If I knew how to
crawl my site I could write a basic search engine and develop it over
time.  This is the crucial issue I need help with.  


I have a really basic search engine I wrote last year.  I told my web
site what pages the user could search ... as in I keyed in the URL's 


I am giving my site a face lift and making some serious changes to
it ... I have my database out of date ... I would like to crawl my site
once a day to update what changes I made during the past 24 hours and
delete HTML files which no longer exist.  


If someone knew how to retrieve various  then I could start
with something and build on it over time ... 


Ron


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



Re: [PHP-DB] Search engine

2006-09-28 Thread Jeffrey
Truth be told, Google's free slap-it-on-your-web site search tool 
(http://www.google.com/services/websearch.html) will do everything you 
want and save you a lot of coding. Assuming this is for 
actsministries.org which seems to be a useful resource of information; 
it is probably well indexed by Google and updates will be reflected 
reasonably quickly. On my most popular site, which is sort of a 
resource, Google is usually 24-48 hours behind changes.


Doing your own search coding is best when you want to allow users to 
search data in a database (rather than on web pages).


Good luck,

Jeffrey

Ron Piggott (PHP) wrote:

What I haven't figured out is how to crawl my site.  If I knew how to
crawl my site I could write a basic search engine and develop it over
time.  This is the crucial issue I need help with.  


I have a really basic search engine I wrote last year.  I told my web
site what pages the user could search ... as in I keyed in the URL's 


I am giving my site a face lift and making some serious changes to
it ... I have my database out of date ... I would like to crawl my site
once a day to update what changes I made during the past 24 hours and
delete HTML files which no longer exist.  


If someone knew how to retrieve various  then I could start
with something and build on it over time ... 


Ron

On Thu, 2006-09-28 at 11:44 +0100, Shaun A Riches wrote:



What about the MySQL "LIKE" command? Research it.

This is assuming your data is stored properly without redundant data
and in a MySQL database.

___
Shaun Riches
Computer Science Student



-Original Message-
From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED]
Sent: Thu 28/09/2006 03:44
To: PHP DB
Subject: [PHP-DB] Search engine



___
Shaun Riches
Computer Science Student



-Original Message-
From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED]
Sent: Thu 28/09/2006 03:44
To: PHP DB
Subject: [PHP-DB] Search engine

Has anyone wrote a search engine for the web site?  I am wondering if
someone has the time to help me walk through doing this.  Ron









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



RE: [PHP-DB] Search engine

2006-09-28 Thread Ron Piggott (PHP)

What I haven't figured out is how to crawl my site.  If I knew how to
crawl my site I could write a basic search engine and develop it over
time.  This is the crucial issue I need help with.  

I have a really basic search engine I wrote last year.  I told my web
site what pages the user could search ... as in I keyed in the URL's 

I am giving my site a face lift and making some serious changes to
it ... I have my database out of date ... I would like to crawl my site
once a day to update what changes I made during the past 24 hours and
delete HTML files which no longer exist.  

If someone knew how to retrieve various  then I could start
with something and build on it over time ... 

Ron

On Thu, 2006-09-28 at 11:44 +0100, Shaun A Riches wrote:

> What about the MySQL "LIKE" command? Research it.
> 
> This is assuming your data is stored properly without redundant data
> and in a MySQL database.
> 
> ___
> Shaun Riches
> Computer Science Student
> 
> 
> 
> -Original Message-
> From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED]
> Sent: Thu 28/09/2006 03:44
> To: PHP DB
> Subject: [PHP-DB] Search engine
> 
> 
> 
> ___
> Shaun Riches
> Computer Science Student
> 
> 
> 
> -Original Message-
> From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED]
> Sent: Thu 28/09/2006 03:44
> To: PHP DB
> Subject: [PHP-DB] Search engine
> 
> Has anyone wrote a search engine for the web site?  I am wondering if
> someone has the time to help me walk through doing this.  Ron
> 
> 
> 
> 


Re: [PHP-DB] Search engine

2006-09-28 Thread Niel Archer
Hi

> What about the MySQL "LIKE" command? Research it.

An excellent start for searching a db, but did you miss the point of the
question.  He wanted to know if anyone had experience with this to save
him building from the ground up.

I haven't, l so didn't reply

If no other help is forthcoming, you might start by looking at the
Service_Google package on PEAR. At the very least, it should allow you
to have Google search your pages for you.

Niel

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



RE: [PHP-DB] Search engine

2006-09-28 Thread Shaun A Riches
Title: RE: [PHP-DB] Search engine






What about the MySQL "LIKE" command? Research it.

This is assuming your data is stored properly without redundant data and in a MySQL database.

___
Shaun Riches
Computer Science Student



-Original Message-
From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED]]
Sent: Thu 28/09/2006 03:44
To: PHP DB
Subject: [PHP-DB] Search engine



___
Shaun Riches
Computer Science Student



-Original Message-
From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED]]
Sent: Thu 28/09/2006 03:44
To: PHP DB
Subject: [PHP-DB] Search engine

Has anyone wrote a search engine for the web site?  I am wondering if
someone has the time to help me walk through doing this.  Ron






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

[PHP-DB] Search engine

2006-09-27 Thread Ron Piggott (PHP)
Has anyone wrote a search engine for the web site?  I am wondering if
someone has the time to help me walk through doing this.  Ron


Re: [PHP-DB] Search / Replace using PHP

2006-03-30 Thread Arie Nugraha
Try this link for PERL regex reference :
http://www.perl.com/doc/manual/html/pod/perlre.html

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



[PHP-DB] Search / Replace using PHP

2006-03-30 Thread Ron Piggott (PHP)
Is there a command in PHP that is equal to the search & replace function
in a word processor?

If I want to search for 'this' and replace it with 'that' what would the
syntax be?

Ron

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



Re: [PHP-DB] Search & Replace within PHP

2005-10-06 Thread Alain Rivest

Ron Piggott a écrit :


Is there a search & replace PHP command?

An example I am needing this for would be:

My name is replace_with_real_name

I want to retrieve replace_with_real_name from a mySQL database and put in
the name ... the key is that I want to put the person's name in various
position ... so I want to search for something like "replace_with_real_name"
and be able to put it anywhere in the sentence.


 


My name is $username
That's called a variable! You should learn the basis before asking such 
an obvious question!



--

Alain -- http://www.vivahate.org

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



Re: [PHP-DB] Search & Replace within PHP

2005-10-06 Thread F.B
it is interesting...

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



RE: [PHP-DB] Search & Replace within PHP

2005-10-06 Thread Norland, Martin
 
I think he's looking for str_replace() / preg_replace() or sprintf() or
similar

http://www.php.net/str_replace
http://www.php.net/preg_replace
http://www.php.net/sprintf

cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 06, 2005 12:14 PM
To: [EMAIL PROTECTED]; php-db@lists.php.net
Subject: RE: [PHP-DB] Search & Replace within PHP. .

No sure i this is what you want but...

echo "Hi, my name is " . $rows['name'];

bastien


>From: "Ron Piggott" <[EMAIL PROTECTED]>
>Reply-To: "Ron Piggott" <[EMAIL PROTECTED]>
>To: "PHP DB" 
>Subject: [PHP-DB] Search & Replace within PHP
>Date: Thu, 6 Oct 2005 10:40:45 -0500
>
>Is there a search & replace PHP command?
>
>An example I am needing this for would be:
>
>My name is replace_with_real_name
>
>I want to retrieve replace_with_real_name from a mySQL database and put
in
>the name ... the key is that I want to put the person's name in various
>position ... so I want to search for something like 
>"replace_with_real_name"
>and be able to put it anywhere in the sentence.
>
>Ron
>
>--
>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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Search & Replace within PHP

2005-10-06 Thread Bastien Koert

No sure i this is what you want but...

echo "Hi, my name is " . $rows['name'];

bastien



From: "Ron Piggott" <[EMAIL PROTECTED]>
Reply-To: "Ron Piggott" <[EMAIL PROTECTED]>
To: "PHP DB" 
Subject: [PHP-DB] Search & Replace within PHP
Date: Thu, 6 Oct 2005 10:40:45 -0500

Is there a search & replace PHP command?

An example I am needing this for would be:

My name is replace_with_real_name

I want to retrieve replace_with_real_name from a mySQL database and put in
the name ... the key is that I want to put the person's name in various
position ... so I want to search for something like 
"replace_with_real_name"

and be able to put it anywhere in the sentence.

Ron

--
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] Search & Replace within PHP

2005-10-06 Thread Ron Piggott
Is there a search & replace PHP command?

An example I am needing this for would be:

My name is replace_with_real_name

I want to retrieve replace_with_real_name from a mySQL database and put in
the name ... the key is that I want to put the person's name in various
position ... so I want to search for something like "replace_with_real_name"
and be able to put it anywhere in the sentence.

Ron

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



[PHP-DB] Search engine results

2005-08-13 Thread Ron Piggott
I have wrote a basic search engine PHP script.  I have created a mySQL
database of the files which are allowed to be searched (Example:
directory/file_name.html) When someone enters search criteria the mySQL
database is opened and the various web site files are loaded one at a time,
dumped into a variable and then using the eregi command check to see if
there is a match.  If there is it displays the web page title.

I wanted to add some text from the file now.  I wanted to add like 150
characters before the search string and about 250 characters after the
search string.  Is anyone able to help me with this?  I wanted to strip out
HTML so only plain text is shown.  I essentially want to add a block of text
like this paragraph under the web page title results which are currently
displayed.

Ron

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



[PHP-DB] [SOLVED]Re: [PHP-DB] Search results page not working with table joins

2004-10-25 Thread Stuart Felenstein

--- Stuart Felenstein <[EMAIL PROTECTED]> wrote:

> I have a search page and a results page.  It's a
> dynamic search.  It works great with just the main
> table, but as soon as I add in the table joins (to
> translate the codes) it just dumps out all the
> records
> regardless of criteria.
> 
> Here is the script without the joins:
> 
>  $currentPage = $_SERVER["PHP_SELF"];
> 
> if (isset($HTTP_GET_VARS['AdvSearch']) == false ||
> $HTTP_GET_VARS['AdvSearch']=="")
>   exit();
> $hasSQLWhereClause=false;
> $whereClause="";
> $MM_whereConst=" ";
> $fieldValue = $HTTP_GET_VARS['PostStart'];
> if(isset($HTTP_GET_VARS['PostStart']) &&
> $HTTP_GET_VARS['PostStart'] != "")
> {
>   if($hasSQLWhereClause == false)
>   {
> $hasSQLWhereClause=true;
> $whereClause=$whereClause."
> rtrim(ltrim(upper(PostStart))) =
> rtrim(ltrim(upper($fieldValue)))";
>   }
>   else
>   {
> $whereClause=$whereClause." and
> rtrim(ltrim(upper(PostStart))) =
> rtrim(ltrim(upper($fieldValue)))";
>   }
> }
> $fieldValue = $HTTP_GET_VARS['JobTitle'];
> if(isset($HTTP_GET_VARS['JobTitle']) &&
> $HTTP_GET_VARS['JobTitle']!= "")
> {
>   if($hasSQLWhereClause == false)
>   {
> $hasSQLWhereClause=true;
> $whereClause=$whereClause."
> rtrim(ltrim(upper(JobTitle))) like
> rtrim(ltrim(upper('%$fieldValue%')))";
>   }
>   else
>   {
> $whereClause=$whereClause." and
> rtrim(ltrim(upper(JobTitle))) like
> rtrim(ltrim(upper('%$fieldValue%')))";
>   }
> }
> if(isset($HTTP_GET_VARS['Industry2']))
> {
>   $colValue = $HTTP_GET_VARS['Industry2'];
>   $orCtr = 1;
>   if ($hasSQLWhereClause == false)
>   {
> $hasSQLWhereClause=true;
> $whereClause=$whereClause."(";
> foreach($colValue as $fieldValue) 
> {
>  
>
$whereClause=$whereClause."rtrim(ltrim(upper(Industry)))
> = rtrim(ltrim(upper('$fieldValue')))";
>   if($orCtr < count($colValue))
>   {
>   $whereClause=$whereClause." or ";
>   }
>   $orCtr++;
> }
> $whereClause=$whereClause.")";
>   }
>   else
>   {
> $whereClause=$whereClause." and (";
> foreach($colValue as $fieldValue)
> {
>  
>
$whereClause=$whereClause."rtrim(ltrim(upper(Industry)))
> = rtrim(ltrim(upper('$fieldValue')))";
>   if($orCtr < count($colValue))
>   {
>   $whereClause=$whereClause." or ";
>   }
>   $orCtr++;
> }
> $whereClause=$whereClause.")";
>   }
> }
> $fieldValue = $HTTP_GET_VARS['LocationCity'];
> if(isset($HTTP_GET_VARS['LocationCity']) &&
> $HTTP_GET_VARS['LocationCity']!= "")
> {
>   if($hasSQLWhereClause == false)
>   {
> $hasSQLWhereClause=true;
> $whereClause=$whereClause."
> rtrim(ltrim(upper(LocationCity))) like
> rtrim(ltrim(upper('%$fieldValue%')))";
>   }
>   else
>   {
> $whereClause=$whereClause." and
> rtrim(ltrim(upper(LocationCity))) like
> rtrim(ltrim(upper('%$fieldValue%')))";
>   }
> }
> if(isset($HTTP_GET_VARS['LocationState2']))
> {
>   $colValue = $HTTP_GET_VARS['LocationState2'];
>   $orCtr = 1;
>   if ($hasSQLWhereClause == false)
>   {
> $hasSQLWhereClause=true;
> $whereClause=$whereClause."(";
> foreach($colValue as $fieldValue) 
> {
>  
>
$whereClause=$whereClause."rtrim(ltrim(upper(LocationState)))
> = rtrim(ltrim(upper('$fieldValue')))";
>   if($orCtr < count($colValue))
>   {
>   $whereClause=$whereClause." or ";
>   }
>   $orCtr++;
> }
> $whereClause=$whereClause.")";
>   }
>   else
>   {
> $whereClause=$whereClause." and (";
> foreach($colValue as $fieldValue)
> {
>  
>
$whereClause=$whereClause."rtrim(ltrim(upper(LocationState)))
> = rtrim(ltrim(upper('$fieldValue')))";
>   if($orCtr < count($colValue))
>   {
>   $whereClause=$whereClause." or ";
>   }
>   $orCtr++;
> }
> $whereClause=$whereClause.")";
>   }
> }
> if(isset($HTTP_GET_VARS['TaxTerm2']))
> {
>   $colValue = $HTTP_GET_VARS['TaxTerm2'];
>   $orCtr = 1;
>   if ($hasSQLWhereClause == false)
>   {
> $hasSQLWhereClause=true;
> $whereClause=$whereClause."(";
> foreach($colValue as $fieldValue) 
> {
>  
>
$whereClause=$whereClause."rtrim(ltrim(upper(TaxTerm)))
> = rtrim(ltrim(upper('$fieldValue')))";
>   if($orCtr < count($colValue))
>   {
>   $whereClause=$whereClause." or ";
>   }
>   $orCtr++;
> }
> $whereClause=$whereClause.")";
>   }
>   else
>   {
> $whereClause=$whereClause." and (";
> foreach($colValue as $fieldValue)
> {
>  
>
$whereClause=$whereClause."rtrim(ltrim(upper(TaxTerm)))
> = rtrim(ltrim(upper('$fieldValue')))";
>   if($orCtr < count($colValue))
>   {
>   $whereClause=$whereClause." or ";
>   }
>   $orCtr++;
> }
> $whereClause=$whereClause.")";
>   }
> }
> if($whereClause != "")
>   $MM_whereConst="WHERE";
> 
> $maxRows_RecordSet1 = 10;
> $pageNum_RecordSet1 = 0;
> if (isset($HTTP_GET_VARS['pageNum_RecordSet1'])) {
> 

[PHP-DB] Search results page not working with table joins

2004-10-25 Thread Stuart Felenstein
I have a search page and a results page.  It's a
dynamic search.  It works great with just the main
table, but as soon as I add in the table joins (to
translate the codes) it just dumps out all the records
regardless of criteria.

Here is the script without the joins:

http://www.w3.org/TR/html4/loose.dtd";>



Untitled Document




Search returned no results.



  
  
PostStart
  
JobTitle
  
VendorID
  
Industry
  
LocationCity
  
LocationState
  
TaxTerm
  
  
  
   
  
  
  

  
  
  

  
  
  

  
  
  

  
  
  

  
  
  

  
  
  

  
  

 
 





 0) { // Show if not
first page ?> 
">First 
  


 0) { // Show if not
first page ?> 
">Previous 
  



">Next 




">Last 





Records  
to  
of  





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



[PHP-DB] search query

2004-09-15 Thread peppe
Hi
I have a option box with values

Less than 150.000
tot 175.000
tot 200.000
tot 250.000
tot 300.000
tot 350.000
tot 400.000
More than 400.000

I need help when the user chose option value 3 till 200.000 than the query
should search between 175.000 and 200.000 how to achive this
Regards

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



RE: [PHP-DB] Search page

2004-09-08 Thread Gary Every




K, first off I'm brand new to PHP and databases.  So I
hope my question isn't stupid or unfitting to the
list.  

Welcome! Only those that don't ask are unfitting


I am creating a "search and results" page of, right
now 3 fields with more to add. 
Perhaps not necessary to my question, I have created a
working SQL statement which involved one main
transactional table and a number of joins to "static"
tables where the id codes inserted into the main table
are referenced.  All is fine.  
I thought I could use AND / OR statements, but both
don't allow for any number of fields unusued or force
a return if the first condition is met.  I have a
variable in the SQL statment , like LocationCity =
'resset1', LocationState = 'resset2', etc.

Just sure how to get the code to see if it was passed
a value or not.  Also to treat each field
independently, so if the user leaves the first 2
unchanged , and only enters the 3rd it will search for
that particular condition.  

Try this, which is assuming that you are sending variables through POST
// Start the query off right
$query = "Select * FROM table_name WHERE (";

Foreach($_POST as $key->$value) {
if($value != '') {
// Add the query part
$query_frag .= " $key = '$value' AND ";
}
}

// Now you have something that looks like
// $query_frag = " first_var = 'Value1' AND second_var = 'Value2' AND
third_var = 'Value3' AND "

// Get rid of that last AND, plus close out your parentheses
$query_frag_trimmed = rtrim($query_frag,"AND ") . ')';

// Now $query_frag_trimmed = " first_var = 'Value1' AND second_var =
'Value2' AND third_var = 'Value3'"
// If you want to limit your query, tack on a limit clause on the end
$offset = 0;
$rows = 50;
$query_frag_trimmed .= " LIMIT $offset,$rows";

// Now put it all together
$completed_query = $query . $query_frag_trimmed;

// You've got:
// $completed_query = "Select * FROM table_name WHERE ( first_var =
'Value1' AND second_var = 'Value2' AND third_var = 'Value3') LIMIT
0,50";

// And send that to mysql




Also I should mention, that when the Search form comes
up, all the drop down menus say "Please Select", that
label actually has a value, which I assume is common. 
Regardless on "submit" that value is going.   

I was looking at the following code but the !='' tells
me that it's looking for an empty string.  So if my
dead "Please Select" value is sent , do I need to put
the value in there, i.e. !='XXX' ?



Well I hope I don't get flamed since I'm obviously
clueless and seeking some advice when perhaps I should
be finding it on my own. 

Thank you ,
Stuart

-- 
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] Search page

2004-09-05 Thread Stuart Felenstein
K, first off I'm brand new to PHP and databases.  So I
hope my question isn't stupid or unfitting to the
list.  
I am creating a "search and results" page of, right
now 3 fields with more to add. 
Perhaps not necessary to my question, I have created a
working SQL statement which involved one main
transactional table and a number of joins to "static"
tables where the id codes inserted into the main table
are referenced.  All is fine.  
I thought I could use AND / OR statements, but both
don't allow for any number of fields unusued or force
a return if the first condition is met.  I have a
variable in the SQL statment , like LocationCity =
'resset1', LocationState = 'resset2', etc.

Just sure how to get the code to see if it was passed
a value or not.  Also to treat each field
independently, so if the user leaves the first 2
unchanged , and only enters the 3rd it will search for
that particular condition.  

Also I should mention, that when the Search form comes
up, all the drop down menus say "Please Select", that
label actually has a value, which I assume is common. 
Regardless on "submit" that value is going.   

I was looking at the following code but the !='' tells
me that it's looking for an empty string.  So if my
dead "Please Select" value is sent , do I need to put
the value in there, i.e. !='XXX' ?



Well I hope I don't get flamed since I'm obviously
clueless and seeking some advice when perhaps I should
be finding it on my own. 

Thank you ,
Stuart

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



Re: [PHP-DB] search form w/ multiple fields

2004-07-21 Thread Matthew McNicol
since:

does not work on your installation, try:

when the form is submitted.
there is an obvious oversight in the SQL query below. You are currently 
checking whether or not the firstname, lastname, phone or email data 
from the form is present in only the firstname field.

also, an elegant solution would be to build the SQL query based on which 
form fields have been populated.


Vincent Jordan wrote:
I have a form with firstname, lastname, phone, and email fields. I would
like to search the database and return results to the same page in an
iframe. I want to be able to search my just one or multiple. For example
I can search by "firstname" with value of "john" and it will return all
"john" rows in iframe or search "firstname" value "john" and "lastname"
value "smith" and again will return all rows with data in iframe. 
 
I have tried this but don't think I am doing something correct:
$result = mysql_query ("select * from customerinfo where firstname like
'%".$_POST['firstname']."%' or '%".$_POST['lastname']."%' or
'%".$_POST['phone']."%' or '%".$_POST['email']."%'");
 
I cant seem to figure out how to display. I have tried 
$_POST['firstname']; ?> in the HTML but there was no return of data. 
 
This is my form:
 

First Name: 
Last Name: 
Phone : 
Email : 


 
all of this is on the same page, the page is called search.php 
 
 
 
 
 

--
_
Matthew McNicol
yellowmarker.co.uk
PHP / MySQL web development
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] search form w/ multiple fields

2004-07-21 Thread Vincent Jordan
I have a form with firstname, lastname, phone, and email fields. I would
like to search the database and return results to the same page in an
iframe. I want to be able to search my just one or multiple. For example
I can search by "firstname" with value of "john" and it will return all
"john" rows in iframe or search "firstname" value "john" and "lastname"
value "smith" and again will return all rows with data in iframe. 
 
I have tried this but don't think I am doing something correct:
$result = mysql_query ("select * from customerinfo where firstname like
'%".$_POST['firstname']."%' or '%".$_POST['lastname']."%' or
'%".$_POST['phone']."%' or '%".$_POST['email']."%'");
 
I cant seem to figure out how to display. I have tried  in the HTML but there was no return of data. 
 
This is my form:
 

First Name: 
Last Name: 
Phone : 
Email : 


 
all of this is on the same page, the page is called search.php 
 
 
 
 
 


[PHP-DB] search engine query

2004-05-19 Thread Bobo Wieland
Hi! I'm new to this list. I usually try to get my answers at the php-win
mailing list...

But since this is a mysql question I thought it would be better to ask i t
here;

How do I get the best result from a simple search (just one input box and a
search button) from a mysql db with two tables containing
the following fields;

_table1_
id (int) (primary)
title (varchar 40)
keywords (varchar 255 with a list of keywords separated with comma)
description (varchar 255 with fulltext index)
-

_table2_
f_key (int), page (int) (f_key is the same as id from table1 and f_key and
page combined is the primary)
text (text with fulltext index)
-


I guess you can see what the table represents... One article split in 1 to *
pages with one entry in table1 for all the common stuff...

I need to find the articles that fits the search the best (obviously... )...
I'm really not sure how to do this... There must be some general way that
people goes about this since it seems to me to be a quite common thing to
do...



.bobo

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



Re: [PHP-DB] search engines

2004-04-29 Thread Jeffrey Moss
Read up on MySQL full text search.

http://dev.mysql.com/doc/mysql/en/Fulltext_Search.html

-Jeff

- Original Message - 
From: "redhat" <[EMAIL PROTECTED]>
To: "phplist" <[EMAIL PROTECTED]>
Sent: Thursday, April 29, 2004 10:12 AM
Subject: [PHP-DB] search engines


> Anyone out there know of a good tutorial on creating a php/mysql based
> search engine script?  I would like to write one for a small "in-house"
> application that I am running.
> thanks,
> DF
> 
> -- 
> 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] search engines

2004-04-29 Thread redhat
Anyone out there know of a good tutorial on creating a php/mysql based
search engine script?  I would like to write one for a small "in-house"
application that I am running.
thanks,
DF

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



Re: [PHP-DB] Search results of a previous query?

2004-02-18 Thread Ricardo Lopes
You can concat to the 1º filter statement the 2º. ex:

SELECT * FROM atable WHERE (fieldname = fieldvalue) AND (fieldname2 =
fieldvalue2)

For the user to search twice in the same field i think you have to use the
LIKE operator instead of the = and use the % in the string as wildcard. ex:

1º Search:  Name = "%Carlos%"// Will return all Carlos
2º Search:  Name = "%Triana%"// Will return everybody that have
Carlos and Triana in any part of their name if used a sql like the one above
(with AND).

This could be done how many times you want with only one field or several.

Hope this Hepls.

- Original Message -
From: "Lic. Carlos A. Triana Torres" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 18, 2004 1:36 PM
Subject: [PHP-DB] Search results of a previous query?


Hi all,
I am trying to build a script to make "nested" searches in a table. I
have a form compossed of a text field and a select dropdown menu with all
the fields in the table. The user can write in the text box and then select
the field in which to perform the search. This works fine so far...now, I
want to show the results of the query, but give the user the possibility of
searching again BUT only make the search with the results shown, not the
entire tablecan anyone give me any ideas of how to do this last part? I
tried passing the new queries in the url...but this won't give the user the
possibility to search twice in the same field...
Any ideas? Thanks before hand.

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



[PHP-DB] Search results of a previous query?

2004-02-18 Thread Lic. Carlos A. Triana Torres
Hi all,
I am trying to build a script to make "nested" searches in a table. I have a form 
compossed of a text field and a select dropdown menu with all the fields in the table. 
The user can write in the text box and then select the field in which to perform the 
search. This works fine so far...now, I want to show the results of the query, but 
give the user the possibility of searching again BUT only make the search with the 
results shown, not the entire tablecan anyone give me any ideas of how to do this 
last part? I tried passing the new queries in the url...but this won't give the user 
the possibility to search twice in the same field...
Any ideas? Thanks before hand.


Re: [PHP-DB] Search Query

2003-12-18 Thread Ng Hwee Hwee
thanx Mike for your help!!

appreciatively,
hh

- Original Message -
From: "Ford, Mike [LSS]" <[EMAIL PROTECTED]>
To: "'Ng Hwee Hwee'" <[EMAIL PROTECTED]>; "DBList" <[EMAIL PROTECTED]>
Sent: Thursday, December 18, 2003 6:06 PM
Subject: RE: [PHP-DB] Search Query


> On 18 December 2003 05:26, Ng Hwee Hwee wrote:
>
> > Dear all,
> >
> > i need help with my search query statement.. what is wrong
> > with my code?
>
> Nothing obvious that I can see, except a little inefficiency.  Where do
> $keyword and $table come from? -- is this a register_globals issue?
>
>
> > 
> >   $word = split(" ", $keyword);
> >   $num_words = count($word);
> >   $word_str = "";
> >   $criteria = "";
> >
> >   for ($i=0; $i<$num_words; $i++)
> >   {
> >   if ($i)
> >  $word_str .= "and colName like '%".$word[$i]."%' ";
> >  else $word_str .= "colName like '%".$word[$i]."%' ";
> > }
> >   $word_str .= "and col2 = '$foo' ";
> >
> >   $criteria .= "$word_str ";
>
> I'd replace all of the above with:
>
> $criteria = "colName like '%"
>. str_replace(' '
> , "%' and colName like '%"
> , $keyword)
>. "%'"
>. " and col2 = '$foo' "
>
> >   $table .= "db_table";
> >
> >   $query = "select * from ".$table." where ".$criteria; 
> >
> > when i try to echo $query, i get ---  select * from where
> >
> > and so of course MySQL gives me an error 1064 near ' where '
> >
> > what happened?
>
> What's your error_reporting level?  HAve you tried cranking it up to E_ALL
> to see if any relevant warnings are being generated that you're not
> currently seeing?
>
> Cheers!
>
> Mike
>
> -
> Mike Ford,  Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211
>

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



RE: [PHP-DB] Search Query

2003-12-18 Thread Ford, Mike [LSS]
On 18 December 2003 05:26, Ng Hwee Hwee wrote:

> Dear all,
> 
> i need help with my search query statement.. what is wrong
> with my code?

Nothing obvious that I can see, except a little inefficiency.  Where do
$keyword and $table come from? -- is this a register_globals issue?

 
> 
>   $word = split(" ", $keyword);
>   $num_words = count($word);
>   $word_str = "";
>   $criteria = "";
> 
>   for ($i=0; $i<$num_words; $i++)
>   {
>   if ($i)
>  $word_str .= "and colName like '%".$word[$i]."%' "; 
>  else $word_str .= "colName like '%".$word[$i]."%' ";
> } 
>   $word_str .= "and col2 = '$foo' ";
> 
>   $criteria .= "$word_str ";

I'd replace all of the above with:

$criteria = "colName like '%"
   . str_replace(' '
, "%' and colName like '%"
, $keyword)
   . "%'"
   . " and col2 = '$foo' "

>   $table .= "db_table";
> 
>   $query = "select * from ".$table." where ".$criteria; 
> 
> when i try to echo $query, i get ---  select * from where
> 
> and so of course MySQL gives me an error 1064 near ' where '
> 
> what happened?

What's your error_reporting level?  HAve you tried cranking it up to E_ALL
to see if any relevant warnings are being generated that you're not
currently seeing?

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



[PHP-DB] Search Query

2003-12-17 Thread Ng Hwee Hwee
Dear all,

i need help with my search query statement.. what is wrong with my code?


  $word = split(" ", $keyword);
  $num_words = count($word);
  $word_str = "";
  $criteria = "";

  for ($i=0; $i<$num_words; $i++)
  {
  if ($i)
 $word_str .= "and colName like '%".$word[$i]."%' ";
  else
 $word_str .= "colName like '%".$word[$i]."%' ";
  }

  $word_str .= "and col2 = '$foo' ";

  $criteria .= "$word_str ";
  $table .= "db_table";

  $query = "select * from ".$table." where ".$criteria;


when i try to echo $query, i get ---  select * from where

and so of course MySQL gives me an error 1064 near ' where '

what happened?

thanx thanx!

hwee

[PHP-DB] Search and POST and keywords

2003-11-03 Thread Robert Sossomon
I have been modifying the quote system I have been writing like mad and
have hit another brick wall of sorts.

I am trying to do a couple of things...
The search is now up and running on just a DESCRIPTION field.  Anything
else at this point is unwieldy.  It works perfectly however I am trying
to add a piece to the puzzle.

What I would LIKE it to do is pass along the keywords back to itself so
that when it is called from within itself it can be on the same search
terms.

I have made the code do this:
 

These are inputs to another form, which just passed this back
   header("Location:$_POST[url]");

I guess what I am missing is another way to pass the KEYWORD from the
first form to the next part to make it seen by the script.

http://www.garlandcnorris.com/quotes

I have completely blown the numbers out of proportion, but you can still
play with it to see what I mean.

I can shoot source out if need be, but this is probably just a stupid
mistake on my part.

TIA!!

Robert

~~~
There are three kinds of economist. Those who can count, and those who
can't.

-Eddie George. 
~~~

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



RE: [PHP-DB] search doc in dB

2003-08-07 Thread Ben Lake

Aleks

Read this:
http://www.devshed.com/Server_Side/PHP/Search_Engine/page1.html


---

PHP - www.devshed.com , www.phpbuilder.com , www.phparchitect.com ,
php.net!
MySQL - www.devshed.com , www.mysql.com/documentation/

I'm noticing on this mailing list a ton of people saying "Here's my
project, wanna help?", there are also a ton of questions that are VERY
easily answered in the MySQL documentation and even in PHP's manual.

The only reason I am saying any of this is mainly because Google has
become such a "find anything, or at least something" search engine. Is
anyone looking for the answer before asking the masses!

The open source community has come a long way in documentation. USE IT!

Ben Lake

-Original Message-
From: Aleks @ USA.net [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 07, 2003 10:36 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] search doc in dB


I have a project were I need to create a search mechanism for a large
number of documents. I have already created a dB containing the Doc
name, its URL location on the hard drive and a description. The search
is being done against the document name. The complaint I am getting is
that the users may not know the name of the document or may need to do a
search against the contents of a document in order to get a list of
documents listed by relevance.

1. Will PHP fopen read .pdf as well as .doc types if I upload them into
a table column with the BLOB type set 2. I need to create a search
script that will search the title and/or contents and return a list of
relevant documents

Any assistance would be appreciated. Eventually I hope to be able to use
the dB to not only search but to allow the retrieval of the document
instead of having them stored in another location on the hard drive.
This will allow me to set up another level of security.

Thanks in advance for your help...

Aleks


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



[PHP-DB] search doc in dB

2003-08-07 Thread Aleks @ USA.net
I have a project were I need to create a search mechanism for a large number
of documents.
I have already created a dB containing the Doc name, its URL location on the
hard drive and a description.
The search is being done against the document name. The complaint I am
getting is that the users may not
know the name of the document or may need to do a search against the
contents of a document in order to
get a list of documents listed by relevance.

1. Will PHP fopen read .pdf as well as .doc types if I upload them into a
table column with the BLOB type set
2. I need to create a search script that will search the title and/or
contents and return a list of relevant documents

Any assistance would be appreciated. Eventually I hope to be able to use the
dB to not only search but to allow the
retrieval of the document instead of having them stored in another location
on the hard drive. This will allow me to
set up another level of security.

Thanks in advance for your help...

Aleks


Re: [PHP-DB] search query problem

2003-07-26 Thread Miles Thompson
To start with:
Go to one of the on-line SQL tutorail sites and learn how to 
formulate a query.
Then make a simple query, and figure out how it works.
After that add fields from related tables, one table at a time,
so that you can see the effect of how joining tables works.

Also, watch how you name your fields. "Date" is a reserved word in MySQL, 
do not use it as a field name, you're only creating potential trouble. 
Check the MySQL docs for reserved words.

Your present query lacks a FROM clause which is one reason it won't work. 
Nor do you have any join conditions to link the tables.

Rather than trying to fix this, which is a bit of a hash, start with the 
basics, then work up to more complex queries.

Regards - Miles Thompson



At 10:53 AM 7/26/2003 +0300, Ahmed Abdelaliem wrote:
hi
i am making a simple search form
how can i search more than one table for the same word
i used a query and it failed
here it is
@ $db = mysql_connect("localhost");
mysql_select_db("egycds");
$test_tr = mysql_query("select newdvd.date, newpcgames.date, olddvd.date, 
screener.date,
newdvd.type, newpcgames.type, olddvd.type, screener.type,
newdvd.name, newpcgames.name, olddvd.name, screener.name,
newdvd.cds, newpcgames.cds, olddvd.cds, screener.cds,
newdvd.downloader, newpcgames.downloader, olddvd.downloader, 
screener.downloader, where newdvd.name like '%".$word."%'
or newpcgames.name like '%".$word."%' or olddvd.name like '%".$word."%' or 
screener.name like '%".$word."%'");
 

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


[PHP-DB] search query problem

2003-07-26 Thread Ahmed Abdelaliem
hi
i am making a simple search form
how can i search more than one table for the same word
i used a query and it failed
here it is
@ $db = mysql_connect("localhost");
mysql_select_db("egycds");
$test_tr = mysql_query("select newdvd.date, newpcgames.date, olddvd.date, 
screener.date,
newdvd.type, newpcgames.type, olddvd.type, screener.type,
newdvd.name, newpcgames.name, olddvd.name, screener.name,
newdvd.cds, newpcgames.cds, olddvd.cds, screener.cds,
newdvd.downloader, newpcgames.downloader, olddvd.downloader, 
screener.downloader, where newdvd.name like '%".$word."%'
or newpcgames.name like '%".$word."%' or olddvd.name like '%".$word."%' or 
screener.name like '%".$word."%'");

while ($record=mysql_fetch_array($test_tr)){



   echo "
   
   
   
   color=#ff>";
   echo stripslashes($record['date']) ;
   echo "
   
   ";
   echo stripslashes($record['type']) ;
   echo "
     
   href=\"";
   echo stripslashes($record['link']);
   echo "\" target=_new1>";
   echo stripslashes($record['name']);
   echo "  

   
   
   href=\"";
   echo stripslashes($record['subtitle']);
   echo "\">";
   echo stripslashes($record['cds']);
   echo "
   
   
   href=\"";
   echo 
stripslashes($record['downloaderlink']);
   echo "\">";
   echo stripslashes($record['downloader']);
   echo "

";
   }
echo "";


can anyone help please.

_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail

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


[PHP-DB] search query problem

2003-07-26 Thread Ahmed






hi
i am making a simple search form
how can i search more than one table for the same word
i used a query and it failed
here it is 
@ $db = mysql_connect("localhost");mysql_select_db("egycds");
 
$test_tr = mysql_query("select newdvd.date, newpcgames.date, olddvd.date, screener.date,newdvd.type, newpcgames.type, olddvd.type, screener.type,newdvd.name, newpcgames.name, olddvd.name, screener.name,newdvd.cds, newpcgames.cds, olddvd.cds, screener.cds,newdvd.downloader, newpcgames.downloader, olddvd.downloader, screener.downloader, where newdvd.name like '%".$word."%'or newpcgames.name like '%".$word."%' or olddvd.name like '%".$word."%' or screener.name like '%".$word."%'");
 
 while ($record=mysql_fetch_array($test_tr)){
 
 
 
    echo "                color=#ff>";    echo stripslashes($record['date']) ;    echo "        ";    echo stripslashes($record['type']) ;    echo "      href="">    echo stripslashes($record['link']);    echo "\" target=_new1>";    echo stripslashes($record['name']);    echo "              href="">    echo stripslashes($record['subtitle']);    echo "\">";    echo stripslashes($record['cds']);    echo "            href="">    echo stripslashes($record['downloaderlink']);    echo "\">";    echo stripslashes($record['downloader']);    echo "
 
     ";    } echo "";
 
 
 
can anyone help please.
 







  IncrediMail - Email has finally evolved - Click Here

Re: [PHP-DB] Search problems... :(

2003-07-13 Thread Marco
i've correct the problem

the script was right

thx



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



Re: [PHP-DB] Search problems... :(

2003-07-13 Thread Marco
I have correct case sensitive error but it still don't work:

RESULT CODE:

$keys = explode (" ", $_POST ["chiave"]);

$query = "";

foreach ($keys as $parola){
$parola = trim($parola);
if ($parola != "")
$query .= "titolo LIKE '%$parola%' OR testo LIKE '%$parola%' OR autore LIKE
'%$parola%' OR ";
}
$query .= "0";

$query = "SELECT id, titolo, data FROM news WHERE " . $query;

$result = mysql_query($query, $db);

while ($row = mysql_fetch_array($result))
{ echo "" . date("j/n/y", $row[data]) . " -
$row[titolo]"; }

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in c:\programmi\apache group\apache\test\prova\result.php on line

Any suggestion?




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



Re: [PHP-DB] Search problems... :(

2003-07-13 Thread George Patterson
Marco you have made a typing mistake in $key or $Keys... :-D

Remoevd all non essential lines...

On Sun, 13 Jul 2003 17:13:03 +0200
"Marco Mastrorilli" <[EMAIL PROTECTED]> wrote:
> 
> $keys = explode (" ", $_POST ["chiave"]);

> 
> foreach ($Keys as $single_word)


---

Everything goes right till
foreach ($Keys as $single_word) 
that RETURNS:

Warning: Invalid argument supplied for foreach() in c:\programmi\apache
group\apache\test\prova\result.php on line 

Do U know why?
Thanks in advance
Marco

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



[PHP-DB] Search problems... :(

2003-07-13 Thread Marco Mastrorilli
A form passes variable "$chiave" to result.php

RESULT.PHP CODE:



" . date("j/n/y", $row[data]) . " - 
$row[titolo]"; }

foot();
?>



Everything goes right till
foreach ($Keys as $single_word) 
that RETURNS:

Warning: Invalid argument supplied for foreach() in c:\programmi\apache 
group\apache\test\prova\result.php on line 

Do U know why?
Thanks in advance
Marco

Re: [PHP-DB] Search and Replace

2002-11-08 Thread Marco Tabini
It should be fairly easy.

Write a php script that loads your source file in memory and then
substitute your values, then save it to disk. There was a thread between
Jonathan Sharp and myself in the PHP mailing a week or so ago--if you
check the archives you should find it pretty easily--Jonathan's solution
was faster than mine.


Marco

-
php|architect -- The Monthly Magazine For PHP Professionals
Come visit us on the web at http://www.phparch.com!

On Fri, 2002-11-08 at 11:50, Ryan Holowaychuk wrote:
> I am trying to do a search and replace into a text file that will then
> get saved to a new name once the info has been replaced.  
> 
> So I have been able to do this with simple ..['name'] variable replace.
> But how do I get it to save the results into a text file.
> 
> Program work Flow - for creating a PDF document online of a business
> card of a set document, Business card.  Go to site, put in your name,
> phone and other needed fields.  
> 
> I have a PostScript file of the Business Card in the layout that we
> have. There is a replace that is done in the PS file for the name and
> other info.  And then the file is to be saved with the changes.
> 
> Thanks
> Ryan
> 
> 
> 
> 
> -- 
> 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] Search and Replace

2002-11-08 Thread Ryan Holowaychuk
I am trying to do a search and replace into a text file that will then
get saved to a new name once the info has been replaced.  

So I have been able to do this with simple ..['name'] variable replace.
But how do I get it to save the results into a text file.

Program work Flow - for creating a PDF document online of a business
card of a set document, Business card.  Go to site, put in your name,
phone and other needed fields.  

I have a PostScript file of the Business Card in the layout that we
have. There is a replace that is done in the PS file for the name and
other info.  And then the file is to be saved with the changes.

Thanks
Ryan




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




Re: [PHP-DB] search field into MySQL

2002-10-25 Thread dr. Agon
Did anyone hear about "match against" construction? I is easy to build
this:

$query = "SELECT *, MATCH field AGAINST ('$searchwords') as relev FROM table
ORDER BY relev DESC"

(you need do "ALTER TABLE table ADD FULLTEXT(field)" before.

This could be usefull:

http://detail.phpclub.net/download/search_with_relevance.txt


Regards, A.K.


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




RE: [PHP-DB] search question

2002-09-17 Thread John Holmes

You could check out the FULLTEXT searching in MySQL, too. It's in the
manual. It has some quirks, but works well on a large database.

---John Holmes...

> -Original Message-
> From: Cal Evans [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 17, 2002 8:04 AM
> To: Meltem Demirkus; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] search question
> 
> it depends on how you design your database.  When I know I will have
this
> situation, I design a table named keyWords. Put one work per record
and
> assign each word an ID number.  Then I create a join table between
> keyWords
> and whatever table they relate to.  The join table only contains 2
fields,
> the pk from keyWords and the pk from the other table.  Then I ad 1
record
> to
> the join table for each keyword that relates to each record in the
other
> table.
> 
> It's simple then to join the 3 tables in such a manner as to quickly
find
> the records in the other table that relate to a specific key word.
> 
> HTH,
> =C=
> 
> *
> * Cal Evans
> * The Virtual CIO
> * http://www.calevans.com
> *
> 
> 
> -Original Message-
> From: Meltem Demirkus [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 17, 2002 3:20 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] search question
> 
> 
> Hi,
> Is there any other efficient way (--except using LIKE)of searching a
> keyword
> in mysql ...
> 
> thanks
> 
> 
> --
> 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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] search question

2002-09-17 Thread Cal Evans

it depends on how you design your database.  When I know I will have this
situation, I design a table named keyWords. Put one work per record and
assign each word an ID number.  Then I create a join table between keyWords
and whatever table they relate to.  The join table only contains 2 fields,
the pk from keyWords and the pk from the other table.  Then I ad 1 record to
the join table for each keyword that relates to each record in the other
table.

It's simple then to join the 3 tables in such a manner as to quickly find
the records in the other table that relate to a specific key word.

HTH,
=C=

*
* Cal Evans
* The Virtual CIO
* http://www.calevans.com
*


-Original Message-
From: Meltem Demirkus [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 17, 2002 3:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] search question


Hi,
Is there any other efficient way (--except using LIKE)of searching a keyword
in mysql ...

thanks


--
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] search question

2002-09-17 Thread Meltem Demirkus

Hi,
Is there any other efficient way (--except using LIKE)of searching a keyword
in mysql ...

thanks


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




Re: [PHP-DB] search syntax

2002-07-21 Thread Matthew K. Gold

Great--it works now.  Thanks very much, Tony.  I appreciate your help.

best,

Matt

- Original Message -
From: Tony <[EMAIL PROTECTED]>
To: Matthew K. Gold <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, July 22, 2002 1:01 AM
Subject: Re: [PHP-DB] search syntax


> Try break up the query, like:
>
> WHERE (column1 LIKE '%$search%' OR column2 LIKE '%$search%' OR column3
LIKE
> '%$search%') AND ...
>
> Tony S. Wu
>
>
> Matthew K. Gold at [EMAIL PROTECTED] wrote:
>
> > hi everyone,
> >
> > I'm writing the code to make my mysql database searchable.  I can search
two
> > columns, but I seem to have problems when I try to search three.
> >
> > In the SELECT statement, this WHERE statement works:  WHERE column1 OR
> > column2 LIKE '%$search%' AND...
> >
> > This WHERE statement doesn't work:  WHERE column1 OR column2 OR column3
LIKE
> > '%$search%' AND ...
> >
> > I'm obviously having a syntax problem...Thanks in advance for your help.
> > And in case any of this is confusing, I'll include the real code below.
> >
> > Thanks,
> >
> > Matt
> >
> >
> > $get_data = "select course.CourseNumber, course.CourseTitle,
> > concat(prof.ProfFName, \" \", prof.ProfLName), instit.InstitName,
> > disc.DiscName, course.Format from course, disc, instit, prof where
> > course.CourseTitle or course.CourseDesc or disc.DiscName like
'%$search%'
> > and course.DiscID = disc.DiscID and course.InstitID = instit.InstitID
and
> > course.ProfID = prof.ProfID order by $orderby";
> >
> >
> >
> >
> >
>
>
>


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




Re: [PHP-DB] search syntax

2002-07-21 Thread Tony

Try break up the query, like:

WHERE (column1 LIKE '%$search%' OR column2 LIKE '%$search%' OR column3 LIKE
'%$search%') AND ...

Tony S. Wu


Matthew K. Gold at [EMAIL PROTECTED] wrote:

> hi everyone,
> 
> I'm writing the code to make my mysql database searchable.  I can search two
> columns, but I seem to have problems when I try to search three.
> 
> In the SELECT statement, this WHERE statement works:  WHERE column1 OR
> column2 LIKE '%$search%' AND...
> 
> This WHERE statement doesn't work:  WHERE column1 OR column2 OR column3 LIKE
> '%$search%' AND ...
> 
> I'm obviously having a syntax problem...Thanks in advance for your help.
> And in case any of this is confusing, I'll include the real code below.
> 
> Thanks,
> 
> Matt
> 
> 
> $get_data = "select course.CourseNumber, course.CourseTitle,
> concat(prof.ProfFName, \" \", prof.ProfLName), instit.InstitName,
> disc.DiscName, course.Format from course, disc, instit, prof where
> course.CourseTitle or course.CourseDesc or disc.DiscName like '%$search%'
> and course.DiscID = disc.DiscID and course.InstitID = instit.InstitID and
> course.ProfID = prof.ProfID order by $orderby";
> 
> 
> 
> 
> 




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




[PHP-DB] search syntax

2002-07-21 Thread Matthew K. Gold

hi everyone,

I'm writing the code to make my mysql database searchable.  I can search two
columns, but I seem to have problems when I try to search three.

In the SELECT statement, this WHERE statement works:  WHERE column1 OR
column2 LIKE '%$search%' AND...

This WHERE statement doesn't work:  WHERE column1 OR column2 OR column3 LIKE
'%$search%' AND ...

I'm obviously having a syntax problem...Thanks in advance for your help.
And in case any of this is confusing, I'll include the real code below.

Thanks,

Matt


$get_data = "select course.CourseNumber, course.CourseTitle,
concat(prof.ProfFName, \" \", prof.ProfLName), instit.InstitName,
disc.DiscName, course.Format from course, disc, instit, prof where
course.CourseTitle or course.CourseDesc or disc.DiscName like '%$search%'
and course.DiscID = disc.DiscID and course.InstitID = instit.InstitID and
course.ProfID = prof.ProfID order by $orderby";






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




Re: [PHP-DB] Search Script

2002-04-25 Thread Dan Brunner

Hello!!

Your right!!

don't use = on the like part...I don't know what I was thinking!!!

Anyway here is the code right from my search page...

include("./navbar2.php");
$nav = new navbar;
$nav->numrowsperpage = 30;
$sql = "SELECT Print_Name, Art_Job_Number, Size, Item_Number FROM 
Table1 WHERE Print_Name LIKE '%$Print_Name%' ORDER BY $or $place";
$result = $nav->execute($sql, $db, "mysql");
$rows = mysql_num_rows($result);
for ($y = 0; $y < $rows; $y++){
$data = mysql_fetch_object($result);

That should do it!!

Dan


On Thursday, April 25, 2002, at 09:23 AM, [EMAIL PROTECTED] wrote:

> The query should read as below, without the = after the LIKE:
>
> $query = "SELECT uid, id, image, iname, quantity, type FROM
> {$config["prefix"]}_shop WHERE iname LIKE '%$shopsearch% ORDER BY
> iname'";
>
> HTH
>
> Maureen
>
>
> Jennifer Downey <[EMAIL PROTECTED]> said:
>
>> Hi all,
>>
>> I have been trying to build a search script for my site that deals 
>> with only
>> one table in my db.
>> As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I
>> can't seem to locate that clause in ether
>> manual.
>> Dan Brunner gave me this to go on:
>>
>> $query = "SELECT uid, id, image, iname, quantity, type FROM
>> {$config["prefix"]}_shop WHERE  iname  LIKE = '%$shopsearch% ORDER BY
>> iname'";
>> $ret = mysql_query($query);
>> while(list($quantity)=mysql_fetch_row($ret))
>>
>> But I can't seem to get this to work. I have never worked with LIKE 
>> before
>> and would appreciate any help on this.
>>
>> Thanks Julie and Dan for your time and effort.
>>
>> Thanks all for your time and help
>> Jennifer
>>
>>
>> --
>> The sleeper has awaken
>>
>>
>> ---
>> Outgoing mail is certified Virus Free.
>> Checked by AVG anti-virus system (http://www.grisoft.com).
>> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
>>
>>
>>
>> --
>> 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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Search Script

2002-04-25 Thread Maureen

>From what I can see, you are not defining the array $row in here.  You would 
need to define something like:

$row=mysql_fetch_array($ret);

before calling it.


I finally found where the information on LIKE is in the manual (I can 
understand your frustration, it took me a while).  It is under Pattern 
Matching if you search the manual.

HTH

Maureen

  

Jennifer Downey <[EMAIL PROTECTED]> said:

> Thanks Maureen,
> 
> I don't get the errors I was getting so that shows me you are great. Now my
> next problem is if an item is found how do I echo or print that to the
> screen. I have this as a starting point but I don't know where to go after
> this.
> 
> if($search)
> {
> $query = "SELECT uid, id, image, iname, quantity, user, type FROM
> {$config["prefix"]}_shop WHERE iname LIKE '%$searchword%' ORDER BY iname";
>$ret = mysql_query($query) or die(mysql_error());
>while(list($iname)=mysql_fetch_row($ret))
> 
>$user = $row['user'];
>if($iname == $searchword) echo $user;
> 
> }else{
> 
> echo "";
> echo "Search Shops";
> echo "";
> 
> }
> I can't get any data to show up.
> 
> Could you shed some light on this. I don't want you to wirte it just let me
> know if I am on the righ track.
> 
> Thanks
> Jennifer
> 
> 
> "Maureen" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > The query should read as below, without the = after the LIKE:
> >
> > $query = "SELECT uid, id, image, iname, quantity, type FROM
> > {$config["prefix"]}_shop WHERE iname LIKE '%$shopsearch% ORDER BY
> > iname'";
> >
> > HTH
> >
> > Maureen
> >
> >
> > Jennifer Downey <[EMAIL PROTECTED]> said:
> >
> > > Hi all,
> > >
> > > I have been trying to build a search script for my site that deals with
> only
> > > one table in my db.
> > > As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I
> > > can't seem to locate that clause in ether
> > > manual.
> > > Dan Brunner gave me this to go on:
> > >
> > > $query = "SELECT uid, id, image, iname, quantity, type FROM
> > > {$config["prefix"]}_shop WHERE  iname  LIKE = '%$shopsearch% ORDER BY
> > > iname'";
> > > $ret = mysql_query($query);
> > > while(list($quantity)=mysql_fetch_row($ret))
> > >
> > > But I can't seem to get this to work. I have never worked with LIKE
> before
> > > and would appreciate any help on this.
> > >
> > > Thanks Julie and Dan for your time and effort.
> > >
> > > Thanks all for your time and help
> > > Jennifer
> > >
> > >
> > > --
> > > The sleeper has awaken
> > >
> > >
> > > ---
> > > Outgoing mail is certified Virus Free.
> > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> > >
> > >
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> >
> > --
> >
> >
> >
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> 
> 
> 
> -- 
> 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




Re: [PHP-DB] Search Script

2002-04-25 Thread Jennifer Downey

Thanks Maureen,

I don't get the errors I was getting so that shows me you are great. Now my
next problem is if an item is found how do I echo or print that to the
screen. I have this as a starting point but I don't know where to go after
this.

if($search)
{
$query = "SELECT uid, id, image, iname, quantity, user, type FROM
{$config["prefix"]}_shop WHERE iname LIKE '%$searchword%' ORDER BY iname";
   $ret = mysql_query($query) or die(mysql_error());
   while(list($iname)=mysql_fetch_row($ret))

   $user = $row['user'];
   if($iname == $searchword) echo $user;

}else{

echo "";
echo "Search Shops";
echo "";

}
I can't get any data to show up.

Could you shed some light on this. I don't want you to wirte it just let me
know if I am on the righ track.

Thanks
Jennifer


"Maureen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> The query should read as below, without the = after the LIKE:
>
> $query = "SELECT uid, id, image, iname, quantity, type FROM
> {$config["prefix"]}_shop WHERE iname LIKE '%$shopsearch% ORDER BY
> iname'";
>
> HTH
>
> Maureen
>
>
> Jennifer Downey <[EMAIL PROTECTED]> said:
>
> > Hi all,
> >
> > I have been trying to build a search script for my site that deals with
only
> > one table in my db.
> > As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I
> > can't seem to locate that clause in ether
> > manual.
> > Dan Brunner gave me this to go on:
> >
> > $query = "SELECT uid, id, image, iname, quantity, type FROM
> > {$config["prefix"]}_shop WHERE  iname  LIKE = '%$shopsearch% ORDER BY
> > iname'";
> > $ret = mysql_query($query);
> > while(list($quantity)=mysql_fetch_row($ret))
> >
> > But I can't seem to get this to work. I have never worked with LIKE
before
> > and would appreciate any help on this.
> >
> > Thanks Julie and Dan for your time and effort.
> >
> > Thanks all for your time and help
> > Jennifer
> >
> >
> > --
> > The sleeper has awaken
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
>
> --
>
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re: [PHP-DB] Search Script

2002-04-25 Thread Miles Thompson

And Maureen is right! We just so *used* to seeing equal signs in SELECT 
statements.

Smacking fist on head  Miles Thompson

At 02:23 PM 4/25/2002 +, Maureen wrote:
>The query should read as below, without the = after the LIKE:
>
>$query = "SELECT uid, id, image, iname, quantity, type FROM
>{$config["prefix"]}_shop WHERE iname LIKE '%$shopsearch% ORDER BY
>iname'";
>
>HTH
>
>Maureen
>
>
>Jennifer Downey <[EMAIL PROTECTED]> said:
>
> > Hi all,
> >
> > I have been trying to build a search script for my site that deals with 
> only
> > one table in my db.
> > As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I
> > can't seem to locate that clause in ether
> > manual.
> > Dan Brunner gave me this to go on:
> >
> > $query = "SELECT uid, id, image, iname, quantity, type FROM
> > {$config["prefix"]}_shop WHERE  iname  LIKE = '%$shopsearch% ORDER BY
> > iname'";
> > $ret = mysql_query($query);
> > while(list($quantity)=mysql_fetch_row($ret))
> >
> > But I can't seem to get this to work. I have never worked with LIKE before
> > and would appreciate any help on this.
> >
> > Thanks Julie and Dan for your time and effort.
> >
> > Thanks all for your time and help
> > Jennifer
> >
> >
> > --
> > The sleeper has awaken
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> >
> >
> >
> > --
> > 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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Search Script

2002-04-25 Thread Miles Thompson


Jennifer,

In the manual it's probably under the SELECT heading. (I've not checked, 
but that's a godd spot to start looking for the bits that can amke up the 
WHERE clause.)

Try removing the single quotes - you have one before >%shopsear< and 
another following iname, as > iname'" <

Sorry this is a bit vague, but if you need the single quotes arounf 
shopsearch you may have to build up the SQL statement bit by bit. Remember 
to echo $query so that you will know if it look right.

Cheers - Miles

At 07:15 AM 4/25/2002 -0700, Jennifer Downey wrote:
>Hi all,
>
>I have been trying to build a search script for my site that deals with only
>one table in my db.
>As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I
>can't seem to locate that clause in ether
>manual.
>Dan Brunner gave me this to go on:
>
>$query = "SELECT uid, id, image, iname, quantity, type FROM
>{$config["prefix"]}_shop WHERE  iname  LIKE = '%$shopsearch% ORDER BY
>iname'";
>$ret = mysql_query($query);
>while(list($quantity)=mysql_fetch_row($ret))
>
>But I can't seem to get this to work. I have never worked with LIKE before
>and would appreciate any help on this.
>
>Thanks Julie and Dan for your time and effort.
>
>Thanks all for your time and help
>Jennifer
>
>
>--
>The sleeper has awaken
>
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
>
>
>
>--
>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




Re: [PHP-DB] Search Script

2002-04-25 Thread Maureen

Sorry about that, I just pasted and took out the =, but I see another thing 
that could be a problem:

$query = "SELECT uid, id, image, iname, quantity, type FROM
{$config["prefix"]}_shop WHERE  iname  LIKE = '%$shopsearch%' ORDER BY
iname";

The single quote was in the wrong place, it should have been after '%
$shopsearch%, not after iname.

HTH

Maureen



Maureen <[EMAIL PROTECTED]> said:

> The query should read as below, without the = after the LIKE:
> 
> $query = "SELECT uid, id, image, iname, quantity, type FROM
> {$config["prefix"]}_shop WHERE iname LIKE '%$shopsearch% ORDER BY
> iname'";
> 
> HTH
> 
> Maureen
> 
> 
> Jennifer Downey <[EMAIL PROTECTED]> said:
> 
> > Hi all,
> > 
> > I have been trying to build a search script for my site that deals with 
only
> > one table in my db.
> > As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I
> > can't seem to locate that clause in ether
> > manual.
> > Dan Brunner gave me this to go on:
> > 
> > $query = "SELECT uid, id, image, iname, quantity, type FROM
> > {$config["prefix"]}_shop WHERE  iname  LIKE = '%$shopsearch% ORDER BY
> > iname'";
> > $ret = mysql_query($query);
> > while(list($quantity)=mysql_fetch_row($ret))
> > 
> > But I can't seem to get this to work. I have never worked with LIKE before
> > and would appreciate any help on this.
> > 
> > Thanks Julie and Dan for your time and effort.
> > 
> > Thanks all for your time and help
> > Jennifer
> > 
> > 
> > --
> > The sleeper has awaken
> > 
> > 
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> > 
> > 
> > 
> > -- 
> > 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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Search Script

2002-04-25 Thread Maureen

The query should read as below, without the = after the LIKE:

$query = "SELECT uid, id, image, iname, quantity, type FROM
{$config["prefix"]}_shop WHERE iname LIKE '%$shopsearch% ORDER BY
iname'";

HTH

Maureen


Jennifer Downey <[EMAIL PROTECTED]> said:

> Hi all,
> 
> I have been trying to build a search script for my site that deals with only
> one table in my db.
> As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I
> can't seem to locate that clause in ether
> manual.
> Dan Brunner gave me this to go on:
> 
> $query = "SELECT uid, id, image, iname, quantity, type FROM
> {$config["prefix"]}_shop WHERE  iname  LIKE = '%$shopsearch% ORDER BY
> iname'";
> $ret = mysql_query($query);
> while(list($quantity)=mysql_fetch_row($ret))
> 
> But I can't seem to get this to work. I have never worked with LIKE before
> and would appreciate any help on this.
> 
> Thanks Julie and Dan for your time and effort.
> 
> Thanks all for your time and help
> Jennifer
> 
> 
> --
> The sleeper has awaken
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> 
> 
> 
> -- 
> 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] Search Script

2002-04-25 Thread Jennifer Downey

Hi all,

I have been trying to build a search script for my site that deals with only
one table in my db.
As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I
can't seem to locate that clause in ether
manual.
Dan Brunner gave me this to go on:

$query = "SELECT uid, id, image, iname, quantity, type FROM
{$config["prefix"]}_shop WHERE  iname  LIKE = '%$shopsearch% ORDER BY
iname'";
$ret = mysql_query($query);
while(list($quantity)=mysql_fetch_row($ret))

But I can't seem to get this to work. I have never worked with LIKE before
and would appreciate any help on this.

Thanks Julie and Dan for your time and effort.

Thanks all for your time and help
Jennifer


--
The sleeper has awaken


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re[2]: [PHP-DB] Search tutroial

2002-04-24 Thread Julie Meloni

JD> By the way SELECT uid, id, image, iname, quantity, type, user where it shows
JD> below that user isn't in the query- it is there in my editor.
>> $query = "SELECT uid, id, image, iname, quantity, type FROM 
>{$config["prefix"]}_shop WHERE  iname = $shopsearch";

The first problem would be that your search string needs to be enclosed
in quotes, preferably single, or at the very least escaped double
quotes.

Presumably, you want to find things that are inexact matches, but darn
close, and in that case you can use LIKE in your query.  Look in the
MySQL manual for the various permutations of LIKE clauses.

But fundamentally, you should to throw in an "or die(mysql_error())" in
conjunction with your mysql_query function.  IE:

$ret = mysql_query($query) or die(mysql_error());

This will tell you exactly the problem when executing a query. And as
others have said, another fine way to debug your queries is to simply
echo them to the screen, look at what is being sent to MySQL, and
trying it manually if the problem isn't glaringly obvious.

But first, surround your search term with quotes and see how far you
get.

- Julie

--> Julie Meloni
--> [EMAIL PROTECTED]
--> www.thickbook.com

Find "Sams Teach Yourself MySQL in 24 Hours" at
http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20


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




Re: [PHP-DB] Search tutroial

2002-04-24 Thread Dan Brunner

Hello!!

Use LIKE in your WHERE clause...

You can also more then when Field

Example.

$query = "SELECT uid, id, image, iname, quantity, type FROM
{$config["prefix"]}_shop WHERE  iname  LIKE = '%$shopsearch% ORDER BY 
iname'";
   $ret = mysql_query($query);
   while(list($quantity)=mysql_fetch_row($ret))

Dan



On Wednesday, April 24, 2002, at 01:47 PM, [EMAIL PROTECTED] wrote:

> By the way SELECT uid, id, image, iname, quantity, type, user where it 
> shows
> below that user isn't in the query- it is there in my editor.
> I just forgot to put it in before sending.
> Jennifer
> "Jennifer Downey" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>> This is basically what I am trying to do
>> if($search)
>> {
>> $query = "SELECT uid, id, image, iname, quantity, type FROM
>> {$config["prefix"]}_shop WHERE  iname = $shopsearch";
>>   $ret = mysql_query($query);
>>   while(list($quantity)=mysql_fetch_row($ret))
>>
>>$name = $row['user'];
>>echo $name;
>>
>> }else{
>>
>> echo "";
>> echo "Search Shops> value=\"\">";
>> echo "";
>>
>> }
>>
>> This is a dump of the table
>>
>> uid int(10) NOT NULL default '0',
>>   id int(5) NOT NULL default '0',
>>   iname varchar(50) NOT NULL default '',
>>   image varchar(100) NOT NULL default '',
>>   quantity int(10) unsigned NOT NULL default '1',
>>   type varchar(20) NOT NULL default '',
>>   price int(6) NOT NULL default '0',
>>   user varchar(50) NOT NULL default '',
>>   KEY uid (uid)
>>
>> Just a note this works throughout my site and I have no trouble with 
>> it:
>> {$config["prefix"]}_shop
>> I'm not trying to be rude but I get sick of it when people tell me that
> this
>> is the problem when it has nothing to do with the question I am asking.
>>
>> Thanks for your time and help
>> Jennifer
>>
>> "Julie Meloni" <[EMAIL PROTECTED]> wrote in message
>> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>>>
>>> JD> Would someone kindly point me to a tutorial on designing a search
>> script for
>>> JD> mysql db.
>>> JD> I have tried to build one but can't get anywhere with it.
>>>
>>> Well, that would depend on what and how you are searching, your table
>>> structure, etc.  Essentially, every SELECT query is a "search".
>>>
>>> If you post more information about your table(s) structure, your
>>> search methods and the search parameters, people would probably be
>>> able to help you.
>>>
>>>
>>> - Julie
>>>
>>> --> Julie Meloni
>>> --> [EMAIL PROTECTED]
>>> --> www.thickbook.com
>>>
>>> Find "Sams Teach Yourself MySQL in 24 Hours" at
>>> http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20
>>>
>>
>>
>> ---
>> Outgoing mail is certified Virus Free.
>> Checked by AVG anti-virus system (http://www.grisoft.com).
>> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
>>
>>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
>
>
>
> --
> 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




Re: [PHP-DB] Search tutroial

2002-04-24 Thread Jennifer Downey

By the way SELECT uid, id, image, iname, quantity, type, user where it shows
below that user isn't in the query- it is there in my editor.
I just forgot to put it in before sending.
Jennifer
"Jennifer Downey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> This is basically what I am trying to do
> if($search)
> {
> $query = "SELECT uid, id, image, iname, quantity, type FROM
> {$config["prefix"]}_shop WHERE  iname = $shopsearch";
>   $ret = mysql_query($query);
>   while(list($quantity)=mysql_fetch_row($ret))
>
>$name = $row['user'];
>echo $name;
>
> }else{
>
> echo "";
> echo "Search Shops";
> echo "";
>
> }
>
> This is a dump of the table
>
> uid int(10) NOT NULL default '0',
>   id int(5) NOT NULL default '0',
>   iname varchar(50) NOT NULL default '',
>   image varchar(100) NOT NULL default '',
>   quantity int(10) unsigned NOT NULL default '1',
>   type varchar(20) NOT NULL default '',
>   price int(6) NOT NULL default '0',
>   user varchar(50) NOT NULL default '',
>   KEY uid (uid)
>
> Just a note this works throughout my site and I have no trouble with it:
> {$config["prefix"]}_shop
> I'm not trying to be rude but I get sick of it when people tell me that
this
> is the problem when it has nothing to do with the question I am asking.
>
> Thanks for your time and help
> Jennifer
>
> "Julie Meloni" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> > JD> Would someone kindly point me to a tutorial on designing a search
> script for
> > JD> mysql db.
> > JD> I have tried to build one but can't get anywhere with it.
> >
> > Well, that would depend on what and how you are searching, your table
> > structure, etc.  Essentially, every SELECT query is a "search".
> >
> > If you post more information about your table(s) structure, your
> > search methods and the search parameters, people would probably be
> > able to help you.
> >
> >
> > - Julie
> >
> > --> Julie Meloni
> > --> [EMAIL PROTECTED]
> > --> www.thickbook.com
> >
> > Find "Sams Teach Yourself MySQL in 24 Hours" at
> > http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20
> >
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re: [PHP-DB] Search tutroial

2002-04-24 Thread Jennifer Downey

This is basically what I am trying to do
if($search)
{
$query = "SELECT uid, id, image, iname, quantity, type FROM
{$config["prefix"]}_shop WHERE  iname = $shopsearch";
  $ret = mysql_query($query);
  while(list($quantity)=mysql_fetch_row($ret))

   $name = $row['user'];
   echo $name;

}else{

echo "";
echo "Search Shops";
echo "";

}

This is a dump of the table

uid int(10) NOT NULL default '0',
  id int(5) NOT NULL default '0',
  iname varchar(50) NOT NULL default '',
  image varchar(100) NOT NULL default '',
  quantity int(10) unsigned NOT NULL default '1',
  type varchar(20) NOT NULL default '',
  price int(6) NOT NULL default '0',
  user varchar(50) NOT NULL default '',
  KEY uid (uid)

Just a note this works throughout my site and I have no trouble with it:
{$config["prefix"]}_shop
I'm not trying to be rude but I get sick of it when people tell me that this
is the problem when it has nothing to do with the question I am asking.

Thanks for your time and help
Jennifer

"Julie Meloni" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> JD> Would someone kindly point me to a tutorial on designing a search
script for
> JD> mysql db.
> JD> I have tried to build one but can't get anywhere with it.
>
> Well, that would depend on what and how you are searching, your table
> structure, etc.  Essentially, every SELECT query is a "search".
>
> If you post more information about your table(s) structure, your
> search methods and the search parameters, people would probably be
> able to help you.
>
>
> - Julie
>
> --> Julie Meloni
> --> [EMAIL PROTECTED]
> --> www.thickbook.com
>
> Find "Sams Teach Yourself MySQL in 24 Hours" at
> http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002



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




Re: [PHP-DB] Search tutroial

2002-04-24 Thread Julie Meloni


JD> Would someone kindly point me to a tutorial on designing a search script for
JD> mysql db.
JD> I have tried to build one but can't get anywhere with it.

Well, that would depend on what and how you are searching, your table
structure, etc.  Essentially, every SELECT query is a "search".

If you post more information about your table(s) structure, your
search methods and the search parameters, people would probably be
able to help you.


- Julie

--> Julie Meloni
--> [EMAIL PROTECTED]
--> www.thickbook.com

Find "Sams Teach Yourself MySQL in 24 Hours" at
http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20


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




Re: [PHP-DB] Search tutroial

2002-04-24 Thread Dan Swensen

Getting a search function running perplexed me, too, until I looked at the 
MySQL docs. With the Full-Text Search function I got a search function 
working in minutes. 

http://www.mysql.com/doc/F/u/Fulltext_Search.html

Watch out for the weird bug that ignores duplicate rows, though. It can make 
for zero returns in small databases for no logical reason. That drove me nuts 
until I figured out why it was happening. (It's mentioned at the bottom of 
the docs.) 


> Hi all,
> 
> Would someone kindly point me to a tutorial on designing a search 
> script for mysql db. I have tried to build one but can't get 
> anywhere with it.
> 
> Thanks
> Jennifer
> 
> --
> The sleeper has awaken
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> 
> -- 
> 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




  1   2   >