Hi All!

I am new to the PHP thing, but I have been coding in general for years. For whatever reason though, I have not gotten into Classes.

In an effort to learn PHP, jQuery and AJAX I have been going through tutorials. This particular one has a class with methods (of course). The methods are called via AJAX using jQuery calls.

I was able to echo back using an alert box that the AJAX was called. However, I have no idea how to echo/alert box back values from the method itself:

PHP Code:
/* The rearrange method is called when the ordering of the todo list
       is changed. Takes an array parameter, which contains the ids of the 
       todos in the new order */
    
public static function rearrange($key_value){
        
$updateVals = array();
        foreach(
$key_value as $k=>$v){
            
$strVals[] = 'WHEN '.(int)$v' THEN '.((int)$k+1).PHP_EOL;
        }
        
        if(!
$strVals) throw new Exception("No data");
        
        
//We are using a CASE SQL operator to update the ToDo positions en masse:
        
        
$query "UPDATE items SET position = CASE id ".join($strVals)." ELSE position END";
        
mysql_query($query);
        if(
mysql_error($GLOBALS['link'])){
            throw new 
Exception("Error updating positions");    
        }
    } 
First, I want to see if it got to the method at all, then I'd like to output the various variables found to see what they contain. I'd even like to output the querystring.

My method looks just like the tutorial's, but the database is not updating. I should add that the database is not MySQL 5.0, but rather MySQL 4.0 (I do have access to MySQL 5.0 and can rebuild in a new one if necessary, but it is an older DB and has a lot of tables) so I am not sure if the CASE statement is correct in the SQL query.

I do have a DB connection because the elements displayed on the page are from a SELECT.

Thanks in advance!

Evie