On the first line of your file with the error, type 'use strict' followed by a newline. That should fix it. Some stuff in Javascript is only supported if you use strict mode.

JOIN works if tables have different column names.


SELECT table_a.name, table_b.username FROM table_a JOIN table_b ON table_a.user_id = table_b.user_id WHERE table_a.user_id = 1

In the ON part of the query you tell the query which column in the first table matches the which column in the second table.

diafol commented: +1 +15
cereal commented: +1 +13

Why don't you use a JOIN? :)

shany0786 commented: thnks for reply does join work if have table having some columns different names.can you give link how to use it +0

I've cleared up some code for you as it seems to be in random order. Try this out and let us know what the debug messages say, as your code does not appear to be wrong at first glance.

<input type="file" name="ft_img" style="margin: 0 !important;"><input type="file" name="download" style="margin: 0 !important;">

// Image 1
$imgname1 = $_FILES["ft_img"]["name"];
$imgtype1 = $_FILES["ft_img"]["type"];
$imgtemp1 = $_FILES["ft_img"]["tmp_name"];
$path1 = "./uploads/".$imgname1;
$status = move_uploaded_file($imgtemp1, $path1);

// Debug image 1:
    'Image 1 should have been moved from %s to %s. $status = %s',
    $status ? 'true' : 'false'

// Image 2 (download)
$download  = $_FILES["download"]["name"];
$file_type = $_FILES["download"]["type"];
$file_temp = $_FILES["download"]["tmp_name"];
$file_path1 = "./uploads/".$download;
$status = move_uploaded_file($file_temp, $file_path1);

// Debug image 2:
    'Image 2 should have been moved from %s to %s. $status = %s',
    $status ? 'true' : 'false'

By the way, you do not need to add !important to inline style tags, as inline CSS always overrides existing CSS rules.

you may remove ads by installing AdblockPlus; Id not change anything on main page - its ok....

And it got worse and worse and worse each day. Less traffic also means less advertising revenue, and it got so bad that I've had to spend a huge portion of my savings just being able to afford our hosting bills to keep the site up over the past 2 years.

This is why I don't use things like Adblock. People hosting great sites don't have to do that for free, how could they? At least give them a fair chance of getting some income to play even (at the least).

Nice one! I think I've learned pretty much all I know about HTML and CSS using that website.

You could place your functions inside an anonymous functions like so:

(function($) {



Could you formulate that as a full-scentence question? Maybe some context?

I only included the PHP to remove the duplicate numbers. You will have to print them yourself ;).

It's cool that you are constantly developing Daniweb, but I feel that it's time to mention some things that I feel are missing since the last overhaul:

  1. Can't easily jump to subforums (like "PHP") any more. This isn't really a problem, because I used to just open the "Web development" section anyway, but I think it would be nice to include some tag filtering at the top of a forum now (or maybe in a fixed sidebar).
  2. Can't see who posted the last reply to a discussion. Usually when I see/saw someone of whom I know has knowledge about a subject reply last to a thread, I knew my help probably wasn't really needed there. Now I need to open the dicussion and find the last post to see what is going on.
  3. Too much spacing. There is just so much spacing right now that I don't really see any coherence between what information is related to what other information. Need more borders or clear section separtors. This applies at least to board overviews & discussions.
  4. What is that status bar doing at the top of a discussion (with the x views, 1 reply, etc.)? That is not information I need when I open a discussion. It is nice information but to place it so overly present at the top of the page might be a bit too much. I want to get down to business fast. See the question, see the first reply/replies, see if ...
dtpp commented: true; +1 +0
joshl_1995 commented: So true! +0

Well, a quick search on Google seems to result in an answer to your question.

See http://stackoverflow.com/questions/3366895/group-by-month-and-year-in-mysql

Yes, that is because when you press "next", a new page is loaded and no post values are submitted, which means that $search will be empty on the next page load. Hence the "search term too short" message.

Stuff that gets submitted through the URL cannot be retrieved using $_POST; you need to use $_GET.

Well, I'm glad you discovered the next clue ;). Let us know if you find anything that is wrong with it and if you need help with it.

Ok, this is confusing me somewhat: your file is in the list with included files, but if you output text inside that include file, it isn't being shown on the screen? Or does output get shown on the screen, and is it the "false" that is generated by var_dump(function_exists('Get_Favourites'));? Have you tried using different spelling for your function name and checking (with the function_exists() function) if the function does get defined properly with that spelling?

Well, usually an update query takes longer than a select query because an update query locks the database where a select query does not. Therefore, if you can avoid an update query by running a select query, it might do good to your app's performance. You will need to have use case statistics, however, to see how many times values actually remain unchanged, what the difference in impact is for both scenarios, etc., to be able to give a true answer to your question.

Well yes, it must be that, then. That's why I thought you could try to output var_dump(function_exists('Get_Favourites')); inside the file that defines the function (after the function is defined) to see if it really is a problem with the function definition. Have you tried that?

Ah, I see what you're probably doing wrong now. Your $construct query is ok (apart from the fact that you're not properly escaping user input). Your $getquery function is not ok, though: you insert a whole SELECT query into your WHERE clause, which is not what you want, if I look at the rest of your code. Therefore, you may want to replace your $getquery line with the following:

