Jump to content

[SOLVED] Urgently need help!! PHP Link


ow-design

Recommended Posts

Hi Everyone, hope you can help me!

I am 16 yrs old and design websites for companies. I have a problem with a database i am doing for a recruitment company site.

 

you can view the non-ready one here... www.ow-design.co.uk/clients/martin_pooley/jobs.php

 

Basically i want all the jobs listed on the page listed above.. which is working fine... but i need a link after each job title with more info.

 

This link will then go to a page where the job title will be displayed again but with a job description also.

 

It all has to work automatically . i.e when the user of this website enters a new job via a html form the listings will update aswell as the more info links and the more info page.

The links would probably have to work on id as this is unique to each job listing.

 

Hope this makes sense :)

Thanks.!

Link to comment
Share on other sites

  • Replies 69
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

just pass the ID from the database into the URL and make the job title a link, make 1 script that uses the $_GET['id'] and displays the detailed info from the DB using SELECT job FROM jobs where id = "$id'") of course setting $id = $_GET['id']; I hope this makes sense.

 

If this doesn't make sense i'll try to better explain it and maybe write some quick code as an example.

Link to comment
Share on other sites

ok ur table:

 


echo "<table align=\"center\" valign=\"top\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">";

echo "<tr>";
echo "<td align=\"center\" width=\"10%\" height=\"50\">Ref #</td>";
echo "<td align=\"center\" width=\"90%\" height=\"50\">Job Title</td>";
echo "</tr>";

$sql = mysql_query("SELECT id, job_title FROM jobs") or die("Couldn't connect to the Jobs table");

while ($row = mysql_fetch_array($sql)) {

$id = $row['id'];
$job = $row['job_title'];
$wbsite = "http://www.yoursite.com/";

echo "<tr>";
echo "<td align=\"center\" width=\"10%\" height=\"50\">" . $id . "</td>";
echo "<td align=\"left\" width=\"90%\" height=\"50\"><a href=\"" . $wbsite . "jobdetails.php?action=vd&id=" . $id . ">" . ucfirst($job) . "</a></td>";
echo "</tr>";

}

echo "</table>";

 

ok that would make the job title a link as the name of the job title.

 

this is your details.php:

 


if ($_GET['action'] = "vd") { //Remember the jobdetails.php?action=vd in your URL on the above code? This checks to see if its valid.

$id = $_GET['id'] // the &id=" . $id . " is set to $_GET['id'] ['id']  being the same id in the URL

$sql = mysql_query("SELECT * FROM jobs WHERE id = '$id'"); // pulls the row with the same ID number as it is in the URL
$row = mysql_fetch_array($sql);

//your table here with your details with the $row[] array with the info from the database.


 

I hope this helps.

Link to comment
Share on other sites

Thanks, i am getting the following message of jobdetails.php

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/deswo/public_html/clients/martin_pooley/jobdetails.php on line 13

 

Line 13 is:

 

while($row = mysql_fetch_array($result))

 

 

Link to comment
Share on other sites

I was taking a lot of info from the code and trying to adjust it, i am not great at php... yet :)

 

Would you write me the code please for my jobs page & jobdetails page??

 

On jobs page i have fields [id] & [name] plus the more info link

on jobdetails i would have  [id] & [name] & [description]

 

I know it's asking a lot but i am really dtuck and need this complete by tonight, i have tried everything and am getting nowhere :=

 

Thanks Ollie

Link to comment
Share on other sites

You have to make sure when you run the query you're checking this table. For example "Select * from deswo_list where id='$id'" needs to aim at that table in particular. Check that out firstly. The idea is basically you want that query to get all of the information from the table and pushed into an array. Once you do that, then you want to output this information (using a while loop and echo statements) so the users can see the current jobs in the database.

Link to comment
Share on other sites

Yes thank you. That's why Archadian's solution wasn't working. To list all your jobs:

 

echo "<table align=\"center\" valign=\"top\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">";

echo "<tr>";
echo "<td align=\"center\" width=\"10%\" height=\"50\">Ref #</td>";
echo "<td align=\"center\" width=\"90%\" height=\"50\">Job Title</td>";
echo "</tr>";

$sql = mysql_query("SELECT id, job_title FROM deswo_list") or die("Couldn't connect to the Jobs table");

while ($row = mysql_fetch_array($sql)) {

$id = $row['id'];
$job = $row['job_title'];
$wbsite = "http://www.yoursite.com/";

echo "<tr>";
echo "<td align=\"center\" width=\"10%\" height=\"50\">" . $id . "</td>";
echo "<td align=\"left\" width=\"90%\" height=\"50\"><a href=\"" . $wbsite . "jobdetails.php?action=vd&id=" . $id . ">" . ucfirst($job) . "</a></td>";
echo "</tr>";

}

echo "</table>";

 

We changed 'jobs' to 'deswo_link'. Now let's try it again.

Link to comment
Share on other sites

okay thanks. i have put that in, please look:

 

http://www.ow-design.co.uk/clients/martin_pooley/jobs.php

 

their are a few problems i would like to sort out, as you can see the jobs are all on one row, i would like them on individual rows with their links working.

 

How can i make this happen?

Really appreciate all your help!

 

Ollie

Link to comment
Share on other sites

Wow that's messed up. Let me try to rewrite that:

 

<table>
<tr><td><b>Ref #</b></td><td><b>Job Title</b></td></tr>

<?php
//Put your db connection stuff here
$sql = mysql_query("SELECT id, job_title FROM deswo_list") or die("Couldn't connect to the Jobs table");

while ($row = mysql_fetch_array($sql)) {
     echo "<tr><td>{$row['0']}</td><td>{$row['1']}</td></tr>";
}
?>
</table>

I didn't test that, but try it and let me know how it turns out.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.