Jump to content

passing mysql query by link


jobs1109

Recommended Posts

Ok hre is what I got so far

 

This first page does a query on mysql table and passed id for row by link here is the code

 



<?php
session_start();

include'../../DB-Connect101/DB-Connect101.php';

$_SESSION['Keyword_Search']    = $_POST['Keyword_Search']; 
$_SESSION['Jobcategory']      = $_POST['Jobcategory'];
$Keyword_Search =  $_SESSION['Keyword_Search'];
$Jobcategory =  $_SESSION['Jobcategory'];
// echo $Keyword_Search; to be used in future
// echo $Jobcategory; to be used in future



$id=$_GET['id'];

$jobs_sql = "SELECT id,JobTitle FROM Jobs ORDER BY id ASC";
$jobs_query= mysql_query($jobs_sql) or die (mysql_error); 
$rsjobs=mysql_fetch_assoc($jobs_query);
?>

<body>

<?php do {?>
<p><a href="http://www.hiringinhilo.com/Hilo-Jobs/Job-Search-Form/Getting-Data-From-Database/Job-Details/Job-Details.php">id=<?php echo $rsjobs['id'];?><?php echo $rsjobs['JobTitle']; ?></a>
<?php } while ($rsjobs=mysql_fetch_assoc($jobs_query)) ?>

</body>



 

 

 

here is the second page where the row should print out corresponding to the id click on the first page but nothing gets dispayed. What is wrong with my code ? please help ?

 

 

second page

 

 

 



<?php
session_start();
?>


<?php
include'../../../DB-Connect101/DB-Connect101.php';

$Keyword_Search =  $_SESSION['Keyword_Search'];
$Jobcategory =  $_SESSION['Jobcategory'];
// echo $Keyword_Search;
// echo $Jobcategory;

$id=$_GET['id'];
$jobs_sql = "SELECT * FROM Jobs WHERE id=$id";
$jobs_query= mysql_query($jobs_sql) or die (mysql_error); 
$rsjobs=mysql_fetch_assoc($jobs_query);


?>
<body>
<?php echo $rsjobs['JobTitle']; ?>
<?php echo $rsjobs['Company'];?>
<?php echo $rsjobs['Salary'];?>
<?php echo $rsjobs['Description'];?>
</body>







Link to comment
https://forums.phpfreaks.com/topic/245112-passing-mysql-query-by-link/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.