Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dispalying results next to each other. 2

Status
Not open for further replies.

overyde

Programmer
Joined
May 27, 2003
Messages
226
Location
ZA
Hi,
There is 2 parts to my question:
1.How do I display results next to each other in a table. i.e. there is a result for each cell spanning 4 rows across and indefinite amount of rows down. (I'm using a paginate script as well)

2. When the user clicks on a link I need the relative info to open in a new page. How do I set up the link to fetch the relative info for that field as described above in the first question.

I'm using php4 and MySql.
Any ideas I'm going really bald from all the hair I'm pulling out!!!

Reality is built on a foundation of dreams.
 
a simple way would be to use the for loop.
$sql="SQL";
$rs=mysql_query($sql);
for($i=0;$i<mysql_num_rows($rs);$i++)
{
$row=mysql_fetch_row($rs);
echo &quot;<a href='linkpage.php?attrib=$row[ColumnNumber]'>$row[ColumnNumber1]</a><BR>&quot;
}

the ColumnNumber is the column number as per the query.

this wont create tables but will give u an idead atleast....

Known is handfull, Unknown is worldfull
 
Question 2 is a HTML question.
However, here's how you do it:
Code:
<a href=&quot;linkpage.php?attrib=...etc&quot; target=&quot;details&quot;>

The target attribute of the anchor tag send the output to a named window, which if not open is created. You can keep all links with the same target if you want all details to display in the same window. If you want a new window for each link use target=&quot;_blank&quot;.

Just a note to HTML: attributes within HTML tags should be i=enclosed in double quotes to validate as valid HTML.
 
Though the specs say otherwise, you can use single quotes in tags and it will still be recognised by virtually every browser out there. I use this sometimes when I want to do something like:

echo &quot;<input type='text' name='foo' value='$bar'>&quot;;

This will then pick up $bar
 
I think I didn't pose the 2nd question correctly.
I understand the html of opening a new window with the target command.

Say I have a table of pictures and each picture is a link to get the relevant information from its particular field from the database. When the user clicks on the picture I would like the relevant information to open in a new window. Would I have to use something like session variables or cookies to link it to that particular information?

Reality is built on a foundation of dreams.
 
overyde
There are several options:
1. Use a GET parameter to pass on the info to the receiving script.
2. Set a cookie with the desired information.
3. Use sessions

I always recommend sessions as the most efficient and reliable way.

KempCGDR
It is true that browsers recognize all different kinds of non-standard HTML, even invalid structures. That's a convenience, However, I believe it is valuable and a worthwhile effort to produce code and output that meets the requirements of established standards.

 
overdye:
my code prints links doesnt it?

Known is handfull, Unknown is worldfull
 
Sorry I was away will try your suggestions momentarily!

Reality is built on a foundation of dreams.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top