Jump to content


Member Since 06 May 2003
Offline Last Active Feb 03 2016 07:40 PM

Posts I've Made

In Topic: better understanding of LAMP Stack through Reverse-Engineering Application

05 January 2016 - 12:48 AM

I understand that you have a small time tracking app, but that is not going to jibe with Time trex other than they both offer some level of time tracking.  


If what you are saying is that you are trying to understand the time tracking app you had built, then we would need to know more about that specific application.  There isn't a universal way these things work. 


If the app was built with a specific framework, then there are frequently tell tale signs of that, but we can't guess.


Obviously you want to start with an index.php assuming that exists.  What does that include/require and where does it go from there.  Are there rewrite rules that come with it?


Most well built web apps have some form of MVC pattern, so there's typically a controller, with separate db model classes and views/templates that are loaded as needed by the controller.

In Topic: Trouble with foreign keys

04 January 2016 - 04:51 AM

The message is telling you that there is no matching categories.id value for the transactions row you are trying to add.  A row with whatever id you are trying to specify in your insert must exist in the categories table.  This is how foreign keys work.

In Topic: Total noob, need help with basic If condition

01 January 2016 - 10:03 PM

I don't think ginerjm's advice is wrong, but I can also offer you this which might help.
One of the great things about PHP is the way you are able to intermix PHP and HTML blocks as you are doing in your code.
It is also one of the things that makes code messy and looking like spaghetti for novices.  
In your case, you also are not properly closing your spans.  It should be:

<span> ..... </span>
With and if-then-else block there are a few different ways of handling this.

If you want to truly learn the answer, then you need to do some reading about these features.
Here's something to ponder, which hopefully will cause you to investigate the materials I referenced, not to mention the underlying PHP features.

//html mode 
<span class="updated"><?php the_time('j F Y'); ?></span>
    $u_date = get_the_time('j F Y');
    $u_modified_date = get_the_modified_date('j F Y');
<?php if ($u_modified_date !==  $u_date): ?>
    <span class="updated">and last modified on <?php echo the_modified_date('j F Y'); ?> </span>
<?php endif; ?>


No matter how you approach this, the important thing is to have clean, easy to read, easy to separate and understand code, using blocks and indentation.  

In Topic: Categorizing Text in MYSQL database based on multiple keywords

01 January 2016 - 09:07 PM

I agree strongly with Barand.  Full text indexes are made for this sort of problem, and do a few things for you like ranking of results based on the words in your search, not to mention adding features that allow you to specify the importance of specific words.


There are also 3rd party text search specific engines like sphinx or solr that are typically used in the web world, even when the initial data set is in mysql.  Sphinx is the easiest to add to the mix given your workstation environment.  See http://sphinxsearch.com


In either case, as well as I understand your question, I would recommend full text indexing or the additional use of sphinx, unless the entire point of the project is to engineer a solution to these problems yourself, and in that case you should be looking at the text features and strategies those engines provide to figure out what you need to be considering in a solution.

In Topic: better understanding of LAMP Stack through Reverse-Engineering Application

15 December 2015 - 10:03 PM

I have to agree with Jacques here.  If you are already lost, that's not a good sign.  It is also a private project as far as I can see.  Sure you can try and pick it apart, but there are scores of projects that are open source, and hosted on github or bitbucket, and which actually encourage you to participate.  I'm not saying Time trex is badly constructed -- I haven't looked at it, but I've seen plenty of well known projects that are a complete mess and chock full of really bad ideas that would be harmful to emulate.


I'm not saying you should be an alarmist, and can take this with a grain of salt, but just for example:  http://www.webmonkey...-urls-are-evil/


Is Time trex really going to be a great app for you to learn the basics from when it is likely chock full of javascript, which is a challenging language itself.


I think you'll learn a lot more trying to build something with one of the modern full stack PHP frameworks like symfony2 or laravel, or there's even the well known CMS Drupal which just released version 8.0 that is the culmination of a multi-year effort to rebuild it on symfony2 components.


The modern state of the art for php uses composer and PSR-0 component libraries.  If you want to actually learn professional level PHP development you don't want to learn off a project that is 5+ years old.


Yes, the web has a lot of moving parts and there's a tremendous amount you need to learn, from the basics of TCP/IP to HTTP to HTML, the DOM, to CSS, javascript, javascript libraries and frameworks, Ajax, Databases/Datastores, basic web security and cryptography and on and on.  It's a huge challenge and a lot to take on while simultaneously trying to get down the basics of programming.  


If you have a project of your own, your desire to build that project will require you to acquire an adequate understanding of whatever things you need to accomplish that tasks, and this will lead to additional study topics.