Return Row Info

wxdqz

New Member
I'm VERY new at this.

But I'm trying to figure out a way to query my MySQL database and print out the entire row of info.

The trouble is that I don't know how many rows there will be,
and currently it prints out every row of my database.


Here is the script I'm using:

From the webpage I pass?STATE=Alabama

function retrieveElement($state,$field) {
global $db;
$result = mysql_db_query ("MyDatabase","SELECT $field, state_info FROM MyTablespace");
while ($row = mysql_fetch_array ($result)) {
echo "state:".$row["state"]."<br>\n";
echo "state_info: ".$row["state_info"]."<br>\n";
}
}

What I get back is every entry for every state. (I have multiple entries for each state.)
 
Back
Top