I have 2 Arrays in my code. $id = array(); gets its values from the previous page. And $nameArray = array(); gets its values from an sql query. The $id array works fine, but my $nameArray doesn't work, and I'm assuming because you can only have 1 array?
Is there a way to store the values for $id in their own array, and also store the values for $nameArray in a seperate array or is that not possible?
Thanks!
Here is the code for the $id
$id = array();
$street = $_POST['site_street'];
$db_link = mysql_connect('example', 'example', 'example');
if (!$db_link)
die('Cannot connect : ' . mysql_error());
$db_selected = mysql_select_db('Orders', $db_link);
if (!$db_selected)
die ('Cannot select database : ' . mysql_error());
$sql = "SELECT clientreferrance, clientname, sitestreet, inspectiontype FROM `PropertyInfo` WHERE `sitestreet` LIKE '$street'";
$result = mysql_query($sql);
if (!$result)
die('Could not successfully run query: ' . mysql_error());
if (mysql_num_rows($result) > 0)
{
?>
<form action="noJavaScript.php" name="theForm" method="post">
<table style="border: 1px solid black">
<?php
while ($row = mysql_fetch_assoc($result))
{
echo '<tr><td>';
echo '<input type="checkbox" name="selected[]" value="'.$row['clientreferrance'].'"/>';
echo '</td>';
foreach ($row as $key => $value)
echo '<td>'.htmlspecialchars($value).'</td>';
echo '</tr>';
}
?>
</table>
<input type="submit" name="submit" value="Edit/Modify Order" onClick="document.theForm.action='modify.php'">
<input type="submit" name="submit" value="Clone Order" onClick="document.theForm.action='clone.php'">
<input type="submit" name="submit" value="Archive Order" onClick="document.theForm.action='../member-index.php'">
</form>
And the code for the $nameArray SQL query:
$nameArray = array();
$dbh2 = mysql_connect("example", "example", "example", true);
mysql_select_db('Inspectors', $dbh2);
//Create query
$query2 = mysql_query("SELECT * FROM `InspEmail` WHERE `Company` LIKE '$user'");
// display query results
while($row2 = mysql_fetch_array($query2)) {
$nameArray[] = $row2['name'];
}
mysql_close($dbh2);
InspEmail? What is the content of$user? What happens when you run the query directly ?