Jump to content

[SOLVED] PHP / Horizontal Rule


Calgaryalberta

Recommended Posts

I have a very simple question:

 

I have a careers page on my website. And HR people post the jobs on a password protected area, and what we want is on the careers page, after each member of HR staff posts a job, a <Horizontal Rule> tag is inserted in between each job posting, - what would be a script that would ad a horizontal rule between each job posting?

 

The reason we're posting this on a php forum is: The form the HR staff fills out is in php, and the data from the form is submitting into a MySQL database, and I only have a basic knowledge of php, so I didn't think if I add a horizontal rule at the end of the form the HR staff uses it would carry over and display on the "carrers page" on the public side of the website.

 

I figured the horizontal rule is something that has to be on the careers page, that automatically gets inserted after each job posting gets posted.

 

Thanks, sorry for the long post. 

Link to comment
Share on other sites

So you already have something which is outputting these jobs, and you'd just like to add in a horizontal rule tag in between? If so you'll need to identify the relevant loop that is showing the data from the database, which should hopefully look something like:

 

while($row = mysql_fetch_assoc($result)){
//code here
}

 

And add in the tag:

 

while($row = mysql_fetch_assoc($result)){
//code here
echo '<hr />';
}

 

 

Or do you not have this and are asking how you would go about showing the information in the first place? I wasn't entirely sure from your description of the problem/question.

 

Link to comment
Share on other sites

Well actually, now Im having that excat problem you just identified.

 

I have the HR Job Posting page inserting data into the database.

 

Now on the careers page, Im wanting to display the data, job by job, with a horizontal rule in between the job postings

 

So far because my knowledge of php is basic Ive only developed a small script that is giving me grief which I will post below. The way I want the jobs to display on the page is like this:

 

Job Title:

 

Job Description:

 

Posted By:

 

Open Date:

 

Close Date:

 

Job Description:

 

Contact:

 

Here is the php script Ive started on, but its not working to well yet :( lol - The data is in the database, its just not displaying on the page the way I want it too

 

$con = mysql_connect("****","****","*****") or die('Could not connect: ' . mysql_error());
mysql_select_db("login", $con);

$result = mysql_query("SELECT * FROM job");

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['jobtitle'] . "</td>";
  echo "<td>"; . $row['jobtype'] . "</td>";
  echo "<td>"; . $row['jobtype'] . "</td>";
  echo "<td>"; . $row['postedby'] . "</td>";
  echo "<td>"; . $row['opendate'] . "</td>";
  echo "<td>"; . $row['closedate'] . "</td>";
  echo "<td>"; . $row['jobdesription'] . "</td>";
  echo "<td>"; . $row['contact'] . "</td>";
  echo "</tr>";
  }
echo "</table>";mysql_close($con);
?>

 

I know this is probably not the way to do this :( but Im trying :(  :o :-\

Link to comment
Share on other sites

Like GingerRobot said the HR won't output if you just echo'd it because it isn't been given a table cell.

 

What you could try and do is:

 

<?php

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['jobtitle'] . "</td>";
  echo "<td>"; . $row['jobtype'] . "</td>";
  echo "<td>"; . $row['jobtype'] . "</td>";
  echo "<td>"; . $row['postedby'] . "</td>";
  echo "<td>"; . $row['opendate'] . "</td>";
  echo "<td>"; . $row['closedate'] . "</td>";
  echo "<td>"; . $row['jobdesription'] . "</td>";
  echo "<td>"; . $row['contact'] . "</td>";
  echo "</tr>";
  echo "<th colspan=\"8\"><hr width=\"100%\"></th>";
  }

?>

 

That should add a horizontal rule the same width as your table.

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.