我想通过在PHP中传递数组变量来从数据库中获取结果

时间:2019-01-08 19:49:54

标签: php

我从URL获取数组,但将其传递给数据库,但未获取结果,但是当我使用print_r并复制粘贴相同的数据时,它给出结果。但是使用可变变量时并没有给我结果。

$var=$_GET['var'];

 $var=urldecode(base64_decode($var));

$data = explode(',', $var);

//print_r($data);

$reg_id=$data[0];
$email_id=mysqli_real_escape_string($db_event,$data[2]);
$event_id=$data[3];

# this is a function to pass the result and it pass through database in where ...
view_ticket($email_id,$event_id,$reg_id);

但是当我这样做时,它会给pe适当的输出:-

$var=$_GET['var'];
$var=urldecode(base64_decode($var));

$data = explode(',', $var);

//print_r($data);

$reg_id=$data[0];
$email_id=mysqli_real_escape_string($db_event,$data[2]);
$event_id=$data[3];

# this is a function to pass the result and it pass through database in where ...
view_ticket('example@exmaple.com',$event_id,$reg_id);

1 个答案:

答案 0 :(得分:-1)

尝试:

$email_id = trim( mysqli_real_escape_string($db_event,$data[2]) );

如果您在example@example.com中看到print_r(),但是它不起作用,我敢打赌,那里只有空白。