MySQL Forums
Forum List  »  PHP

Re: Building a query to fetch an array
Posted by: John Dow
Date: September 25, 2012 06:28PM

DING,DING,DING,DING...WINNER!!!

This worked. The final code looks like this:

<?php

mysql_connect("localhost", "root", "");

$clli = mysql_real_escape_string($_POST['clli']);

if ($clli==NULL)
echo "Please enter an 11 digit CLLI code!";
else
{
$pointcode = mysql_query("SELECT pointcode FROM database1.tester1 WHERE clli='$clli'" );
// $pointcode will be false, or a resource

$pointcode_num_rows = mysql_num_rows($pointcode);

if ($pointcode_num_rows==0)
echo "CLLI code does not exist!";
else
{
while ($row = mysql_fetch_array($pointcode)) {
echo "$clli = {$row['pointcode']}<br>";
}
}

}

?>

Options: ReplyQuote


Subject
Written By
Posted
Re: Building a query to fetch an array
September 25, 2012 06:28PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.