how to get button for every record from mysql

Solutions on MaxInterview for how to get button for every record from mysql by the best coders in the world

showing results for - "how to get button for every record from mysql"
Kelsey
28 Jul 2019
1<html>
2<form method = "GET" action = "copytrade.php">
3
4<?php 
5require('connect.php');
6$query = "SELECT * FROM trade_history1 "; //You don't need a ; like you do in SQL
7$result = mysql_query($query);
8
9echo "<table border = '1px'>"; // start a table tag in the HTML
10echo "<tr><td>" . "ID" . "</td><td>" . "Date" . "</td><td>" . "Type" . "</td><td>" . "Size" . "</td><td>" . "Currency Pair" . "</td><td>" . "Entry" . "</td><td>" . "Stoploss" . "</td><td>". "Take Profit" . "</td><td>" . "Date Close" . "</td><td>" ."Close" . "</td><td>" ."Profit/Loss"."</td><td>" ."Copy"."</td><td>Copy</td></tr>" ;  //$row['index'] the index here is a field name
11
12while($row = mysql_fetch_array($result)){   //Creates a loop to loop through results
13echo "<tr><td>" . $row['id'] . "</td><td>" . $row['date'] . "</td><td>" . $row['type'] . "</td><td>" . $row['size'] ."</td><td>" . $row['currency_pair'] ."</td><td>" . $row['entry'] ."</td><td>" . $row['stoploss'] ."</td><td>" . $row['takeprofit'] ."</td><td>" . $row['dateclose'] ."</td><td>" . $row['close'] ."</td><td>" . $row['profitloss'] . "</td><td>a href='copytrade.php?id=" .$row['id'].'">copy</a></td></tr>";  //$row['index'] the index here is a field name
14}
15
16echo "</table>"; //Close the table in HTML
17
18mysql_close(); //Make sure to close out the database connection
19?>
20
21<input type = "submit" name = "copy" value = "copy"/></form>
22</html>
23