Do you want handle mouseover click along a elements to browser?

The query which above, gets numbers which not booked. If you want get booked numbers change "NOT BETWEEN" on "BETWEEN".

This query select all numbers avaible from $date1 to date2

SELECT distinct r.roomID 
FROM Rooms as r 
INNER JOIN Bookings as b 
ON r.roomID = b.roomID
WHERE ('2013-03-20' NOT BETWEEN dateFrom AND dateTo) 
    AND ('2013-03-21' NOT BETWEEN dateFrom AND dateTo)

You will be able to use function pathinfo(), If want get filename without it extension.
For example:

echo pathinfo("test.jpeg", PATHINFO_FILENAME);// show test

There are many tools testing web sites. For example you can use w3af for testing xss attack, sqlmap for testing sql injection.

Hi. If you try send data with some domain on to another domain, then this can't do in JavaScript. You must to use JSONP or iframe, for crossdomain requests.

Maybe you don't have module mod_rewrite, in the apache web server.

Hi. You can use jQuery plagin it supports work with AJAX.

After click by the button you not transition to a new page, and begin download file.

For download files not necessarily to use AJAX.
You can this does without use AJAX.

<a href="download.php?file_id=123456" target="_blank">Download File</a>


//execute any actions
//get $file_name by file_id

            $ext = pathinfo($file_name, PATHINFO_EXTENSION);
              case "pdf": $ctype="application/pdf"; break;
              case "zip": $ctype="application/zip"; break;
              case "doc": $ctype="application/msword"; break;
              case "xls": $ctype="application/"; break;
              case "ppt": $ctype="application/"; break;
              case "mp3": $ctype="audio/mp3"; break;
              case "gif": $ctype="image/gif"; break;
              case "png": $ctype="image/png"; break;  
              case "jpeg":
              case "jpg": $ctype="image/jpg"; break;
              default: $ctype="application/force-download";

            header('Content-Description: File Transfer');
            header('Content-Type: '.$ctype);
            header('Content-Disposition: attachment; filename="'.rawurldecode($file_name).'"');
            header('Content-Transfer-Encoding: binary');
            header('Expires: 0');
            header('Cache-Control: private');
            header('Pragma: private');
            header('Content-Length: '.filesize($file_name));
            echo 'File Not FOUND';
OsaMasw commented: I was need for Ajax just for not to relode page, but this code may come in handy someday , thanks +0

After how you executed login, you had in the cookie the variable by name PHPSESSID?

Sorry not noticed you already this did in the file header.php

In the file login.php to the top file you must will cause function session_start()

For to change image a ckick you can use following code

<h1 id="show_movie" onclick="click">Greatest Movies Of All Time</a></h1>
<p id="image">
    <img id="swap_img" src="superman_super.jpg" width="244" height="121" alt="superman shield" />

<script type="text/javascript">
    var movie_aimgs = ["superman_super.jpg","dsadada.png","123.png"];
<script type="text/javascript">

        var curIndex = movie_aimgs.indexOf($("#swap_img").attr("src"));

            curIndex = -1;

        $("#swap_img").attr("src", movie_aimgs[curIndex+1]);


Try execute this code. You wrong wrote a bracket for function ready() and click()

        var value = $('#toggle').attr('value');

        if (value == 'hide'){
            $('#toggle').attr('value', 'show');
        else if (value == 'show')
            $('#toggle').attr('value', 'hide');

What exactly don't work?
Don't execute first condition or a another condition

For change a image hover use following code


You can following code:

var clases = $(".s1").attr("class").split(" ");//get all classes for element with class="s1"
 var className = classes.pop();//if must remove last class
 var className = classes[1];//if must remove 2 class
 $(".s1").removeClass(className);//remove class

I hope this help.

What do you undestand the word "find"? If you must to get a element which have class "s2"


Did you analyze your html in a browser after worked script? There are elements "option" with attribute "selected="selected""
Maybe condition "if($loc_con1[$j] == $loc_con[$i])" never don't cause.

function fetch_all() return array.
Try this

$(".edit").click(function(event) {
                var id = $(this).parents("tr").attr("id");
                alert(id); //Shows the correct id that matches the DB entry
                    type: 'POST',
                    url: 'editevent.php',
                    data: "eventID=" + id,
                    dataType: 'json',
                    success: function(data) 

                            if(data.length > 0)
                                for(key in data)
                                    var tmp = data[key];
                                console.log("no result");


What is strange?
Objects in the array sorted by ABC.
What and it's necessary was to do.

will add in end your script


you should will see sorted array

29 line does the semicolon at the end of line

maybe. Try cause this:

usort($cheesecake, array('CheeseCake','sortByName'))

in function usort() second parameter will not should passed by reference.
what did display error?
how look like array $cheesecake after applying function usort.

ok. method strcmp() take two parametrs strcmp().
Your method sortByName() should look like a following way

public static function sortByName(CheeseCake $c1, CheeseCake $c2)
        return strcmp($c1->name, $c2->name);

$cheesecake = array(new CheeseCake("Apple Cheesecake"), new CheeseCake("Strawberry Cheesecake"), new CheeseCake("Mango Cheesecake"));

usort($cheesecake, array('CheeseCake','sortByName'))
LastMitch commented: Thanks for the example! +5

You can will implement your method sorting and use its together with method usort.

function sortDates($a, $b)
    $timestamp_a = is_int($a) ? $a : strtotime($a);
    $timestamp_b = is_int($b) ? $a : strtotime($b);
    if($timestamp_a == $timestamp_b)
        return 0;

    return $timestamp_a < $timestamp_b ? -1 : 1;

$date = array(1001203200, "10 September 2010", "09/23/2001 00:00:00");

usort($date, 'sortDates');

You can to use functions uasort(), uksort or usort().