Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5942843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:18:39+00:00 2026-05-22T16:18:39+00:00

I have 2 Arrays in my code. $id = array(); gets its values from

  • 0

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); 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:18:39+00:00Added an answer on May 22, 2026 at 4:18 pm

    You can have as many differently named arrays as you want (assuming you don’t run out of memory).

    The problem will lie in your code elsewhere. As a rule of thumb, blame your own shortcomings before pointing the finger at a well established language, compiler, library, etc. 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this php code $jsonArray = array(); $sql = SELECT ID,CLIENT FROM PLD_SERVERS;
I need to create a big array in my code, I have the values
Ok, so I have a 2D Array that is initialised with values from a
I have a code that fetches a list from DB. Using that returned array
I have a working UITable with sections. The UITable gets its data from an
I have an array created with this code: var widthRange = new Array(); widthRange[46]
I want to implement singleten design pattern in iphone code I have one array.
I have this code: $rows = array(); $res = mysql_query($someQuery); if(!mysql_errno()) while($row = mysql_fetch_assoc($res))
I have this block of code: users = Array.new users << User.find(:all, :conditions =>
I have some code which builds an array of date ranges. I then call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.