$query_with_limit = $construct . ' LIMIT ' . mysql_real_escape_string($start) .',' . mysql_real_escape_string($per_page);
$getquery = mysql_query($query_with_limit);

and the $run in

while($runrows = mysql_fetch_assoc($run)) // This while loop will prints search reasults,

by $getquery. Could you check if that makes a difference?

So if you add an echo to the file that defines your Get_Favourites() function, and then include that file, nothing is being echo'd to the screen? E.g. if you add echo 'Hey, you\'ve just included me!';, it doesn't show on the screen? Because if that is the case, you simply need to make sure that your file is properly included.

Well, maybe you could add some debug code to the file that contains that function that says "Hey, you've just included me!" and after that line something like var_dump(function_exists('Get_Favourites')); to see if the function has been defined (bottom lines of the function file).

Well, if it is not in the list that is returned by get_defined_functions() there is something wrong, apparently :p. Is it in the list?

You could write it in the same place that you wrote the get_included_files() function, i.e. the line before the error.

Example: print_r(get_defined_functions()); exit();

Is the file being included before the function is called? Have you checked if there isn't a case problem (not that PHP functions are case sensitive, for as far as I know, but just to be sure)? Have you used get_defined_functions() to see if your function has actually been registered as defined?

You can check whether the correct file (the one that defines the function) has been included by executing print_r(get_included_files()); exit(); the line before the error.

Use the __construct() function. It is called when the object is instantiated (i.e. when you execute $object = new Object();.


class booking_diary {
    // Time Related Variables
    public $booking_start_time; 
    public $booking_end_time;

    public function __construct($a, $b) {
        $this->booking_start_time = $a;
        $this->booking_end_time = $b;

You're probably getting a notice that there is an undefined variable on line 4. That is because $_post does not exist. Variable names in PHP are case-sensitive. This means that you need to use $_POST (with capital letters) - this represents the values that are sent with the POST request.

You will also get a notice if an array key is undefined. That means that if $_POST['user_id'] is undefined, you will be notified of it. This is not a serious error, and you can turn the reporting of notices off with for example:

// Report all errors except E_NOTICE
error_reporting(E_ALL & ~E_NOTICE);

(from php.net)

Code that will probably work:

// Check if $_POST['user_id'] is not empty. If true is returned, assign $_POST['user_id'] to $id. Else, assign null to $id.
$id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;

(In the example above, I use the "ternary operator", see also here and scroll to "Ternary operator").

Change your HTML:

 <div class="form-group">
    <label class="col-xs-3 control-label">What is your full legal name?</label>
    <div class="col-xs-5">
        <p id="user_name_container">Hello <span id="user_name"></span>, nice to meet you!</p>
        <input type="text" class="form-control" name="name" />

Then your Javascript (using jQuery):

$('input[name=name]').keyup(function() {
    if ($(this).val()) {
    else {

It depends on a lot of things. On the browser side it depends on what I have already described, but your browser, obviously, is fully dependant on the system that it runs on. So if your system is for some reason slow, or if your hardware is old, your browser may not be able to work as fast as it wants. And yes, in that case, RAM speed and internet connection speed are involved, but also core processor speed, data transfer speed within the hardware system itself, and other factors as well.

Well, I think you can have some influence on them. You can minify your CSS/Javascript files so that they take up less space, you can offer them gzipped to futher decrease the filesize, and you can write more efficient Javascript. The rest is up to the team that creates the browser.

You should checkout the DateTime class.


$date_1 = new DateTime;
$date_2 = new DateTime;

$date_1->setDate(2015, 02, 01);
$date_1->setTime(0, 0, 0);

$date_2->setDate(2015, 02, 05);
$date_2->setTime(0, 0, 0);

$diff = $date_1->diff($date_2);
echo '$diff: ' . $diff->format('%d days') . '<br>';

// OR:
$date_1->add(new DateTimeInterval('P1Y'); // Adds 1 year to $date_1, check out the DateTimeInterval class.
echo '$date_1 is now: ' . $date_1->format('Y-m-d H:i:s') . '<br>';

Yes. A larger screen will cost more resources to render. Working with a 1920 pixel wide website on a mobile phone isn't something most people want - you'd have to scroll all the time to find the content you want to see.

Next, if you have a slow internet connection and need to download large Javascript, CSS and image resources, a website will take longer to load. Also if your phone is slow, loading more resources and keeping them in memory will use up more of the available resources.

So yes, it's both the size of the resources and the complexity of the actions they execute. And maybe more, but this is what I know.