0

hy im using this script but unf cant find the bug related to update the values, its keep telling succesuful update but dsnt update in db...Click Here

3
Contributors
10
Replies
41
Views
2 Years
Discussion Span
Last Post by bolfescu
Featured Replies
  • 1

    You have to debug ajax calls which is easier with tools like Firebug. But anyway, I think you should check the UPDATE query from the `updateMemberAjx()` function. You can try to display the query instead of the success message by assigning the query to a variable in each case statement … Read More

  • Fiddler is also a great tool for debugging ajax calls. Read More

  • 1

    You have to add echo statement to every case instance in the function, something like: function updateMemberAjx() { $sVal = $GLOBALS['MySQL']->escape($_POST['value']); $iId = (int)$_POST['id']; if ($iId && $sVal !== FALSE) { switch ($_POST['columnName']) { case 'first_name': $GLOBALS['MySQL']->res("UPDATE `pd_profiles` SET `first_name`='{$sVal}' WHERE `id`='{$iId}'"); $temp = "UPDATE `pd_profiles` SET `first_name`='{$sVal}' WHERE `id`='{$iId}'"; … Read More

  • 1

    If the path is in the `$aInfo['photo']` row then the code would be: echo '<img src="' . $aInfo['photo'] ">' But you have to make sure the path is correct. Maybe you have to add something to make the path absolute (e.g. http://yoursite.com/images) or be sure that relative path is correct. … Read More

1

You have to debug ajax calls which is easier with tools like Firebug. But anyway, I think you should check the UPDATE query from the updateMemberAjx() function. You can try to display the query instead of the success message by assigning the query to a variable in each case statement like:

case 'first_name':
    $GLOBALS['MySQL']->res("UPDATE `pd_profiles` SET `first_name`='{$sVal}' WHERE `id`='{$iId}'");
    // assign the query to a temp variable
    $temp = "UPDATE `pd_profiles` SET `first_name`='{$sVal}' WHERE `id`='{$iId}'"

and changing line 098 from:

echo 'Successfully saved';

to:

echo $temp;

This way the query will be diplayed upon an update. You can copy it and test in phpmyadmin whether it contains any errors.

Edited by broj1

0

broj1, it show me blank popup, ive tryied con fiddler but i'm nothing see that wouldn be...

1

You have to add echo statement to every case instance in the function, something like:

function updateMemberAjx() {
    $sVal = $GLOBALS['MySQL']->escape($_POST['value']);

    $iId = (int)$_POST['id'];
    if ($iId && $sVal !== FALSE) {
        switch ($_POST['columnName']) {
            case 'first_name':
                $GLOBALS['MySQL']->res("UPDATE `pd_profiles` SET `first_name`='{$sVal}' WHERE `id`='{$iId}'");
                $temp = "UPDATE `pd_profiles` SET `first_name`='{$sVal}' WHERE `id`='{$iId}'";
                break;
            case 'last_name':
                $GLOBALS['MySQL']->res("UPDATE `pd_profiles` SET `last_name`='{$sVal}' WHERE `id`='{$iId}'");
                $temp = "UPDATE `pd_profiles` SET `last_name`='{$sVal}' WHERE `id`='{$iId}'";
                break;
            case 'email':
                $GLOBALS['MySQL']->res("UPDATE `pd_profiles` SET `email`='{$sVal}' WHERE `id`='{$iId}'");
                $temp = "UPDATE `pd_profiles` SET `email`='{$sVal}' WHERE `id`='{$iId}'";
                break;
            case 'status':
                $GLOBALS['MySQL']->res("UPDATE `pd_profiles` SET `status`='{$sVal}' WHERE `id`='{$iId}'");
                $temp = "UPDATE `pd_profiles` SET `status`='{$sVal}' WHERE `id`='{$iId}'";
                break;
            case 'role':
                $GLOBALS['MySQL']->res("UPDATE `pd_profiles` SET `role`='{$sVal}' WHERE `id`='{$iId}'");
                $temp = "UPDATE `pd_profiles` SET `role`='{$sVal}' WHERE `id`='{$iId}'";
                break;
            case 'date_reg':
                $GLOBALS['MySQL']->res("UPDATE `pd_profiles` SET `date_reg`='{$sVal}' WHERE `id`='{$iId}'");
                $temp = "UPDATE `pd_profiles` SET `date_reg`='{$sVal}' WHERE `id`='{$iId}'";
                break;
        }
        // echo 'Successfully saved';
        echo 'DEBUG: ' . $temp;
    }
    exit;
}

Please note that this is very simple and a bit clumsy way of debugging. Using right developer tools is the way to go.

0

Its write DEBUG and blank space...

Edited by bolfescu

0

solved the problem was that the name of case wsnt equale that title of the collums, but i have another question in db i have a row that is a path of a image
how ca i modify this to show the image not the path(like in db)

  $aItem = array(
       $aInfo['photo'],   $aInfo['prodoto'], $aInfo['diametro'], $aInfo['piante_pianali'], $aInfo['piante_cc'], $aInfo['l_a'], $aInfo['l_c'],  $aInfo['l_ing'], $aInfo['flag'], 'DT_RowId' => $aInfo['id']
        );

its the $aInfo photo row....ive tryied with img src but nothing...

1

If the path is in the $aInfo['photo'] row then the code would be:

echo '<img src="' . $aInfo['photo'] ">'

But you have to make sure the path is correct. Maybe you have to add something to make the path absolute (e.g. http://yoursite.com/images) or be sure that relative path is correct.

Maybe you could post sample database rows.

Edited by broj1

0
    foreach ($aMembers as $iID => $aInfo) {
        $aItem = array(

      $aInfo['photo'],   $aInfo['prodoto'], $aInfo['diametro'], $aInfo['piante_pianali'], $aInfo['piante_cc'], $aInfo['l_a'], $aInfo['l_c'],  $aInfo['l_ing'], $aInfo['flag'], 'DT_RowId' => $aInfo['id']
        );
        $output['aaData'][] = $aItem;
    }
    echo json_encode($output);
}

i need to integrated in this array....$aInfo[photo] it is the row of photo

0

Sory, but I do not understand the problem. Could you describe it form start. What you have and what you want to achieve. And post relevant code as well as some relevant sample data.

0

Hy thank your very much, i've solved the problem adding <img src to the photo row, now i'm trying to debug this because its not working its keep telling me not send, i dont have a clue why didnt send, ut the .csv its export
link here Click Here

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.