I'm trying to go to my DB, get info from a bunch of columns based on two variables, and return all the values of all of those columns into a php list (or array), so for example, the final result would be something like $output = array($foo,$bar,$hello);
Here is the code I have right now to connect to the DB and my query, I know I am missing the vital code here, hoping someone can help me, thanks.
<? php
$var1 = 20.0;
$var2 = 15.0;
function getFromDB($var1, $var2){
mysql_connect("localhost", "test", "test") or die (mysql_error());
mysql_select_db("test") or die(mysql_error());
$queryString = "SELECT * from table1 WHERE foo=".$var1."AND bar=".$var2;
$go = mysql_query($queryString);
while($row = mysql_fetch_array($go)){
echo $row['col1'];
echo $row['col2'];
echo $row['col3'];
}
}
getFromDB($var1,$var2);
?>
The idea is to have the values of col1, 2, and 3 in an array. Thanks! Sam