------=_NextPart_000_0037_01CBC9FC.8C29EAD0
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
I am just starting to use Prepared Statements and am in a learning =
curve.
I am working on the code below. It is for a directory. This is to =
select the listing for updating.
How do I tell if there are more than 1 search result?
Am I correctly retrieving the results, if there is more than 1?
I want to make a WHILE loop to display the search results for the =
listing the user is editing. (You can see where I have started the <ul> =
.... </ul> ... I want that area in the loop)
Ron
$dbh =3D new PDO($dsh, $username, $password);
$stmt =3D $dbh->prepare("SELECT `reference`, `organization`, `city`, =
`province_state`, `postal_zip_code`, `country` FROM `ministry_profiles` =
WHERE ( `reference` =3D :organization_reference ) OR ( `organization` =
LIKE %:organization_name% ) OR ( `telephone` LIKE %:organization_phone% =
) OR ( `toll_free` LIKE %:organization_toll_free_phone% ) ORDER BY =
`organization` ASC");
$stmt->bindParam(':organization_reference', $organization_reference, =
PDO::PARAM_STR);
$stmt->bindParam(':organization_name', $organization_name, =
PDO::PARAM_STR);
$stmt->bindParam(':organization_phone', $organization_phone, =
PDO::PARAM_STR);
$stmt->bindParam(':organization_toll_free_phone', $organization_phone, =
PDO::PARAM_STR);
$stmt->execute();
$result =3D $stmt->fetch(PDO::FETCH_ASSOC);
echo "<ul>\r\n";
$search_result_organization_reference =3D $result['reference'];
$search_result_organization =3D $result['organization'];
$search_result_city =3D $result['city'];
$search_result_province_state =3D $result['province_state'];
$search_result_postal_zip_code =3D $result['postal_zip_code'];
$search_result_country =3D $result['country'];
echo "<li><strong>" . $search_result_organization . "</strong> (Ref: =
" . $search_result_organization_reference . ")
\r\n";
echo $search_result_city . ", " . $search_result_province_state . " " . =
$search_result_country . " " . $search_result_postal_zip_code . =
"</li>\r\n";
echo "</ul>\r\n";
The Verse of the Day
=E2=80=9CEncouragement from God=E2=80=99s Word=E2=80=9D
http://www.TheVerseOfTheDay.info
------=_NextPart_000_0037_01CBC9FC.8C29EAD0--
