Forum Moderators: coopster

Message Too Old, No Replies

Getting lost with results layout

How to display results correctly with table headers

         

pixeldiver

6:39 am on Jun 30, 2009 (gmt 0)

10+ Year Member



Yes, I'm still around, this time I'm playing around with layout and results.
My aim is to have the following layout:

Title BEAM
image1, image2, imgage3 ...image6

Title TUBULAR
image7, image8, image8 ...image12

Title SYMMETRIC
image13, image14, image15...image18

....and so on

What would be the easiest way to do this?

Second problem: my query doesn't return the first id from mysql. I can't figure out what it could be, possibly something wrong with my query?

//THE QUERY:

$a = '';
$i = '';

if (isset ($_POST['application'])) {
$a = mysql_real_escape_string($_POST['application']);
}
if (isset($_POST['installation'])) {
$i = mysql_real_escape_string($_POST['installation']);
}

mysql_select_db($database_qmi, $qmi);
$query = "SELECT type, search_id, img_link_beam, img_link_tubular, img_link_symmetric, img_link_asymmetric, img_link_modular FROM searchmatrix WHERE application_type LIKE'%{$a}%' AND installation_type LIKE'%{$i}%'";
$result = mysql_query($query, $qmi) or die(mysql_error());
$row = mysql_fetch_assoc($result);
$totalRows = mysql_num_rows($result);
?>

//THE RESULTS:

<?php while ($row = mysql_fetch_assoc($result)) { ?>
---- I want to appear a title like BEAM here ----
<?php echo $row['img_link_beam'];
---- another title here ----
echo $row['img_link_tubular'];
echo $row['img_link_symmetric'];
echo $row['img_link_asymmetric'];
echo $row['img_link_modular'];}
?>

Cheers and thanks for any help (this is driving me crazy)

jatar_k

1:34 pm on Jun 30, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you do get the first row but you do it in the wrong place

$result = mysql_query($query, $qmi) or die(mysql_error());
$row = mysql_fetch_assoc($result);
$totalRows = mysql_num_rows($result);

remove the bolded line

as for the layout, I am not really getting the problem as it's unclear what you are trying to go from/to.