Hey guys,
Am trying to make a script for work to save us some time and I'm having trouble. I'm trying to pull data from a text area for multiple SQL Select, and then display the data.
I'm at a stand still as I've been trying for the good part of 5-6 hours to get it working. As you can see, just a basic form / display, but it only displays the first number. And then has the first 2-3 sets of numbers in the array but doesnt display them properly. I'm going to guess its a silly error but I'm pretty tired ATM. If any of you could spot it I'd be in your debt
Am trying to make a script for work to save us some time and I'm having trouble. I'm trying to pull data from a text area for multiple SQL Select, and then display the data.
I'm at a stand still as I've been trying for the good part of 5-6 hours to get it working. As you can see, just a basic form / display, but it only displays the first number. And then has the first 2-3 sets of numbers in the array but doesnt display them properly. I'm going to guess its a silly error but I'm pretty tired ATM. If any of you could spot it I'd be in your debt


Code:
require("dompdf-0.5.1/dompdf_config.inc.php");
require("include/config.php");
if (isset($_POST['textarea'])) {
$text = explode("\n", $_POST['textarea']);
for ( $i=0, $size = count($text); $i<$size; $i++ )
{
$mydata = $text[$i];
$sql = "SELECT * FROM company WHERE AccID= '$mydata'";
$result = mysql_query($sql);
echo "<table border='1'><tbody><tr>\n";
// Acc Id //
echo '<th>
Acc No
</th>';
// Company Name //
echo '<th>
Company Name
</th>';
// E-Mail //
echo '<th>
E-mail
</th>';
// Acc Manager //
echo '<th>
Acc Manager
</th>';
// PDF //
echo '<th>
PDF
</th>';
/// Search Results Displayed ///
if ($text !=NULL) {echo "<h3><font face='Verdana'>Search results for $text[$i]:</h3></face>"; }
for( $i = 0; $row = mysql_fetch_array($result); $i++ )
{
echo "<tr>";
echo '<td><a href=companyinfo.php?AccID=' .$row['AccID'] . '>' .$row['AccID'] . '</a></td>';
echo "<td>" .$row['Customer_Name'] . "</td>";
echo '<td><a href=mailto:'.$row['Email']. '>'.$row['Email']. '</a></td>';
echo "<td>" .$row['Acc_Manager'] . "</td>";
echo '<td>PDF:<a href=http://myurl.dompdf-0.5.1/dompdf.php?base_path=..%2Fdompdf-0.5.1%2Fwww%2Ftest%2Fvoucher.php&input_file=..%2Fdompdf-0.5.1%2Fwww%2Ftest%2Fvoucher.php>'.$row['Customer_Name']. '</a></td>';
echo "</tr>";
}
echo "</tbody></table>";
}
exit();}