Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About ramasaig

  • Rank
  1. Thanks Larry. I've recently been working from a PHP/OOP/MySQL tutorial that used mysqli_connect syntax rather than PDO, so this may be why the author wrote an abstract table class with SELECT, INSERT UPDATE functions, etc. I'll revisit PDO. At least I have learnt something by making that work for me. I'll also have a go at a 'listings' class. Best Wishes,
  2. Hello Larry, Thanks for your reply. That makes sense to me. I guess I'll just have to feel my way from there. I don't think it's necessary to re-write my existing procedural code, but it may be easier to understand what I'm doing that way than starting with a new web site. It would seem my DB tables have a lot of common features (e.g. methods for SELECT, INSERT, UPDATE, etc.) so I'm thinking an abstract 'table' class might be the way to go, then each actual table class would extend the 'table' class? That's what I'm experimenting with right now. I can see that my abstract table class migh
  3. It's unfortunate that this posting didn't attract any replies (probably because it's too much of a rant). It does however reveal a real problem. I too have 'grown up' on Larry's books (and others by Sitepoint) that cover PHP and MySQL thoroughly in procedural code. I have created several web sites based on what I've learned. I'm now ready to move on to OOP, but despite reading about OOP and understanding the advantages I cannot get a handle on where to start re-writing my code. It's not even clear to me what I should choose as my classes. There's some guidance to be found on the web, but t
  4. Thank you for your replies. Passing a variable as a parameter is fine, but if (as in my case) you have many variables you either need to pass in or return, it can get cumbersome. The solution is to use arrays as Buttercream Cupcake says. I knew about using an array for 'return', but I hadn't realised one could also use an array as a parameter. BTW, I've come accross a PHP function 'compact' which I didn't know about before, for making an array out of existing PHP variables, so Buttercream Cupcake's example would become: $values = compact('nights', adults', 'teens', 'child2', 'child1'
  5. Hello Larry, From my first encounter with PHP (from your various books) I've always understood that if one needs to use a variable in a function, when that variable was originally declared outside the function, then it must be declared as 'global' within the function. Similarly if a variable is created within a function and is required outside, it must be declared 'global' within the function (or 'returned'). (It may be that declaring it as global when originally declared also works, but I've not habitually done that) That has sometimes led me to declare a whole raft of variables as gl
  6. Thanks for your comments. I took a few days off over Easter, but I'm back at this now (though not full time). I have managed to split up my control script into several modules. The 'index.php' file now consists of a 'cascade' of conditionals (mostly) applied to the $_GET query string, but in some cases to $_POST. Appropriate modules are called as required. The first task was to get it all working exactly as before (without Ajax), which I think I've achieved. The main search function is working well in Ajax, it's the smaller bits which are proving resistant at the moment. I should soon
  7. Hello HartleySan, Thank you for your response, and for taking the time to look at the non-Ajax site. The good news is that (just before reading your response) I have got the basic Ajax function working (So far I can update an accommodation search), showing the new listings. At the moment the Search Results summary (above the listings) isn't updating. I think this may require a second Ajax object, and I'll be looking into that next. You very properly question the need for such a long control script. The script handles almost everything the site does (there are few direct links betwe
  8. Hello Larry, Thanks for your reply. It's not that I WANT to feed the Ajax version through the control script, but I haven't worked out an alternative that will work. In the pre-Ajax version, almost every visitor click becomes a GET query string, and is fed into the control script which filters it and applies the appropriate action (from simple page request to DB searches and short-list building etc.). Search query strings are parsed into MySQL queries, and the returned results massaged into a PHP array and fed to the Search Results page template for display. (If the visitor starts on the
  9. I run a web site http://www.holidaymull.co.uk that lists tourist accommodation and attractions. It's built using PHP and MySQL, and has an index.php control script. Every search (or other change) made by visitors calls the control script, and of course the page is refreshed (or a new page written) every time. See http://www.holidaymu...n/B&B/SouthWest for a typical search results page. (These links are to the NON-Ajax site, there's no public Ajax version yet) Most of the search results are displayed within the same template, and it would seem a natural for converting to Ajax. At least
  • Create New...