Jump to content

paddy_fields

Members
  • Content Count

    172
  • Joined

  • Last visited

  • Days Won

    1

paddy_fields last won the day on February 28 2014

paddy_fields had the most liked content!

Community Reputation

8 Neutral

About paddy_fields

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling
  • Location
    Brighton
  1. That's great, thank you. Just to get my head around that... is $result an array with one value? And then list($totalJobCount) assigns that array item to $totalJobCount?
  2. Hi. I was using the method below to count the rows in a table, but I've since learnt I should be using SQL Count. Old method.... //total number of jobs if ($result = $db->query("SELECT * FROM jobBoard")) { $totalJobCount = $result->num_rows; $result->close(); echo $totalJobCount; } I've now changed this to.... //total number of jobs if ($result = $db->query("SELECT count(*) AS jobCount FROM jobBoard")) { $findCount = $result->fetch_assoc(); $totalJobCount = $findCount['jobCount']; $result->close(); echo $totalJobCount; } Is my new method the best way of doing this? It provides the correct result but I'm new to mysqli and I'm not sure if fetch_assoc() is the right way to go? Thanks. Pat.
  3. The PHP and HTML is quite seperated in the code you've posted. If you want the page to 'look nicer' then learn CSS and control the look and feel of the page that way. You can use a template if you wish, and then just copy your PHP code into it. You would just need to make sure that your form elements are still included to communicated with the PHP script. Otherwise, employ a designer. Also, put your PHP in the <head></head> of your document, it's much clearer and will cause you less problems in the long run if you try and echo data from PHP into the body of the HTML page.
×
×
  • 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.