0

.How do I show selected results from MySQL database on page load For example wen the page loads I would like all posted jobs to appear automatically and not when clicked

//////////////////////////////////////////
// VIEW SEARCHED JOBS
//////////////////////////////////////////
function viewSearchedJobs() {
  connectDatabase();

  $pk = mysql_real_escape_string($_GET['pk']);
  if (isset($_GET['start']))
    $start = $_GET['start'];
  else
    $start = 0;
  $result = queryDatabase("SELECT total, fk_job
                           FROM search
                           WHERE pk = $pk");
$row = mysql_fetch_object($result);

  $total = $row->total;

  if ($total > 0) {
    $results = (($start + 20) > $total) ? $total: ($start + 20);

    echo "<div class=\"good\">Results " . ($start + 1) . "-$results of $total job(s) found</div><br />";
  } else
    echo "<div class=\"bad\"><b>Sorry...Your search did not match any jobs in our database.</b></div><br />";

  ...............................................

This is the page where I want the results to be displayed

<div id="results_box"/>
<font face="Just+Another+Hand" font color="#111111"/><b>Job Results: <br></b></font>
<p>
<iframe id="my-iframe" name="my-iframe"src="http://jobalooza.com/browse.php?" frameborder="0" scrolling="no" height="1500px" width="720px"  ></iframe>
</div>
Jack
  • 1
  • 1
  • [Escaping the string](http://stackoverflow.com/questions/5741187/sql-injection-that-gets-around-mysql-real-escape-string) is not safe. Learn about [prepared](http://en.wikipedia.org/wiki/Prepared_statement) statements for [MySQLi](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php). – Jeff Puckett Feb 08 '17 at 23:22
  • another dumb question. How do I call the viewSearchedJobs() function. Sorry I am new to PHP and I am seeing how it works – Jack Feb 08 '17 at 23:56
  • I would recommend https://laracasts.com/skills/php as a starting point for learning. – Jeff Puckett Feb 08 '17 at 23:58
  • How do I call the viewSearchedJobs() function in an iframe. Stumped... – Jack Feb 09 '17 at 04:01

0 Answers0