Re: [PHP-DB] Query's

2003-09-30 Thread Nitin
What you'll have to do is, first show those drop down menus and then call
your php script, c the attachment for exact help.

Enjoy
Nitin

- Original Message - 
From: Andrew R [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, September 30, 2003 3:31 AM
Subject: [PHP-DB] Query's


 Howdy List,

 I am a little confused in incorporating a drop down menu into my select
 statement.
 I have a very simple 1 table database that contains my DVD collection.

 Right now - very simply it connects to the database, and then produces
 the results of the search based on a

 ?
   mysql_connect(localhost,name,password);
   mysql_select_db(oldmovies);
 $result = mysql_query (SELECT * FROM movies);

 while($r=mysql_fetch_array($result))
   {
 $movie_number=$r[movie_number];
 $movie_name=$r[movie_name];
 $genre=$r[genre];
 $star1=$r[star1];
 $star2=$r[star2];
 $star3=$r[star3];
 $director=$r[director];
 $brief_synopsis=$r[brief_synopsis];
 $imdb_link=$r[imdb_link];


 ?
 This then produces the results onto the page in the tables that I have
 formatted.


 This was fine when I only had 50 or so dvd's - I am nearing the 500
 mark, and it is WAY past time to add a search

 This is where I get lost.

 I can get into mysql monitor, and I can pull out using SELECT * FROM
 movies WHERE genre LIKE ***
 And then I have a selection of Genre's that I can enter to generate the
 results.

 What I am trying to do is incorporate some selection drop down menus
 that would make the search process easier.

 Example: search for movies where {dropdown1} is {equal or like}
 Dropdown 1 would be my first criteria: movie name, director, lead actor,
 genre.
 The equal or like would be a standard textfield to be filled in.

 I hope that I am making sense here.

 If anybody can shed some light onto a confused newbie (the php script
 above was written at my old place of employment for me - otherwise I
 could ask them) it would be greatly appreciated.

 Thank you
 Andrew

 --

 Come to the edge, Life said.
 They said: We are afraid.
 Come to the edge, Life said.
 They came.
 It pushed them...and they FLEW.
 -Guillaume Apollinaire 1870-1918
 ---
 Once you have tasted flight,
 you will walk the earth with your eyes turned skyward,
 for there you have been and there you long to return.

 -- 
 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] Query's

2003-09-30 Thread Nitin
HTML File

html
body
form action=/some/path/script.php3
Select genre: select name=genre
option value=genre1Genre 1/option
---
-
--
/select
select name=style
option value=likeLike/option
option value=EqualExact/option
/select
/form
/body/html


PHP Script:
?php
if($style='Equal')
 $op='=';
else
 {
 $op='like';
 $genre = '%'.$genre.'%';
 }

mysql_connect(localhost,name,password);
mysql_select_db(oldmovies);
$result = mysql_query (SELECT * FROM movies where genre $op '$genre');

 while($r=mysql_fetch_array($result))
   {
 $movie_number=$r[movie_number];
 $movie_name=$r[movie_name];
 $genre=$r[genre];
 $star1=$r[star1];
 $star2=$r[star2];
 $star3=$r[star3];
 $director=$r[director];
 $brief_synopsis=$r[brief_synopsis];
 $imdb_link=$r[imdb_link];
   }
?



- Original Message - 
From: Nitin [EMAIL PROTECTED]
To: Andrew R [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, September 30, 2003 12:21 PM
Subject: Re: [PHP-DB] Query's


 What you'll have to do is, first show those drop down menus and then call
 your php script, c the attachment for exact help.

 Enjoy
 Nitin

 - Original Message - 
 From: Andrew R [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, September 30, 2003 3:31 AM
 Subject: [PHP-DB] Query's


  Howdy List,
 
  I am a little confused in incorporating a drop down menu into my select
  statement.
  I have a very simple 1 table database that contains my DVD collection.
 
  Right now - very simply it connects to the database, and then produces
  the results of the search based on a
 
  ?
mysql_connect(localhost,name,password);
mysql_select_db(oldmovies);
  $result = mysql_query (SELECT * FROM movies);
 
  while($r=mysql_fetch_array($result))
{
  $movie_number=$r[movie_number];
  $movie_name=$r[movie_name];
  $genre=$r[genre];
  $star1=$r[star1];
  $star2=$r[star2];
  $star3=$r[star3];
  $director=$r[director];
  $brief_synopsis=$r[brief_synopsis];
  $imdb_link=$r[imdb_link];
 
 
  ?
  This then produces the results onto the page in the tables that I have
  formatted.
 
 
  This was fine when I only had 50 or so dvd's - I am nearing the 500
  mark, and it is WAY past time to add a search
 
  This is where I get lost.
 
  I can get into mysql monitor, and I can pull out using SELECT * FROM
  movies WHERE genre LIKE ***
  And then I have a selection of Genre's that I can enter to generate the
  results.
 
  What I am trying to do is incorporate some selection drop down menus
  that would make the search process easier.
 
  Example: search for movies where {dropdown1} is {equal or like}
  Dropdown 1 would be my first criteria: movie name, director, lead actor,
  genre.
  The equal or like would be a standard textfield to be filled in.
 
  I hope that I am making sense here.
 
  If anybody can shed some light onto a confused newbie (the php script
  above was written at my old place of employment for me - otherwise I
  could ask them) it would be greatly appreciated.
 
  Thank you
  Andrew
 
  --
 
  Come to the edge, Life said.
  They said: We are afraid.
  Come to the edge, Life said.
  They came.
  It pushed them...and they FLEW.
  -Guillaume Apollinaire 1870-1918
  ---
  Once you have tasted flight,
  you will walk the earth with your eyes turned skyward,
  for there you have been and there you long to return.
 
  -- 
  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] Query's

2003-09-29 Thread dpgirago
Are you asking for help with the query, or with having the query populate 
a select box? If you are planning to be able to manually enter search 
criteria, then you do not want a select box, you want a text type input. 

David





Andrew R [EMAIL PROTECTED]

09/29/2003 05:01 PM



 

To:
[EMAIL PROTECTED]
cc:





Subject:
[PHP-DB] Query's



Howdy List,

I am a little confused in incorporating a drop down menu into my select
statement.
I have a very simple 1 table database that contains my DVD collection.

Right now - very simply it connects to the database, and then produces
the results of the search based on a

?
  mysql_connect(localhost,name,password); 
  mysql_select_db(oldmovies);
$result = mysql_query (SELECT * FROM movies);

while($r=mysql_fetch_array($result))
  {
$movie_number=$r[movie_number];
$movie_name=$r[movie_name];
$genre=$r[genre];
$star1=$r[star1];
$star2=$r[star2];
$star3=$r[star3];
$director=$r[director];
$brief_synopsis=$r[brief_synopsis];
$imdb_link=$r[imdb_link];


?
This then produces the results onto the page in the tables that I have
formatted.


This was fine when I only had 50 or so dvd's - I am nearing the 500
mark, and it is WAY past time to add a search

This is where I get lost.

I can get into mysql monitor, and I can pull out using SELECT * FROM
movies WHERE genre LIKE ***
And then I have a selection of Genre's that I can enter to generate the
results.

What I am trying to do is incorporate some selection drop down menus
that would make the search process easier.

Example: search for movies where {dropdown1} is {equal or like}
Dropdown 1 would be my first criteria: movie name, director, lead actor,
genre.
The equal or like would be a standard textfield to be filled in.

I hope that I am making sense here. 

If anybody can shed some light onto a confused newbie (the php script
above was written at my old place of employment for me - otherwise I
could ask them) it would be greatly appreciated.

Thank you
Andrew

--

Come to the edge, Life said. 
They said: We are afraid. 
Come to the edge, Life said. 
They came. 
It pushed them...and they FLEW. 
-Guillaume Apollinaire 1870-1918
---
Once you have tasted flight, 
you will walk the earth with your eyes turned skyward, 
for there you have been and there you long to return. 

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