Jump to content

Recommended Posts

Posted (edited)

Hi im trying to make a small kind of "eshop" not for a speciall reason.Anyways i got a table that contains

 

username - password-Gender im inserting there the following :---

 

- firstname-lastname-gender.

 

i want my results preview be 4 adds in a row no all together for example for the data(im using the same names now just for faster):

 

1)nick rayton,Male

2)nick rayton,Male

3)nick rayton,Male

4)nick rayton,Male

5)nick rayton,Male

 

not to preview like this but like :

 

1)nick rayton 2)nick rayton, 3)nick rayton 4)nick rayton

Male Male Male Male

 

5)nick rayton 6)nick rayton, 7)nick rayton 8)nick rayton

Male Male Male Male

 

 

im using this code to extract a row

 

<?php

$count = 0;

while($row = mysql_fetch_array($strquery))

{

$count++;

extract($row);

 

if($count < 5)

{

echo "

$username $password $Gender\n";

}

else if ($count == 4)

{

echo "

";

$count = 1;

}

}

 

 

so what im understanding doing that is print username password gender 4 times in one row and when the count be 4 what i want "to have only 4 at the first row go at second row or third row)

 

if somone can help with that. :).That code can only result all things in td td td td for a reason.

 

SORRY FOR MY BAD LANG thank you

Edited by killingbegin
Posted

<?php

$columns = 4;

$col = 0;

while($row = mysql_fetch_array($strquery)) {

if ($col == $columns) {

$col = 0;

}

if ($col == 0) {

?>

<?php

}

?>

$username $password $Gender

<?php

$col = $col+1;

if ($col == $columns) {

?>

<?php

}

}

?>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...