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. I haven't read back through all of the pages of posts so sorry if this has been coverered - but it seems more sensible to not use forms, and just put your viewing counter processing code on the page of wherever you're hosting the movie itself Just loop out a set of url's instead of submit buttons <?php while($row = mysql_fetch_array( $result )) { $output.= "<a href='alldaymovies.php?filename=$row[filename]' target='_blank'>$row['filename']</a>"; $output.= "<br>"; } echo $output; The use of '_blank' forces a new window to be opened in the browser. Then at the top of the actual movie page... $filename = $_GET['filename']; $result2 = mysql_query("UPDATE DayMovie SET Counter=Counter+1 WHERE FileName='$filename'") or die(mysql_error()); you need to escape $filename as it's open to SQL injection
  2. I code in my own time, have done for many years. Although degree level at Computer Science I found myself in an unrelated job, but now want to make the jump into being a web dev. From the job vacancy specifications I see, most dev jobs don't just require PHP, OO, etc, they specifically ask for framework experience like Zend, or experience in platforms such as Joomla, Magneto etc. I don't have experience in any frameworks. Could anyone give me some advice on what it is I should focus my attention on learning to begin with? Is a framework like Zend a worthwhile starting point?
  3. 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?
  4. 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.
  5. 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.