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