Greetings friends. Please help me to understand this issue.

1 echo"<tr><td>< a href=\"home.php?num=$num\">$num</a></td><tr> 
   2    echo"<tr><td>$num</td></tr>";

Basically i wanted to have link for variable $num. I couldn't proceed because of following issue. However second command worked fine for me.

issue : first echo returns below mentioned output.

< a href="home.php?num=23434">23434

second echo returns correct output value 23434.
question: Please make necessary changes to get link with first echo command. Thanks

Try
close your first echo with a quote and semi colon

As fobos mentioned, the first line's syntax needs to be corrected to include a quotation mark and semicolon at the end of that line.

<?php
$num = 23434; 
echo "<table>";
echo "<tr><td><a href=\"home.php?num=$num\">$num</a></td><tr>";
echo "</table>";
?>

code mentioned by you works fine. But i couldn't get the desired result for this...

echo"<table width=\"85%\"  align=center  border=1>";
             echo "<tr><td>Settlement Number</td><td>FirstParty</td><td>SecondParty</td><td>Email</td><td>Phone</td><td>Created Date</td></tr>";
             while($row=mysql_fetch_array($sql))
             { $num=$row['num'];
               $firstparty=$row['firstparty'];
               $secondparty=$row['secondparty'];
               $partyemail=$row['partyemail'];
               $phone=$row['phone'];
               $idate=$row['idate'];

             echo "<tr><td><a href=\"home.php?num=$num\">$num</td><td>$firstparty</td><td>$secondparty</td><td>$partyemail</td><td>$phone</td><td>$idate</td></tr>";
            }
                echo"</table>";

issue: table with all fields except $num is getting displayed. entire column settlement Number($num) is blank and no errors

Sorry friends. please ignore my previous code and refer below code

 echo"<table width=\"85%\"  align=center  border=1>";
             echo "<tr><td>Settlement Number</td><td>FirstParty</td><td>SecondParty</td><td>Email</td><td>Phone</td><td>Created Date</td></tr>";
             while($row=mysql_fetch_array($sql))
             { $num=$row['num'];
               $firstparty=$row['firstparty'];
               $secondparty=$row['secondparty'];
               $partyemail=$row['partyemail'];
               $phone=$row['phone'];
               $idate=$row['idate'];

             echo "<tr><td><a href=\"home.php?num=$num\">$num</a></td><td>$firstparty</td><td>$secondparty</td><td>$partyemail</td><td>$phone</td><td>$idate</td></tr>";
            }
                echo"</table>";

are sure the column num exists in your database..or is it id?

also, if you don't mind, you can refactor your codes above to something less cluterry..

echo '<table width="85%" align="center" border="1">';
echo '<tr><td>Settlement Number</td><td>FirstParty</td><td>SecondParty</td><td>Email</td><td>Phone</td><td>Created Date</td></tr>';

while($row=mysql_fetch_array($sql))
{ 
echo '<tr><td><a href="home.php?num='. $row['num'].'">'. $row['num'].'</a></td>
<td>'. $row['firstparty'] .'</td>
<td>'. $row['secondparty'] .'</td>
<td>'. $row['partyemail'] .'</td>
<td>'. $row['phone'] .'</td>
<td>'. $row['idate'] .'</td></tr>';
}
echo'</table>';

yes. column exist in db. Further if i remove a href tag. complete info is displayed without any issue.

So bit confused ...:(

i replaced my code with above mentioned code. But didn't get any claim num link

try these

 <?php
$html= '<tr><td>< a href="home.php?num=$num">$num</a></td><tr>';
$html.='<tr><td>$num</td></tr>';
 echo $html;
 ?>

It worked fine!! Let me share the same info to all...

Root Cause:link color was not selected and default it has taken white . So I couldn't notice the link (background color and link color was the same)and I just changed to link color . Thank you very much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.