Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by paddy_fields

  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. I've finished the front end design of my application and now intend to provide a version to my potential users to gain feedback. Does anyone have any experience with the best methods of capturing this feedback? What methods have you used in the past? Questionnaires? I want feedback on things like the colour scheme, layouts, ease of use etc. From what I've read I can do things like a 1-5 satisfaction scale on multiple questions, but this seems a little vague
  4. You can use something like Whisk that allows you to add a widget to your site. It then sources the prices from the supermarkets.
  5. Hi. I have an HTML template that I'm going to use for my CMS, and need some advice on the best way to split it up into common elements used across all pages. I've identified the common HTML and have written functions to include each. I've used functions instead of directly including them on the page for flexibility in the future.(wise?) /* functions.php */ function show_style() { include_once 'module-style.php'; } function show_header() { include_once 'module-header.php'; } function show_sidebar() { include_once 'module-sidebar.php'; } function show_footer() { include_once 'module-footer.php'; } function show_js() { include_once 'module-js.php'; } And then on the page itself... <?php include_once 'functions.php'; ?> <!DOCTYPE html> <html lang="en"> <head> <title>My CMS</title> <meta charset="utf-8"> <?show_style()?> </head> <body> <?show_header()?> <!-- start section content--> <section class="section-content"> <?show_sidebar()?> <!-- start content --> <div class="content"> // PAGE CONTENT </div><!--/ end content --> </section> <!-- /end section content--> <?show_footer()?> <?show_js()?> </body> </html> A few questions - are there any issues with using the <? tag as opposed to <?php.... I've seen it used in templating before and want this to be as clean and readable as possible. Also would it be better to use a class for this, and include all of my functions within that class? Any advice or alternatives on the method used above would be great
  6. Turn on error reporting, and let us know which row is producing an error. error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1');
  7. You won't learn unless you try to do it yourself, otherwise there's no point
  8. Or you could try and learn, and then do your homework yourself.
  9. What exactly is it that you're struggling with? Do you want to know how to store information into a database? You need to read up on either Mysqli or PDO to learn how to insert the data. In terms of your script, you will make the database insert at the part where your validation returns no errors, ie the file type/size was accepted. You will then insert the variable which holds the file name into your database. Or create a flag such as $errors = FALSE at the start of the script; and any time the validation fails, make the flag TRUE. Then at the end simple do the following; if(!$errors){ // script to insert into database }
  10. 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?
  11. 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.
  12. 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.