Querying The Database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
gazkee
Forum Newbie
Posts: 5
Joined: Sat Apr 20, 2002 1:10 am
Location: New Zealand

Querying The Database

Post 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 :?:
User avatar
hex
Forum Commoner
Posts: 92
Joined: Sat Apr 20, 2002 3:20 am
Location: UK

Post 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.
gazkee
Forum Newbie
Posts: 5
Joined: Sat Apr 20, 2002 1:10 am
Location: New Zealand

Post by gazkee »

Sweet, will give it a go :?
gazkee
Forum Newbie
Posts: 5
Joined: Sat Apr 20, 2002 1:10 am
Location: New Zealand

Search Near/Like Function

Post 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..
nahp
Forum Newbie
Posts: 7
Joined: Mon Apr 22, 2002 3:24 am

Post 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
Post Reply