Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualCJ_COIMBRA

Posted 25 August 2013 - 05:55 PM

Say that your table has 3 columns and you want to list all entries separated by a ',' and break a line after each entry:

$query = "SELECT * FROM sport";
$result = mysql_query($query);
$foundResults = mysql_fetch_array($result);
if(mysql_error())
{
    echo 'Error in query [' . mysql_error() . ']<br>';
}
else if ($foundResults == NULL)
{
    echo 'No results.<br>';
}
else
{
    do
    {
       echo $foundResults[0] . ', ' . $foundResults[1] . ', ' . $foundResults[2] . '<br>';
    } 
    while(($foundResults = mysql_fetch_array($result, MYSQL_NUM)) != NULL);
}

Hope that helps.


#1CJ_COIMBRA

Posted 25 August 2013 - 05:54 PM

Say that your table has 3 columns and you want to list all entries separated by a ',' and break a line after each entry:

$query = "SELECT * FROM sport";
$result = mysql_query($query);
$foundResults = mysql_fetch_array($result);
if(mysql_error())
{
    echo 'Error in query [' . mysql_error() . ']<br>';
}
else if ($assetsEncontrados == NULL)
{
    echo 'No results.<br>';
}
else
{
    do
    {
       echo $foundResults[0] . ', ' . $foundResults[1] . ', ' . $foundResults[2] . '<br>';
    } 
    while(($foundResults = mysql_fetch_array($result, MYSQL_NUM)) != NULL);
}

Hope that helps.


PARTNERS