MySQL Forums
Forum List  »  PHP

Building a query to fetch an array SOLVED
Posted by: John Dow
Date: September 24, 2012 02:30PM

So this is a newbie question from a real newbie.

Im working with xampp (localhost server), php (phpMyAdmin), MySQL, jQuery

I have two PHP files built an index.php and data.php. I have created a webpage using html with a search box that grabs data from the database and uses impute data a retrieve data when a 'get' button is pressed. TThe data reurnted is the data they search (titled 'clli') and a related data(titled 'pointcode').

My issue is if the clli has multiple items that are the same , with different pointcodes, I cant may a mysql_fetch_array work. I have only been successful retreiving a single set of data.


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

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

if ($clli==NULL)
echo "Please enter an 11 digit CLLI code!";
$pointcode = mysql_query("SELECT pointcode FROM database1.tester1 WHERE clli='$clli'" );
$pointcode_num_rows = mysql_num_rows($pointcode);

if ($pointcode_num_rows==0)
echo "CLLI code does not exist!";
$pointcode = mysql_result($pointcode, 0);
echo "$clli = $pointcode";


Edited 1 time(s). Last edit at 09/25/2012 06:29PM by John Dow.

Options: ReplyQuote

Written By
Building a query to fetch an array SOLVED
September 24, 2012 02:30PM

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.