function getTableData($table){}
Posted: Sun Dec 22, 2013 7:53 am
hey guys..
Im trying to create a function that gets any table's data.. I dont seem to code it logically..
I need help with the logic of replacing $row[0] / $row[1] for something more dynamic based on the table's row number.. and I can't seem to figure it out..
any tips would be much appreciate it!
Im trying to create a function that gets any table's data.. I dont seem to code it logically..
Code: Select all
function getTable($table)
{
//fetch data
$sql = "SELECT * FROM " . $table;
$q = mysql_query($sql);
while($row = mysql_fetch_array($q))
{
echo $row[0] . "<br>";
echo $row[1] . "<br>";
}
}
any tips would be much appreciate it!