weixin_33721427 2015-05-07 09:55 采纳率: 0%
浏览 36

在AJAX页面中获取数据

In my AJAX-page I want to fetch data from a database. In my first page I have del image to delete a record. I passed the file cid as 'rmvfile' to the next page and fetched and displayed them on the 2nd page.

In my first page I pass cf_id:

<img src="image/delete1.png" alt="delete" style="width:10px;height:10px" title="Remove" onclick="myFunction('.$fet['cf_id'].');">

function myFunction(cid) {   
    var rmvfile=cid;
    if (confirm("Are you sure you want to Delete the file?") == true) {
        if(cid!='') {
            $.ajax({
                type: 'post',
                url: 'delete_cli_file.php',
                data: {rmvfile: rmvfile},
             });
        }
    }
}

I my 2nd page I use:

<?php
include "config.php";
$s = $_POST['rmvfile'];
$sel = "select cf_id from client_file where cf_id='".$_POST['rmvfile']."'";
$sel1 = mysql_query($sel);

$sfet = mysql_fetch_assoc($sel1);
$file_name = $sfet['file_name'];  //not fetched
$echeck = "delete from client_file where cf_id='".$_POST['rmvfile']."'";
$echk = mysql_query($echeck);
$del = "delete from client_file where file_name = '$file_name' ";
$del1 = mysql_query($del);
?>

$echeck = "delete from client_file where cf_id = '".$_POST['rmvfile']."'"; and $sel="select cf_id from client_file where cf_id='".$_POST['rmvfile']."'"; are working.

My problem is that the value is not fetched in $sfet['file_name'].

  • 写回答

6条回答 默认 最新

  • weixin_33739523 2015-05-07 10:01
    关注

    In your 2nd page

    if($sel1=mysql_query($sel)) //Wrong verification
    

    Use == rather than =

    if($sel1==mysql_query($sel))
    
    评论

报告相同问题?

悬赏问题

  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)