Rows And Columns

Apr 28, 2006

Have a look at the attached code. This is basically a script calling some records from a table "id" and "description". This displays the records 1 per row.

$q = mysql_query("select * from table");
$r = mysql_query($q) or die();
while($row = mysql_fetch_assoc($r)){
print "<a href='product.php?id=$row[id]'>$row[description]</a><br/>";

View 12 Replies


Tables Row And Columns - Display 3 Rows Instead Of Fixed 2 Rows?

I have a small page of php page which grab my images from the SQL tables and display them in a page. The problem now is that the output display only display 3 columns and 2 rows. I want to make it to display 3 rows but it just wont work. How can I modify the script to display 3 rows instead of fixed 2 rows? Below is the php page which Im trying to edit,

$link = DB_connect();
$thumb_width = 230;
$rows = 3;
$cols = 3;
// pagination part 1
$TotalToShow = $rows * $cols;
$StartLimit = 0;

View 1 Replies

Querying All Rows Under Certain Columns

what would my query and loop look like as I am not very good with loops and what not....

View 14 Replies

Rows And Columns Filled

I have to use <tr></tr> tags for the beginning and end of each row, but how would I put this into my results? The problem being that my results are part of a loop. This is what I have.

$result = mysql_query("select membername from whatever limit 0,10") ;
while ($row = mysql_fetch_array($result)){
$membername= $row["membername"];
$sql =mysql_query("SELECT * FROM images WHERE membername = '$membername' ");
$img_info = mysql_fetch_array($sql);
echo "<td>";
echo "<a href=photopage.php?profile=$membername>";
echo img_tag($img_info["img_file"], array("x"=>"100", "y"=>"100"));
echo "<br>";
echo "$memberrname";
echo "</a>";
echo "<td>";

View 2 Replies

Format Rows And Columns?

I have a table like this as below,

Dept - Names
ECE - Mark
ECE - Kris
ECE - Chris


I want to arrange this table as below using php code

------- ------ --------
Mark Ben Marc
Kris Chris Math
Chris Sara

how do I achieve this using php code

View 3 Replies

Add Rows - Columns Dynamically?

how i add and delete rows,and columns(textbox,dropdown) dynamically onclick button and store data in database with insert,update,delete record.that support all browsers.Because i am facing problem with IE & mozilla at the time of insert & update record.

View 1 Replies

Break Rows Into Columns

I am trying to figure out how to use loops to echo html table row close and open tags in order to break a long list of rows into columns. Unfortunately I'm failing miserably. I'm hoping someone here can look at my code and notice what I'm doing wrong. I've been trying to figure it out for hours...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="">
<title>Mobile Phones</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />

View 1 Replies

Images In Rows Not Columns

I am pulling images from my database and am going to display all images from an artist on one page. What I want to be able to do is to display them in rows of 4 and however many columns that are needed.

$result2 = mysql_query("SELECT * FROM image WHERE artid LIKE '$search' ORDER BY title") or die(mysql_error());
if ($num_rows != "0")
$count = count(0);
while ($r=mysql_fetch_array($result2))

View 2 Replies

Get 4 Columns And 10 Rows To Appear On Each Page

I have a page that has 10 rows appear on it, but I also want 4 columns (not just 1). I was wondering if someone could tell me how I can go about and get 4 columns and 10 rows to appear on each page. Code:

View 3 Replies

Display The Rows As The Columns

In pagination of column wise I want to display the rows as the columns. The page slicing is correct but all the data is displayed in page1. In page2 and page 3 it is blank.

foreach($data as $line){
foreach($text_line as $text){

View 3 Replies

Displaying Rows Of Data As Columns?

Does anyone know of an efficient way to retreive data from a mysql db
and display the record rows as collumns?

I have been doing this:
<display headers>
<while ($row = mysql_fetch_array($result)) { >
<display row 1 of result>
<display row 2... } >
<end table>

but I want to do this instead:
<col 1 header > <row 1 col 1> <row 2 col1> <row3 col1>
<col 2 header> <row 1 col 2> <row 2 col2> <row3 col2>
<col 3 header> <row 1 col 3> <row 2 col3> <row3 col3>

View 1 Replies

Pagination - Multiple Rows And Columns

i would like to paginate a set of results. i would like 12 results per page, ideally 4 columns over 3 rows. i can do the pagination and rows part no problem but am struggling with writing the columns. could any point me to a good tutorial or provide some sample code?

View 1 Replies

Table Results Columns Rows

I am having trouble implementing my coding to work with the desired results. I am calling up a total of ten thumbnail images to appear in a table. I would like these to be in two rows of five.

The code below will produce the thumnail images in a table, but all ten are in one row. How can I break this up so that after five images it will start a new row? Here is the code I am using now to show the thumbnails. Code:

View 3 Replies

Displaying Data 3 Columns By 10 Rows?

I am working on a script just now and I am trying to get products to display in a table which is 3 columns by 3 rows. Potentially I will want to increase the rows to 10. So far it displays in 3 colums and 1 row, but as you can see I am passing 9 Featured products in to a function. I have tried to increase the counter in the while loop: while($x!=3) to 9, what happens is the column increase, but the rows don't. For further information, I am just creating the featured products manually until I have time to figure out a better way to do it ie:

$game[0] = new featuredProduct('xyz','3558');
$game[1] = new featuredProduct('abc','3144');
$game[2] = new featuredProduct('123','6264');


View 3 Replies

Create 3 Columns Table With 5 Rows?

I am trying to create a 3 column table, where each row will contain 3 'cells' which each contain the following info for a product - Product Name, Description, Product Link, Image and Price - so, in a 3x3 table I would have 9 products. I only started to look at MySQL and PHP less than 5 days ago, so it's been an incredibly steep learning curve but have come to a bit of a halt...spent hours playing with code I have come across on the web and reading various tutorials but still struggling big time...managed to do everything myself so far Here is php code I have...

mysql_connect("xx", "xx", "xx") or die(mysql_error());
mysql_select_db("xx") or die(mysql_error());


View 3 Replies

Show Data In Rows Instead Of Columns?

I want to show data by rows, for eg. row1, 2, 3, 4, 5, 6, 7, 8, 9 then next column then continue again with row1, 2, 3, 4 5 etc in a table. I am not able to do it.


How to do it row wise instead of col.

View 11 Replies

Change Table From Rows To Columns?

I don't know exactly how to describe what I'm trying to do. I have a table that has several columns, they are

item, location, onhandqty

I have about 20 different locations for each item and I want to change this to

item, location1onhand, location2onhand, location3onhand, location4onhand....

View 3 Replies

Flip The Rows And Columns Of A 2D Array?

Normally I'd be asking how to turn something like this:

1 2 3
4 5 6
7 8 9
10 11 12

Into this:

1 4 7 10
2 5 8 11
3 6 9 12

But actually I want to turn it into this:

1 5 9
2 6 10
3 7 11
4 8 12

In other words, I want to flip the rows and columns, but keep the same "width" and "height" of the new array. I've been stuck on this for over an hour.

This is the function I'm using to do a normal "flip" (the first example):

function flip($arr)
$out = array();
foreach ($arr as $key => $subarr)
foreach ($subarr as $subkey => $subvalue)


View 2 Replies

Items And Rows Returned The Columns?

I have 2 tables Customer:customerid-int, pri-key,auto



I need a sql query which will get me all items for a given customer including some customer details, specifically:fname+sname+type+collectiondate+releasedate+housenum+streetname.for example, if joe bloggs has 5 items then 5 rows will be returned and the columns.

View 3 Replies

Easiest Way To Sum Columns And Rows Of A Table Apart From Using SUM(x)?

i have a really complex query (mysql + php) and i would like to know the easiest way to sum columns and rows of a table apart from using SUM(x).

View 3 Replies

Pagination :: Rows In Two Columns On One Page

I want to be able to paginate my rows in two columns on one page i.e.

Column 1 Column 2
row 0    row 5
row 1    row 6
row 2    row 7
row 3    row 8
row 4    row 9

<<Prev 12345 Next>>

This is the code I use. I found it and on Google, tweaked it and it works great.


include 'dbmembers.php'; 

View 7 Replies

Display Data In Columns Of 4 And Repeat Rows

What I would really like for it to do is display the results across 4 cells and then start on the next row and so on. Code:

View 4 Replies

Dyanically Create Table Rows And Columns

I'm trying to create a day view for my calendar. I need to have time slots table rows and the columns need to be the roomnames, which are stored in my db.

I would like to query my events db and dynamically build a table shading the tables different colours dependant upon room usage.

I have attached screenshot of how I would like the page to look. Can anybody tell me how I can dynamically create rows and columns to create a table?

View 3 Replies

Arrays - Divide Rows From Db Against Fixed <li> Columns?

I've got rows coming in from a db and what I want to do is divide that into 5 columns. This is what I have, it only shows 4 columns and well I'm stuck..$result is the array containing the db rows.


Note: what comes in from the db could range from 0 to 100 rows. But it must always be divided in 5 columns.

View 1 Replies

Dynamically Load A <ul> And Sort Into Columns Of 5 Rows?

I thought i would put this one out there. I have a list of 25 entries in my db which I would like to display on my page, in list form, in 5 columns with 5 rows. I prepared a solution, albeit not such an elegant one.

$query = "SELECT * FROM city ORDER BY name ASC";
$result = mysql_query($query, $connection);

View 5 Replies

Delete Rows From A Table Where One Of The Columns Contain No Data?

I am trying to delete rows from a table where one of the columns contain no data. I tried this:

delete from tablename where response column is null;

or tried this too:

delete from tablename where tablename.column is null;

didnt give error but when I checked my table I saw that it didnt delete those rows that has empty fields under that column.

WHen I checked my table structure, I saw that for that column I had put varchar(7) for data type and no to null.

Is it not working because I marked that column as no to null when I was creating the table? If so, what are the empty cells in that column considered? And how can I delete the rows that contain those empty cells?

View 2 Replies

Copyrights 2005-15, All rights reserved