Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by trq

  1. Which of the two queries is failing? You have '. & .' around the $by variable which makes no sense.
  2. This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=320409.0
  3. This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=320461.0
  4. This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=320455.0
  5. I'm more inclined to stick with a little bit of php within my templates. Your template class means that a designer would still need to learn a new syntax anyway, so why not have them learn a little bit of php, it's allot more efficient. Especially considering you haven't even implemented loops or anything yet. Let's create a simple 'blog' example. header.php <html> <head> <title><?php echo $this->title; ?></title> </head> <body> footer.php </body> </html> blog.php <?php include 'header.php'; ?> <?php foreach ($this->blogs as $blog): ?> <div> <span class="title"><?php echo $blog->title; ?></span> <span class="content"><?php echo $blog->content; ?></span> <span class="footer"><a href="/blog/comment/add/id/<?php echo $blog->id; ?>">Leave a comment</a></span> </div> <?php endforeach; ?> <?php include 'footer.php'; ?> Now, the View class. <?php class View { public function render($view) { ob_start(); include $view; echo ob_get_clean(); } } Now, your client code. <?php if ($result = mysql_query("SELECT title, content, id FROM blogs")) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_object($result)) { $blogs[] = $row; } $view = new View; $view->title = 'blogs'; // page title $view->blogs = $blogs; $view->render('blogs.php'); } } Of course this is a VERY simplified version, but hopefully you get the idea. This is roughly how view work in allot of the frameworks around.
  6. This topic has been moved to Other. http://www.phpfreaks.com/forums/index.php?topic=320387.0
  7. You cannot use a PHP for loop within an SQL query. Use a loop to build your queries if necessary, but you can't actually use them in a query. Ive asked you this before but, why do your database fields all have id's appended to them?
  8. Firstly, I'll just let you know that I think template classes like this (and any others really) are a complete waste of resources (IMO). There are much more efficient methods of creating templates using pure php. Anyway, to do what your looking for you would need another method to replace render() that simply returns the parsed template. You would then parse the main_content.tpl template and store it within a variable ready to use in your layout.tpl.
  9. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=320383.0
  10. You haven't checked the query succeeds or contains any records before using it.
  11. This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=320381.0
  12. [quite]Anyone see anything wrong?[/quite] I wouldn't be using a svn working copy as a production site, especially if it's being updated from the trunk.
  13. The only differences between functions and methods are that methods reside within a class and have automatic access to variables (properties) defined within that class.
  14. You need to ensure that the user Apache runs as (you can find this in your main httpd.conf file) has read permissions to the directory in question on both systems.
  15. We are going to need to see relevant code. Are you using UI Tabs?
  16. In that simple example there is no need for all that code. The same thing could be achieved using.... define('APPLICATION_PATH', realpath('../')); set_include_path(get_include_path() . PATH_SEPARATOR . '../'); Now, the thing is, if you wanted to add more than one simple path you would use the code you posted. You know that implode takes an array and turns it into a string using a specified char as a separator. So.... $a = array('a', 'b', 'c'); echo implode('|', $a); Produces a|b|c Now, you know that an include path looks something like (on Linux) .;/usr/share/php;/usr/share/Zend/lib;/usr/share/www/lib So, if that is our current include path, and we take the code you posted above (and assume that realpath('../') produces /home/thorpe/var/www). Our include path would now be... .;/usr/share/php;/usr/share/Zend/lib;/usr/share/www/lib;/home/thorpe/var/www
  17. In your php.ini you need to go to the extensions section and add the sqlsrv extension, then restart IIS.
  18. This part says it all.... You do not have permission to write to that directory.
  19. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=320284.0
  20. Why is your name CandiceBill then?
  21. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=320280.0
  22. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=320263.0
  23. The computer running the program will be dead before it finishes. You've got the number 9and obviously the time), work out how long it will take to finish if 1 iteration took 1 hundredth of 1 second. What exactly do you hope to achieve by doing this?
  24. You are kidding? There is roughly 1000 bytes in a kilobyte, 1000 kilobytes to a megabyte and 1000 megabytes to a gigabyte. Do thew words kilo, meg and gig mean nothing to you?
×
×
  • 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.