Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing select for GET variables
    text
    copied!<p>I have transfered variable values to another page, but now I'm trying to show the database content relevant to this value.</p> <p>Workflow:</p> <ol> <li>There's a form that I enter a new Company. I have entered Company1. It's in companies database.</li> <li>There's another form, that I list in an OPTION tag all the recorded companies. In this form, I record the company's employees information, including the chosen companies option.</li> <li>There's a page that lists all the recorded companies. Each one has a link (company.php?name=$companyName).</li> <li>The companies' names are passed via GET to another page.</li> <li>This other page is called "company.php" and need to show the company's information (other fields in database).</li> <li>It also has to show other table record, like "employees". It must list all the employees that has de same company's name, passed via GET.</li> </ol> <p>The question is: how do I proceed with step 5 and 6? I tried using this select, but didn't work:</p> <pre><code>$query = mysql_query("SELECT employeeName FROM employeeForm WHERE companyName='$employeeName'") or die(mysql_error()); </code></pre> <p>It's really difficult for me to be clear at this, I'm sorry if it's not understandable. 'Been working around this issue for hours.</p> <p>I appreciate any help!</p> <p>EDIT: Used method:</p> <pre><code>include("connect.php"); $companyName=$_GET['companyName']; $result = mysql_query("SELECT * FROM employeeList WHERE company = '$companyName'"); while($result = mysql_fetch_array($query)) { echo '&lt;div class="form"&gt;'.$result['employeeName'].'&lt;/div&gt;'; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload