Advertisement
Guest User

HTP-database pull

a guest
May 2nd, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. <table width="90%" align="center" cellpadding="4" cellspacing="1" bordercolor="#FFFFFF">
  2. <tr bgcolor="#004AC6" class="bod">
  3. <td width="10%">
  4. <div align="center"><strong><font color="#FFFFFF" size="2">Job #</font></strong></div></td>
  5. <td width="40%">
  6. <div align="center"><strong><font color="#FFFFFF" size="2">Job Summary</font></strong></div></td>
  7. <td width="35%">
  8. <div align="center"><strong><font color="#FFFFFF" size="2">Key Skills</font></strong></div></td>
  9. <td width="5%">
  10. <div align="center"><strong><font color="#FFFFFF" size="2">Location</font></strong></div></td>
  11. <td width="10%">
  12. <div align="center"><strong><font color="#FFFFFF" size="2">Status</font></strong></div></td>
  13. </tr>
  14.  
  15. <?php
  16. $host = "localhost";
  17. $username = "hightech_sudhir"; //* use the database name given by Linksky
  18. $password = "vsudhir"; //* use the database password given by Linksky
  19. $dbname = "hightech_hightechprosjobs"; //* the name given by Linksky
  20.  
  21. @ $db = mysql_connect($host, $username, $password);
  22. if (!$db)
  23. {
  24. echo "Error: Could not connect to database. Please try again later.";
  25. exit;
  26. }
  27. mysql_select_db($dbname);
  28.  
  29. /* Performing SQL query */
  30. $query = "SELECT * FROM jobs where Activated = 'Yes' order by JobID desc;";
  31. $result = mysql_query($query) or die("Query failed : " . mysql_error());
  32.  
  33. /* Printing results in HTML */
  34. $num_results = mysql_num_rows($result);
  35.  
  36. for ($i=0; $i <$num_results; $i++)
  37. {
  38. $row = mysql_fetch_array($result);
  39. $jobid = stripslashes($row["JobID"]);
  40. echo "<tr bgcolor='#EEEFF4'>";
  41. echo "<td align='center' width='10%'><font size='2' face='verdana'>".$jobid. "</font></td>";
  42. echo "<td valign='top' width='40%'><font size='2' face='verdana' class='sud'><a href='viewJob.php?jobid=".$jobid ."'><strong>".htmlspecialchars(stripslashes($row["JobTitle"]))."</strong></a></font><br>";
  43. echo "<font size='1' style='verdana'>".substr(htmlspecialchars(stripslashes($row["Description"])),0,105)."...</font></td>";
  44. echo "<td valign='top' width='32%'><font size='1' face='verdana'>" .htmlspecialchars(stripslashes($row["KeySkills"])). "</td>";
  45. echo "<td valign='top' width='8%'><font size='1' face='verdana'>".htmlspecialchars(stripslashes($row["Location"]))."</td>";
  46. echo "<td valign='top' width='10%'><font size='1' face='verdana'>".htmlspecialchars(stripslashes($row["Status"]))."</td></tr>";
  47. }
  48. print "</table>\n";
  49. mysql_close($db);
  50. ?>
  51.  
  52. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement