hello i need help
hello i need help
</XZayronTR>
Posts: 2Questions: 0Answers: 0
Hello, I'm trying to print the id that I have taken with ssp, using the formatter on the same page, with a 'pdo' connection, to print the data I have taken from another data according to the id I have, but I am having a problem; I'm new please excuse my mistakes.
codes:
$columns = array(
array('db'=>'id','dt'=>0),
array('db'=>'username','dt'=>1),
array('db'=>'password','dt'=>2),
array('db'=>'exp_date','dt'=>3, 'formatter'=>function($data){
if ($data == ''){
return "<span class='badge badge-secondary'><font color='#ffff00'>Unlimited</font></span>";
}else{
return date('d/m/Y H:i:s',$data);
}
}),
array('db'=>'member_id','dt'=>4, 'formatter'=>function($data){
$say = $dbDeatils->query("select * from reg_users where id='$data'")->fetch(PDO::FETCH_ASSOC);
$asd = $say['username'];
return $asd;
}),
array('db'=>'member_id','dt'=>4),
array('db'=>'max_connections','dt'=>5),
array('db'=>'enabled','dt'=>6, 'formatter'=>function($data){
if ($data == 1){return "<span class='badge badge-success'>Enabled</span>";}else{return "<span class='badge badge-danger'>Disabled</span>";};
}),
array('db'=>'id','dt'=>7, 'formatter'=>function($data){
return "<a href = 'user_edit.php?id={$data}' ><font color='#5B5B5B'><i class='fa fa-pencil' aria-hidden='true'></i></font></a> <a href = 'transactions.php?action=start&id={$data}' ><font color='#00b91c'><i class='fa fa-power-off' aria-hidden='true'></i></font></a> <a href = 'transactions.php?action=stop&id={$data}' ><font color='#bc0d00'><i class='fa fa-power-off' aria-hidden='true'></i></font></a> <a href = 'transactions.php?action=delete&id={$data}' ><font color='#DA0000'><i class='fa fa-times' aria-hidden='true'></i></font></a>";
})
);
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Replies
You haven't said what problem you're having! Are you seeing errors? What happens when you run that script on the server?
Colin
array('db'=>'member_id','dt'=>4, 'formatter'=>function($data){
$say = $dbDeatils->query("select * from reg_users where id='$data'")->fetch(PDO::FETCH_ASSOC);
$asd = $say['username'];
return $asd;
}),
when i write this part of the code i get this error : https://prnt.sc/_vJWYaWgAyzJ
You are expected to follow the link provided in the error message, which shows explanatory notes and diagnostic steps.