I need your help with display of some comma separated enteries from my database.
My main table schema looks like this
|---|----------|-----------|----------------------------|
|id | tab1 | tab2 | tab3 |
|---|----------|-----------|----------------------------|
|1 | state1 | A-North | constA1,constA2,constA3 |
|2 | state2 | B-South | constB1,constB2,constB3 |
---------------------------------------------------------
Query I'm trying to make work
$query = mysql_query("SELECT * FROM `main` WHERE `tab1` = '$tab1'")
or die(mysql_error());
while($row=mysql_fetch_array($query)){
$tab3 = explode(",", $row['tab3']);
echo $tab3."<br>";
}
What I want to display from the database
A-North B-South
---------------------
constA1 constB1
constA2 constB2
constA3 constB3
Error I'm getting when I run that query is "Array" . When I run the same code from phpMyAdmin, I get the desired rows (result).
htmlentitiesandmysql_real_escape_string.)