Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by trq

  1. This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=357263.0
  2. cron is indeed the best approach.
  3. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=357232.0
  4. There is no such thing as a good *free* host. You get what you pay for.
  5. This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=357227.0
  6. You have numerous issues. The first is that your not very good at asking for help. mysql_query will return true if your query succeeds. Just because your query has succeeded however, does not meen it found any data. You need to use mysql_num_rows. That is the only help I am going to offer.
  7. Pass the database object into the construct of the user object.
  8. Define "not working properly". And please, we have tags to use when posting code.
  9. A *user* is not a *type* of database so the relationship makes no sense. A user might depend on a database, but that is as far as the relationship should stretch. As for your issue: Firstly, you reference methods and properties declared within a parent class using $this not parent. Just as you would any local method or property. The only time you need to use *parent* is when you are overriding a parents method and within that child method you need to call the original parent method. Secondly, you have not implemented the child __construct in such a mannor that you will be able to create a database object. These two points are mute however as like I already stated, user should not be extending database.
  10. This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=357211.0
  11. This topic has been moved to PHPFreaks.com Questions, Comments, & Suggestions. http://www.phpfreaks.com/forums/index.php?topic=357217.0
  12. Far from correct. Currently the modify() method expects at least one argument. Your overloaded method didn't that is why you where getting the error. What Andy-H's code does is declares that your modify() also expects an argument, however he has also set a default value for this argument (of false) making it now optional.
  13. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=357181.0
  14. That is just generally poor coding unless it's a very simple script. Unfortunately however, I don't believe poor coding skills can be improved by simply throwing tools at the problem and hoping for the best.
  15. This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=357187.0
  16. This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=357188.0
  17. My preference is to not introduce some other syntax for no real benefit. If your designers need to learn some template engine syntax why not have them learn some basic PHP? You generally don't need more than simple loops and conditionals. At my work we have massive scale applications and no issue with mixing minimal PHP and markup. It's easier and quicker. I really just don't see the point in adding another layer.
  18. There are ways of separating your business logic from your markup that don't involve the overhead of a template engine. The mvc pattern comes to mind. Why throw some other syntax variant into the mix when you can achieve the same results using a little PHP?
  19. Have you executed this query from within MySql to see what it might look like? Your query will return something like: [pre] +------------------+---------------------+------+-----+---------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------+---------------------+------+-----+---------------------+----------------+ | id | bigint(20) unsigned | NO | PRI | NULL | auto_increment | | somefield | varchar(255) | NO | | | | +------------------+---------------------+------+-----+---------------------+----------------+ [/pre] Armed with this information you can see to use: $sql = "SHOW FIELDS FROM apartmentoUsers"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { echo $row['Filed'] . '<br />'; echo $row['Type'] . '<br />'; echo $row['Null'] . '<br />'; echo $row['Key'] . '<br />'; echo $row['Default'] . '<br />'; echo $row['Extra'] . '<br />'; } } } Of course, $row is just an array, so you could also have looped through it also. $sql = "SHOW FIELDS FROM apartmentoUsers"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { foreach ($row as $val) { echo $val . '<br />'; } } } }
  20. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=357163.0
  21. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=357165.0
  22. And this query would be no different.
  23. This topic has been moved to Other. http://www.phpfreaks.com/forums/index.php?topic=357168.0
  24. This previous reply might help you. http://www.phpfreaks.com/forums/index.php?topic=356177.msg1685225#msg1685225
×
×
  • 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.