So I want to be able to get information from MySQL. In my PHP code, I call the query and echo the info in this sort of fashion:
$sql = "SELECT * FROM `person`";
$rs = $COMMON->executeQuery($sql, $_SERVER["SCRIPT_NAME"]);
while($row = mysql_fetch_row($rs)){
echo ("Name: ".$row['name']."<br />";
echo ("Gender: ".$row['gender']."<br />";
echo ("Age: ".$row['age']."<br />";
};
Though, the actual value of $row['name']
and the rest is completely blank. Not even a single space. Though, when I call it by the actual column index like so $row[1]
, it gives me the right value.
So, for example, lets say this had three person in the table. The end result page would look like this:
Name:
Gender:
Age:
Name:
Gender:
Age:
Name:
Gender:
Age:
Is something I'm doing wrong? Why is it giving me this empty string instead of the query value?
MySQL database is saved on MyPHPAdmin. I don't know if it makes a difference or not. If there is anymore information missing that you deem necessary, please let me know. Thanks!