LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-27-2008, 01:47 PM   #1
texmansru47
Member
 
Registered: Jul 2004
Location: Texas
Distribution: CentOS 4.X
Posts: 42

Rep: Reputation: 15
Question How to hyperlink one field from the results of a php query


I have a query that is working. It places the data results in a table and looks great. The problem is I'm trying to hyperlink the results so the user can click on the correct data and the second phase of the operation can begin.

Here is a section of the print of the variables:

if ($results) { //this will check if the query failed or not
if (mysql_num_rows($results) > 0) { //this will check if results were returned
while($copy = mysql_fetch_array($results)) {
$variable1=$copy['1Num'];
$variable2=$copy['2Num'];
$variable3=$copy['3Num'];
//table layout for results

print ("<tr>");
print ("<td>$variable1</td>");
print ("<td>$variable2</td>");
print ("<td>$variable3</td>");
print ("</tr>"); }

I need to hyperlink only 1Num, so I tried the follow to no avail:

print ("<td><a href="2step.html">$variable1</td>");

I tried what I knew and it failed. I cannot find any data on this operation, so I hope it is possible.
 
Old 06-27-2008, 03:56 PM   #2
ddaemonunics
Member
 
Registered: May 2008
Location: Romania
Distribution: Debian
Posts: 242

Rep: Reputation: 41
First I think it's
print ("<td><a href="2step.html">$variable1</a></td>"); and not
print ("<td><a href="2step.html">$variable1</td>");

close the <a> tag

I dont usualy use print , I use echo but I think is
print ("<td><a href=\"2step.html\">$variable1</td>");

not sure on print so I may be wrong
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I'm trying to get PHP to filter results from a MySQL query!!! Tom "Techno" Earl Programming 4 07-18-2011 06:49 AM
how to show results of a php query from a form on the main form texmansru47 Programming 2 06-27-2008 01:26 PM
PHP: build query from form entry, then display results in the same form tonedeaf1969 Programming 4 06-22-2007 07:55 AM
PHP show query results Gerardoj Programming 1 05-11-2004 12:31 PM
Mysql/PHP query problem with datetime field. Pcghost Programming 2 11-11-2003 12:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration