Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Passing information by clicking hyperlink?
Old 05-27-2010, 09:37 AM Passing information by clicking hyperlink?
Novice Talker

Posts: 8
Trades: 0
we are given a database, and we had to list the year of review, this is to be a hypertext link which when clicked will pass the reviewid(which is stored in the reviews table in the database) to the viewReview.php page

the code I have for passing the reviewid to viewReview.php is this:
Code:
<td><a href="viewReview.php?reviewid=<?php echo $row1['reviewid'] ?>"><?php echo $row1["reviewYear"] ?></a></td>
Then in the viewReview.php we had to display Employee informations according to the reviewid.

But the problem is when I clicked on the link, it takes me to the viewReview.php page, it just displays all the Employee informations but it's not according to the reviewid. This is my code in the viewReview.php

Code:
<?php
session_start(); 

$conn = mysql_connect("localhost", "TWA2", "test");
mysql_select_db("performancereview", $conn)
or die ('Database not found ' . mysql_error() );
$sql = "SELECT employee.empid, jobs.jobtitle, employee.extension, departments.departmentname, reviews.supervisorid, reviews.reviewYear FROM employee, jobs, reviews, departments WHERE jobs.jobid=employee.jobid AND employee.empid=reviews.empid ";
$rs = mysql_query($sql, $conn)
or die ('Problem with query' . mysql_error());

?>

<table border="1">
<tr>
<th>Employee id</th>
<th>Job Title</th>
<th>Phone Extension</th>
//rest of the <th>
</tr>
<?php
while ($row = mysql_fetch_array($rs)) { ?>
<tr>
<td><?php echo $row["empid"]?></td>
<td><?php echo $row["jobtitle"]?></td>
<td><?php echo $row["extension"]?></td>
//rest of the <td>
</tr>
<?php }
mysql_close($conn); ?> 
</table>
I'm thinking I have to add something in my viewReview.php, something like reviewid=...., but I'm not sure what to add...
can anyone help please.
Izzy123 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-27-2010, 09:39 AM Re: Passing information by clicking hyperlink?
Novice Talker

Posts: 8
Trades: 0
I added this in the $sql WHERE bit:
Code:
...AND reviewid='.mysql_real_scape_string($_GET[reviewid]).'
But then when I clicked on the link, the table doesn't display any informations.
Izzy123 is offline
Reply With Quote
View Public Profile
 
Old 05-27-2010, 10:06 AM Re: Passing information by clicking hyperlink?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
print the query to the browser before calling it and see if it is correctly formatted and SHOULD return results.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Passing information by clicking hyperlink?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11362 seconds with 12 queries