Hey,
I am trying to display my mysql data into a table that is 3 wide in php.
here is the php I have been using:
[php]<?php
// set database server access variables:
$host = “localhost”;
$user = “root”;
$pass = “”;
$db = “product_index”;
// open connection
$connection = mysql_connect($host, $user, $pass) or die (“Sorry error!: (unable to connect)”);
// select database
mysql_select_db($db) or die (“Sorry error!: (unable to select database)”);
// create query
$query = “SELECT * FROM products WHERE type = ‘bracelets’”;
// execute query
$result = mysql_query($query) or die ("Sorry error!: in query: $query. ".mysql_error());
define(‘COLS’, 3); // number of columns
$col = 0; // number of the last column filled
echo ‘
’; echo ‘ ’, $rows[2], ‘ ’, $rows[0],’ ’, $rows[4],‘ More info’, ‘ | ’;
// free result set memory
mysql_free_result($result);
// close connection
mysql_close($connection);
?>[/php]
The issue is: it looks like this:
| item1 | item2 |
| item3 | item4 |
| item5 | item6 |
Why isn’t it 3 wide?
Thanks in advance.
–