PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I having a problem with viewing a username from another table.. i got 3 table in my database.. employee_user, employer_user and application table. my problem here is at application table..
[syntax=php]<div class="h3">Application</div>
<div class="mainbox">
<ul id="features">
<?php
if (isset($_SESSION['usernamejob']))
echo "<br />You already appplied for the job<br />";
else
die ('You must be logged in!');
?>
<?php
$employer_id = $_GET['employer_id'];
if (isset($_SESSION['userid']))
$conn = mysql_connect("localhost","root","") or die ("Cannot connect!");
mysql_select_db("job_seeks") or die("cannot find the db");
$date = date("Y-m-d");
$query = mysql_query("SELECT * FROM application") or die(mysql_error());
$sql = 'INSERT INTO application (application_job_id, application_employee_id, date) VALUES ("'.$employer_id.'", "'.$_SESSION['employee_id'].'", "'.$date.'")';
$result = mysql_query($sql) or die(mysql_error());
?>
</ul>
</div>
[/syntax]
My problem here is i to view employee_user detail by using application_employee_id from application table. as a employer, they wanted to view whos apply for they job..
Below is code for employer_user to view employee_user that apply.. i stuck at this code btw..
<?php
// create a link to the details page
echo '<li><a href="detailPage.php?id=' . $row['application_job_id'] . '">' . $row['application_job_id'] . '</a></li>';
?>
On the page (detailPage.php in this instance) you will use $_GET['id'] to retrieve the value and then look for the corresponding record in the database
<?php
$id = $_GET['id'];
// do some checking on the value you receive from the database
$query = "SELECT * FROM yourTable WHERE field = '" . $id . "' ";
$sql = mysql_query($query) or die(mysql_error());
//
if ($sql) {
// if the query was executed successfully, we can start to select the data
// from the database.
while ($array = mysql_fetch_array($sql)) {
// start to echo out the data
}
}
?>
This is a simple example; a look at your code shows you already have a basic grasp of database / PHP interaction.
Hth
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
i dont know how to display a data from employee table wheres application table got application_employee_id that connected with my employee table.. wheres my employee table have employee_id(employee table) that = application_employee_id(application table)... by using the application_employee_id from application table that got linked with employee_id from employee table, i wanted to display that data that inside employee table...