Calgaryalberta Posted January 25, 2008 Share Posted January 25, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/87787-solved-php-horizontal-rule/ Share on other sites More sharing options...
GingerRobot Posted January 25, 2008 Share Posted January 25, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/87787-solved-php-horizontal-rule/#findComment-449032 Share on other sites More sharing options...
Calgaryalberta Posted January 25, 2008 Author Share Posted January 25, 2008 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 :-\ Quote Link to comment https://forums.phpfreaks.com/topic/87787-solved-php-horizontal-rule/#findComment-449049 Share on other sites More sharing options...
GingerRobot Posted January 25, 2008 Share Posted January 25, 2008 This sounds like more of an HTML issue to me. If you're wanting the data to be displayed in a list, with a horizontal rule in between, you shouldn't be using a table. Quote Link to comment https://forums.phpfreaks.com/topic/87787-solved-php-horizontal-rule/#findComment-449056 Share on other sites More sharing options...
Calgaryalberta Posted January 25, 2008 Author Share Posted January 25, 2008 Ok, let me play with it, Ill see what I can come up with, any problems Ill post here in a bit! Thanks Quote Link to comment https://forums.phpfreaks.com/topic/87787-solved-php-horizontal-rule/#findComment-449057 Share on other sites More sharing options...
PHP Monkeh Posted January 25, 2008 Share Posted January 25, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/87787-solved-php-horizontal-rule/#findComment-449059 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.