Hello

I have to make a menu for a restaurant and I am kind of rookie at MySQL ..

The menu has to be 8 columns wide ( 1column + 7 days ) and 8 rows in height .

The problem is that it needs to be fully customisable , some cells having certain color and other stuff like that . So I can't use the table script i usually use .

I started this code , but got a problem . I don't know how to load a value from the database as variable in php .

I simplified the table so it's a lot easier to understand it .
Also , my database is currently set up like this :

ID.....POSITION......TEXT
1........r1c1............TEXT_r1c1
2........r1c2............TEXT_r1c2
.......
63.......r8c7............TEXT_r8c7
64.......r8c8............TEXT_r8c8

<?php 

include_once"config.php";

$query =  mysql_query("SELECT * FROM DB_NAME");
$r1c1 = $value1_from_db; <!-- TEXT_r1c1 -->
$r1c2 = $value2_from_db; <!-- TEXT_r1c2 -->
.....
$r8c8 = $value64_from_db;
?>

<table width="900" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td><? echo $r1c1 ?></td> <!-- Row 1 , column 1 -->
    <td><? echo $r1c2 ?></td> <!-- Row 1 , column 2 -->
    <td><? echo $r1c3 ?></td> <!-- Row 1 , column 3 -->
    <td><? echo $r1c4 ?></td> <!-- Row 1 , column 4 -->
    <td><? echo $r1c5 ?></td> <!-- ................ -->
    <td><? echo $r1c6 ?></td>
    <td><? echo $r1c7 ?></td>
    <td><? echo $r1c8 ?></td>
  </tr>
  <tr>
    <td><? echo $r2c1 ?></td>
    <td><? echo $r2c2 ?></td>
    <td><? echo $r2c3 ?></td>
    <td><? echo $r2c4 ?></td>
    <td><? echo $r2c5 ?></td>
    <td><? echo $r2c6 ?></td>
    <td><? echo $r2c7 ?></td>
    <td><? echo $r2c8 ?></td>
  </tr>
  <tr>
    <td><? echo $r3c1 ?></td>
    <td><? echo $r3c2 ?></td>
    <td><? echo $r3c3 ?></td>
    <td><? echo $r3c4 ?></td>
    <td><? echo $r3c5 ?></td>
    <td><? echo $r3c6 ?></td>
    <td><? echo $r3c7 ?></td>
    <td><? echo $r3c8 ?></td>
  </tr>
 <!-- Here are 5 more rows of 8 columns each -->
</table>

Thanks in advance for any hint or guide .

First store the $query results to an array using mysql_fetch_array() .. and just need to use the table field name for getting the data like
$result for getting the TEXT_r8c8 like values ...
and just put that in a while loop
while ( the selected query result in an array )
{
$r1c=$result;
// Rest display operation in table
}

Here I have added the sample code... for selecting the value and formatting table

$query=mysql_query("SELECT * FROM DB_NAME"));
$tablecolumn=1;
echo "<table width=\"900\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">
  <tr>";
while($result=mysql_fetch_array($query))
{
$r2c=$result['TEXT'];
if ($tablecolumn==8)
{
echo "</tr>
  <tr>
    <td>".$r2c."</td>";
}
else
{
echo "<td>".$r2c."</td>";
}
$tablecolumn=$tablecolumn+1;
}
echo "</tr></table>";

Tried it and it doesn't work .
I get the following output

<table width="900" border="1" cellspacing="0" cellpadding="0">
      <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
      <tr>
      <td></td></tr></table>

R1C5 for example is the cell from Row : 1 , Column : 5
R4C2 for example is the cell from Row : 4 , Column : 2

Hi It means $r2c=$result; statment is not storing the value from table.
If yout table filed name is "TEXT" try to change that to use some other name like "table_TEXT" ...

After that run the code and make sure values are getting from table...

Then using "order by" clause for field POSITION in mysql query statement for getting the values in desired for output in table ...