-2

Being a beginner in PHP, I have a table in a database which consists of 14 columns. I need to extract some of the columns through an 'href' link on another page. I am having a hard time trying to get the specific column ids for the specific column as I need the columns to be displayed as plain text separately on an html page.

So this is the fetch code to display columns 'A' and 'G' including two links in a table.

 while($row=mysql_fetch_array($res))
    {
    echo "<tr>";
    echo "<td>" . $row['A'] . "</td>";
    echo "<td>" . $row['G'] . "</td>";
    echo "<td><a href=\"Sequence.php?rowid=" . $row['N'] . "\">FASTA</a></td>";
    echo "<td><a href=\"Fullentry.php?rowid=" . $row['A']. $row['B']. $row['C']. $row['D']. $row['E']. $row['G']. $row['H']. $row['I']. $row['J']. $row['K']. $row['L']. $row['M'] ."\">Full Entry</a></td>";
    echo "</tr>";
    }

I am facing problems to get the columns A to M separately on the next php page of FullEntry.php and I need the data from the columns as plain text. This is what I could come up with on FullEntry.php page.

$row = $_GET['rowid'];
<!--Here is where I need the multiple row ID's to get separate columnar data-->
echo $row;
?>

So How can use different id's for different columns from the original.php page to display results separately through the FullEntry.php page or If there can be any modifications with sql query as well. Help will be appreciated. Any help would be appreciated. Thank you in advance!

Srk
  • 69
  • 2
  • 8
  • `echo "Full Entry";` Suppose, $row['A']=a,$row['B']=b,$row['C']=c,$row['D']=d.... and so on, the result will be `Fullentry.php?rowid=abcde....`. Do you want url like this? – A B Catella Mar 03 '17 at 09:56
  • what is your $row now? – Shanu k k Mar 03 '17 at 09:57
  • @Shanu k k - My $row right now on the original.php are the fetched rows from the sql query made earlier. – Srk Mar 03 '17 at 09:59
  • @A B Catella - Yes that is exactly what I want to do. I just cannot find how to provide ID's to each $row['#']. If you have given the right way, pleas can you provide a more elaborated syntax so that I can understand. – Srk Mar 03 '17 at 10:00
  • 1
    stop using MySQL_functions! They have been deprecated a while now and pose security issues! See http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php So go and search for a tutorial more recent. think [tag:PDO] or [tag:MySQLi] – davejal Mar 03 '17 at 10:11

1 Answers1

0

HereI have added a delimiter | bewteen $row reults like echo "<td><a href=\"Fullentry.php?rowid=" . $row['A']."|".$row['B']."|". $row['C']."|"..."\">Full Entry</a></td>";

And the result will be like Fullentry.php?rowid=a|b|c|d|e..... and you can access this by exploding the rowid.

$result = $_POST['rowid]; $result = explode("|",$result); echo $result [0]; echo $result [1];...

A B Catella
  • 308
  • 4
  • 12