Record retrieval using two fields

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rfigley
Forum Commoner
Posts: 70
Joined: Sun Apr 21, 2002 7:10 pm

Record retrieval using two fields

Post by rfigley »

I'm currently using this query to retrieve a record to be deleted:

Code: Select all

<?php

$query = ("select * from tbl_members where phone = '$phone'");

?>
However I need to query for an additional field "chapter" to prevent multiple record retrieval. What is the correct syntax for this?
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

Do you mena like this?

Code: Select all

<?php
$query = ("select * from tbl_members where phone = '$phone' AND chapter = '$whatever'");
?>
rfigley
Forum Commoner
Posts: 70
Joined: Sun Apr 21, 2002 7:10 pm

Post by rfigley »

Sorry, no I need a record that queries tbl_members where phone = number and tbl_chapter where chapter_name = chapter
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

Code: Select all

SELECT * FROM tbl_members WHERE tbl_members.phone = $number AND tbl_chapter.chapter_name = $chapter
Post Reply