Page 1 of 1

Querying The Database

Posted: Sat Apr 20, 2002 1:10 am
by gazkee
Help Anybody :roll: I'm designing a database(db) driven webpage using PHP and MYSQL. The webpage has 5 frames, and from the headerFrame I'm wanting to run a query from a table in the db and have the results appear in the mainFrame. eg Search by Artist Name, Song Title or Album, and have results appear below the search options in mainFrame. How would I script this using PHP and MYSQL :?:

Posted: Sat Apr 20, 2002 3:20 am
by hex
That would be a bit difficult to do as the 5 frames (pages) are all independant of each other.

Instead, put all your database info into one file and include() it into each page.

Posted: Sat Apr 20, 2002 3:45 am
by gazkee
Sweet, will give it a go :?

Search Near/Like Function

Posted: Mon Apr 29, 2002 11:36 pm
by gazkee
When querying the database for near results what is the function for this, eg: when querying the database for an exact phone number I would use:

Code: Select all

$query="SELECT * FROM requestee WHERE phone ='$phone'";
but I would like to be able to query the database for phone numbers that are like the numbers entered on the website form.. eg entered phone number: 12345, and in database would be 12346, 12345, 23456, 23487. so I would want the phone numbers that are like the entered number displayed on the website form.. Appreciate the feedback..

Posted: Tue Apr 30, 2002 1:36 am
by nahp
i don t know how to get numbers that look like a given one
but you can get numbers containing a certain part:

SELECT * FROM requestee WHERE phone like '%$phone%'

so if $phone is 234, you ll get 1234, 2345 , 13234, 11234546, ...
you ll get any number containing 234 in it