JSON Encode PHP - php

So this is my code:
<?php
ini_set('max_execution_time', 150);
require('db.php');
$values = array();
$data = array();
$username = $_GET['username'];
$username = $mysqli->real_escape_string($username);
$password = $_GET['password'];
$password = $mysqli->real_escape_string($password);
$query = $mysqli->query("SELECT premium_duration, vip_duration
FROM
users_account
WHERE
user_name='".$username."'
AND user_pass='".md5($password)."'
");
while($row = $query->fetch_assoc())
{
if($row['premium_duration'] > 0)
{
$timeremain = $row['premium_duration'];
$type = 'Premium';
}elseif($row['vip_duration'] > 0)
{
$timeremain = $row['vip_duration'];
$type = 'VIP';
}else{
$timeremain = 0;
$type = 'None';
}
$values['TimeRemain'] = $timeremain;
$values['Type'] = $type;
$data[] = $values;
}
echo json_encode(array("Durations" => ($data)));
?>
But it only results to:
{"Durations":[{"TimeRemain":"15847800","Type":"Premium"}]}
What I want to achieve is:
{ "Durations"😞 { "TimeRemain":74973600, "Type":"Premium"
}, { "TimeRemain":0, "Type":"VIP" } ] }
How I can do that?

Related

Get multilevel json from mysql db and php

I have the tables
I want to retrieve a json string of the format
[{
"topic_id":"1",
"topic_title":"Input and Output devices",
"topic_image":"inputs.png",
"subtopics": {
"subtopic_id":"1",
"subtopic_title":"Inputs",
"subtopic_file_url":"0"
},
{
"subtopic_id":"2",
"subtopic_title":"Outputs",
"subtopic_file_url":"0"
}
}]
What I tried
// set the resulting array to associative
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
foreach ($result as $key => $value) {
$topic[$key]['topic_id'] = $value['topic_id'];
$topic[$key]['topic_title'] = $value['topic_title'];
$topic[$key]['topic_image'] = $value['topic_image'];
$topic[$key]['subtopics']['subtopic_id'] = $value['subtopicid'];
$topic[$key]['subtopics']['subtopic_title'] = $value['subtopic_title'];
$topic[$key]['subtopics']['subtopic_file_url'] = $value['file_url'];
$topic[$key]['subtopics']['subtopicid'] = $value['subtopicid'];
}
print 'PHP_ARRAY: ';print_r($topic);
$topic = json_encode ( $topic );
The script above returns topic details for each subtopic.
This code has worked. Thank you everyone
<?php
$servername = "***";
$username = "****";
$password = "***";
$dbname = "****";
function searchForId($id, $array) {
foreach ($array as $key => $val) {
if ($val['topic_id'] === $id) {
return $key;
}
}
return null;
}
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("select a.topic_id, a.topic_title, a.topic_image, b.subtopicid,b.subtopic_title,b.file_url from topics a join subtopics b on b.topic_id = a.topic_id ");
$stmt->execute();
// set the resulting array to associative
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$x = 0;
foreach ($result as $key => $value) {
if($x != 0){
if($topic[$x-1]['topic_id'] != $value['topic_id']) {
$topic[$x]['topic_id'] = $topic_id = $value['topic_id'];
$topic[$x]['topic_title'] = $value['topic_title'];
$topic[$x]['topic_image'] = $value['topic_image'];
$x++;
}
} else {
$topic[$key]['topic_id'] = $topic_id = $value['topic_id'];
$topic[$key]['topic_title'] = $value['topic_title'];
$topic[$key]['topic_image'] = $value['topic_image'];
$x++;
}
}
$x = $y = 0;
foreach ($result as $key => $value) {
if($y != searchForId($value['topic_id'], $topic))
$x = 0;
$y = searchForId($value['topic_id'], $topic);
$topic[$y]['subtopics'][$x]['subtopic_id'] = $value['subtopicid'];
$topic[$y]['subtopics'][$x]['subtopic_title'] = $value['subtopic_title'];
$topic[$y]['subtopics'][$x]['subtopic_file_url'] = $value['file_url'];
// $topic[$y]['subtopics'][$x]['subtopicid'] = $value['subtopicid'];
$x++;
}
// foreach ($result as $key => $value) {
// }
//print 'PHP_ARRAY: ';print_r($topic);
$topic = json_encode ( $topic );
print_r($topic);
}
catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
$conn = null;
?>

Don't encode json from php

I have 2 files php: connect.php and getsp.php. As follow:
- Connect.php:
$host = "localhost";
$username = "root";
$password = "";
$database = "thietbi";
$conn = mysqli_connect($host, $username, $password, $database);
mysqli_query($conn, "SET NAMES 'uft8'");
- Getsp.php
include "connect.php";
// mysqli_set_charset($conn, "utf8");
$page = $_GET['page'];
$idsp = 1;
$space = 5;
$limit = ($page - 1) * $space;
$mangsanpham = array();
$query = "SELECT * FROM sanpham WHERE idsanpham = $idsp LIMIT $limit,$space";
$data = mysqli_query($conn,$query);
while ($row = mysqli_fetch_assoc($data)) {
$id = $row['id'];
$tsp = $row['tensanpham'];
$gsp = $row['giasanpham'];
$hsp = $row['hinhanhsanpham'];
$mtsp = $row['motasanpham'];
$isp = $row['idsanpham']));
array_push($mangsanpham, new Sanpham($id, $tsp, $gsp, $hsp, $mtsp, $isp));
}
echo json_encode($mangsanpham);
class Sanpham{
function Sanpham($id, $tensp, $giasp, $hinhsp, $motasp, $idsanpham){
$this->id = $id;
$this->tensp = $tensp;
$this->giasp = $giasp;
$this->hinhsp = $hinhsp;
$this->motasp = $motasp;
$this->idsanpham = $idsanpham;
}
}
When I run file "Getsp.php", result is white blank page.
I replace getsp.php with content:
include "connect.php";
// mysqli_set_charset($conn, "utf8");
$page = $_GET['page'];
$idsp = 1;
$space = 5;
$limit = ($page - 1) * $space;
$mangsanpham = array();
$query = "SELECT * FROM sanpham WHERE idsanpham = $idsp LIMIT $limit,$space";
$data = mysqli_query($conn,$query);
while ($row = mysqli_fetch_assoc($data)) {
array_push($mangsanpham, new Sanpham(
$row['id'],
$row['tensanpham'],
$row['giasanpham'],
$row['hinhanhsanpham'],
$row['motasanpham'],
$row['idsanpham']));
}
echo json_encode($mangsanpham);
class Sanpham{
function Sanpham($id, $tensp, $giasp, $hinhsp, $motasp, $idsanpham){
$this->id = $id;
$this->tensp = $tensp;
$this->giasp = $giasp;
$this->hinhsp = $hinhsp;
$this->motasp = $motasp;
$this->idsanpham = $idsanpham;
}
}
The result is not. Where did I wrong?
I tried 2 ways:
$json = json_encode($mangsanpham, JSON_PRETTY_PRINT);
print_r($json);
and
echo json_encode($mangsanpham);
The results are not encode JSON. Hope to get help from everyone!
To use array_push, you have to declare first variable as array
i.e $mangsanpham = array(); //before while loop

issue in student data updation

I have a table of student details. and i have two csv files,these files contains updated information of existing students and new students data.if data not in student table which means the student left the school.
update new details for existing students
If student left school update status the to zero
If new student,then add as new row(with details from both csv)
Below is my code but in this second file information not getting updated.
i am attaching my code.if anybody have simple solution,please suggest
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "student";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if (isset($_POST['submit'])) {
$sql = "SELECT * FROM e_student";
$result_main = $conn->query($sql);
$filea = $_FILES['filea'];
$ext = pathinfo($_FILES['filea']['name'], PATHINFO_EXTENSION);
if ($ext == "csv" && $_FILES["filea"]["error"] == 0) {
$target = "upload/" . $_FILES["filea"]["name"];
move_uploaded_file($_FILES["filea"]["tmp_name"], $target);
if (($handle = fopen($target, "r")) !== FALSE) {
$array = $fields = array();
$i = 0;
while (($row = fgetcsv($handle, 4096)) !== false) {
if (empty($fields)) {
$fields = $row;
continue;
}
foreach ($row as $k => $value) {
$array[$i][$fields[$k]] = $value;
}
$i++;
}
fclose($handle);
}
}
$ext1 = pathinfo($_FILES['fileb']['name'], PATHINFO_EXTENSION);
if ($ext1 == "csv" && $_FILES["fileb"]["error"] == 0) {
$target1 = "upload/" . $_FILES["fileb"]["name"];
move_uploaded_file($_FILES["fileb"]["tmp_name"], $target1);
if (($handle = fopen($target1, "r")) !== FALSE) {
$array1 = $fields1 = array();
$j = 0;
while (($row1 = fgetcsv($handle, 4096)) !== false) {
if (empty($fields1)) {
$fields1 = $row1;
continue;
}
foreach ($row1 as $k => $value) {
$array1[$j][$fields1[$k]] = $value;
}
$j++;
}
fclose($handle);
}
}
foreach ($result_main as $rel) {
$clk = 'no';
foreach ($array as $arr) {
if(isset($arr1['SCD']))
{
if (strcmp(trim($rel['objId']), trim($arr['BCEID'])) == 0) {
$clk = 'yes';
$name = $arr['FirstName'];
$conditn = $rel['objId'];
$last_name = $arr['LegalSurname'];
$year_level = $arr['YearLevelName'];
$email = $arr['BCEEmail'];
$username = $arr['BCELogin'];
$StEnrollmentStatus = 1;
$sql1 = "UPDATE e_student SET Name = '$name',Lastname='$last_name',stYearLevel='$year_level',email='$email',username='$username' WHERE objId ='$conditn'";
$result = $conn->query($sql1);
if($result)
{
updateparent($rel['objId'], $array1,$conn);
}
}
}
}
if ($clk == 'no') {
$conditn = $rel['objId'];
$status = 0;
$pastoral = "Not Currently Enrolled";
$sql1 = "UPDATE e_student SET stEnrollmentStatus = '$status',stPastoral='$pastoral' WHERE objId ='$conditn'";
$result = $conn->query($sql1);
}
}
foreach ($array as $ar1) {
foreach ($result_main as $rel1) {
if (strcmp(trim($ar1['BCEID']), trim($rel1['objId'])) != 0) {
$name = $ar1['FirstName'];
$last_name = $ar1['LegalSurname'];
$year_level = $ar1['YearLevelName'];
$email = $ar1['BCEEmail'];
$objid = $ar1['BCEID'];
$username = $ar1['BCELogin'];
$StEnrollmentStatus = 1;
$sql3 = "INSERT INTO e_student(Name,Lastname,stYearLevel,email,objId,username,stEnrollmentStatus) VALUES('$name','$last_name','$year_level','$email','$objid','$username','$StEnrollmentStatus')";
$result1 = $conn->query($sql3);
if($result1)
{
updateparent1($objid, $array1,$conn);
}
}
}
}
echo "<h3><center>SUCCESSFULLY UPDATED</center></h3>";
}
function updateparent($objid, $array1,$conn) {
foreach ($array1 as $arr1) {
if(isset($arr1['SCD']))
{
if (strcmp(trim($objid), trim($arr1['SCD'])) == 0) {
$parent = $arr1['PTI1'] . $arr1['PFN1'] . $arr1['PSN1'];
echo $parent;
$email = $arr1['PEM1'];
}
$sql2 = "UPDATE e_student SET stParentName = '$parent',stParentEmail='$email' WHERE objId ='$objid'";
$result = $conn->query($sql2);
}
}
}
function updateparent1($objid, $array1,$conn) {
foreach ($array1 as $arr1) {
if(isset($arr1['SCD']))
{
echo $arr1['SCD'];
if (strcmp(trim($objid), trim($arr1['SCD'])) == 0) {
$parent = $arr1['PTI1'] . $arr1['PFN1'] . $arr1['PSN1'];
$email = $arr1['PEM1'];
}
$sql2 = "UPDATE e_student SET stParentName = '$parent',stParentEmail='$email' WHERE objId ='$objid'";
$result = $conn->query($sql2);
}
}
}
?>

Fatal error: Call to a member function get() on null in C:\wamp\www\Cocolani\php\req\checkusername.php on line 4

I get an error in my file "checkusername.php".
The error I get is:
( ! ) Fatal error: Call to a member function get() on null in
C:\wamp\www\Cocolani\php\req\checkusername.php on line 4
There is a "checkusername.php" file :
<?php
include_once("../../includes/db.php");
include_once("settings.php");
$db = new database($obj->get("db_name"), $obj->get("db_server"), $obj->get("db_user"), $obj->get("db_password"), $obj->get("url_root"));
$username = isset($_POST['username']) ? mysqli_real_escape_string($_POST['username']) : "";
$password = isset($_POST['password']) ? mysqli_real_escape_string($_POST['password']) : "";
$email = isset($_POST['email']) ? mysqli_real_escape_string($_POST['email']) : '';
$birthdate = isset($_POST['birthdate']) ? mysqli_real_escape_string($_POST['birthdate']) : "";
$firstname = isset($_POST['firstname']) ? mysqli_real_escape_string($_POST['firstname']) : "";
$lastname = isset($_POST['lastname']) ? mysqli_real_escape_string($_POST['lastname']) : "";
$sex = isset($_POST['sex']) ? mysqli_real_escape_string($_POST['sex']) : "";
$tribeid = isset($_POST['clan']) ? mysqli_real_escape_string($_POST['clan']) : "";
$mask = isset($_POST['mask']) ? mysqli_real_escape_string($_POST['mask']) : "";
$mask_color = isset($_POST['maskcl']) ? mysqli_real_escape_string($_POST['maskcl']) : "";
$lang_id = isset($_POST['lang_id']) ? addslashes($_POST['lang_id']) : 0;
$error = '';
// get language suffix
if ($lang_id != 0) {
$db->setQuery("SELECT * FROM `cc_extra_langs` WHERE id='{$lang_id}'");
$res = $db->loadResult();
$lang = "_".$res->lang;
} else $lang = "";
$reg_ok = true;
$db->setQuery("SELECT one_email_per_registration FROM `cc_def_settings`");
$res = $db->loadResult();
$one_registration_per_email = ($res->one_email_per_registration == 1);
$email_check_ok = true;
if ($one_registration_per_email == true) {
$sql = "SELECT COUNT(*) AS counter FROM `cc_user` WHERE email='{$email}'"; // for several registrations per one email address -- no check
$db->setQuery($sql);
$res1 = $db->loadResult();
$email_check_ok = $res1->counter == "0";
}
if ($email_check_ok == false) {
$sql = "SELECT * FROM `cc_translations` WHERE caption='DUPLICATED_EMAIL'";
$db->setQuery($sql);
$res = $db->loadResult();
echo 'error='.urlencode($res->{"name".$lang});
$reg_ok = false;
}
/*if ($reg_ok && $email != '') {
// get number of already registered number of registrations with this email address
$sql = "SELECT count(*) as registered_num_emails FROM `cc_user` WHERE email='{$email}'";
$query = $db->setQuery($sql);
$row = mysql_fetch_object($query);
$registered_num_emails = $row->registered_num_emails;
$sql = "SELECT max_num_account_per_email from `cc_def_settings`";
$query = $db->setQuery($sql);
$row = mysql_fetch_object($query);
// it's possible to create new registration using this email address
if ($registered_num_emails >= $row->max_num_account_per_email) {
$sql = "SELECT * FROM `cc_translations` WHERE caption='MAX_NUM_REGISTRATION_REACHED'";
$db->setQuery($sql);
$res = $db->loadResult();
echo 'error='.urlencode($res->{"name".$lang});
$reg_ok = false;
}
}*/
////////
// echo 'error=111';
// $reg_ok = false;
////////
if ($reg_ok) {
// check for swear words
$db->setQuery("SELECT COUNT(*) as counter from `cc_swear_words` where INSTR('".$username."', `name`)");
$res2 = $db->loadResult();
if ((int)($res2->counter) > 0) { // swear word founded!
$sql = "SELECT * FROM `cc_translations` WHERE caption='USERNAME_NOT_PERMITTED'";
$db->setQuery($sql);
$res = $db->loadResult();
echo 'error='.urlencode($res->{"name".$lang});
$reg_ok = false;
}
}
if ($reg_ok) {
// first check there is no username with this name already registered.
$db->setQuery("SELECT COUNT(*) AS counter FROM `cc_user` WHERE username='".$username."'");
$res = $db->loadResult();
if ((int)($res->counter) > 0) { // swear word founded!
// get warning message from db
$db->setQuery("SELECT * FROM `cc_translations` WHERE caption='USERNAME_IN_USE'");
$res = $db->loadResult();
echo 'error='.urlencode($res->{"name".$lang});
$reg_ok = false;
}
}
if ($reg_ok) echo 'result=true';
?>
The problem on line 4 which is :
$db = new database($obj->get("db_name"), $obj->get("db_server"), $obj->get("db_user"), $obj->get("db_password"), $obj->get("url_root"));
There is a "settings.php" :
<?php
$db_server = "localhost";
$db_user = "root";
$db_password = "pass1234";
$db_name = "cocolani_battle";
$appsecret = "80f730a73ac60417c36c341bc975f6f1";
$connect = mysqli_connect("$db_server","$db_user","$db_password","$db_name");
?>
and there is a "db.php" :
<?php
/*
Usage
$db = new database($dbname);
for selects:
$db->setQuery("SELECT * FROM `table`")
$resultArray = $db->loadResults();
$db->setQuery("SELECT * FROM `table` WHERE `primary_id` = '1'");
$resultObject = $db->loadResult();
for inserts:
$db->setQuery("INSERT INTO `table` (`id`, `example`) VALUES ('1', 'abc')");
if (!$db->runQuery()) {
echo $db->getError();
}
*/
class database {
var $_debug = 0;
var $_sql = '';
var $_error = '';
var $_prefix = '';
var $_numrows = 0;
var $_DBhost = 'localhost';
var $_DBuser = "root";
var $_DBpass = "pass1234";
var $_DBname = "cocolani_battle";
var $url_root = "localhost/cocolani";
public function __construct($dbname = 'cocolani_battle', $dbuser = 'root', $dbpsw = 'pass1234', $dbhost = 'localhost', $urlroot = 'localhost/cocolani') {
$this->_DBname = 'cocolani_battle';
$this->_DBuser = 'root';
$this->_DBpass = 'pass1234';
$this->url_root = 'localhost/cocolani';
$this->_DBhost = 'localhost';
$this->_connection = mysqli_connect($this->_DBhost, $this->_DBuser, $this->_DBpass) or die("Couldn't connect to MySQL");
mysqli_select_db($this->_connection, $this->_DBname) or die("Select DB Error: ".mysqli_error());
}
public function __destruct() {
mysqli_close($this->_connection);
}
function debug($debug_level) {
$this->_debug = intval($debug_level);
}
function setQuery($sql) {
/* queries are given in the form of #__table need to replace that with the prefix */
$this->_sql = str_replace('#__', $this->_prefix.'_', $sql);
}
function getQuery() {
return "<pre>" . htmlspecialchars( $this->_sql) . "</pre>";
}
function prepareStatement($sql) {
$this->sql = mysqli_prepare($this->_connection, $sql);
return $this->sql;
}
function runQuery($num_rows=0) {
mysqli_select_db($this->_connection, $this->_DBname) or die("Select DB Error: ".mysqli_error());
$this->_numrows = 0;
$result = mysqli_query($this->_connection, $this->_sql);
if ($this->_debug > 1) echo "<pre>" . htmlspecialchars( $this->_sql) . "</pre>";
if (!$result) {
$this->_error = mysqli_error($this->_connection);
if ($this->_debug) {
echo 'Error: ' . $this->getQuery() . $this->_error;
}
return false;
}
if ($num_rows) {
$this->_numrows = mysqli_num_rows($result);
}
return $result;
}
/* Retrieve Mysql insert id */
function mysqlInsertID() {
$insert_id = mysqli_insert_id();
return $insert_id;
}
/* Escapes special characters while inserting to db */
function db_input($string) {
if (is_array($string)) {
$retArray = array();
foreach($string as $key => $value) {
$value = (get_magic_quotes_gpc() ? stripslashes($value) : $value);
$retArray[$key] = mysqli_real_escape_string($value);
}
return $retArray;
} else {
$string = (get_magic_quotes_gpc() ? stripslashes($string) : $string);
return mysqli_real_escape_string($string);
}
}
function getError() {
return $this->_error;
}
/* Load results into csv formatted string */
function loadCsv() {
if (!($res = $this->runQuery())) {
return null;
}
$csv_string = '';
while ($row = mysqli_fetch_row($res)) {
$line = '';
foreach( $row as $value ) {
if ( ( !isset( $value ) ) || ( $value == "" ) ) {
$value = ",";
} else {
$value = $value. ",";
$value = str_replace( '"' , '""' , $value );
}
$line .= $value;
}
$line = substr($line, 0, -1);
$csv_string .= trim( $line ) . "\n";
}
$csv_string = str_replace( "\r" , "" , $csv_string );
//$csv_string .= implode(",", $row) . "\n";
mysqli_free_result($res);
return $csv_string;
}
/* Load multiple results */
function loadResults($key='' ) {
if (!($res = $this->runQuery())) {
return null;
}
$array = array();
while ($row = mysqli_fetch_object($res)) {
if ($key) {
$array[strtolower($row->$key)] = $row;
} else {
$array[] = $row;
}
}
mysqli_free_result($res);
return $array;
}
function loadResult() {
if (!($res = $this->runQuery())) {
if ($this->_debug) echo 'Error: ' . $this->_error;
return null;
}
$row = mysqli_fetch_object($res);
mysqli_free_result($res);
return $row;
}
/* Load a result field into an array */
function loadArray() {
if (!($res = $this->runQuery())) {
return null;
}
$array = array();
while ($row = mysql_fetch_row($res)) {
$array[] = $row[0];
}
mysqli_free_result($res);
return $array;
}
/* Load a row into an associative an array */
function loadAssoc() {
if (!($res = $this->runQuery())) {
return null;
}
$row = mysqli_fetch_assoc($res);
mysqli_free_result($res);
return $row;
}
/* Return one field */
function loadField() {
if (!($res = $this->runQuery())) {
return null;
}
while ($row = mysql_fetch_row($res)) {
$field = $row[0];
}
mysqli_free_result($res);
return $field;
}
}
/*if ($_SERVER["SERVER_ADDR"] == '127.0.0.1') {
$url_root = "http://cocolani.localhost";
} else {
$url_root = "http://dev.cocolani.com";
}*/
?>
How can I fix this error?
As I mentioned in my comment, you can either use the variables you defined in your settings.php:
$db = new database($db_name, $db_server, $db_user, $db_password, $db_urlroot); // You didn't define $db_urlroot anywhere, but you can define it
OR hard-code it into your class. You're not using the variables you pass in anyway, so there's no need to ask for them.
public function __construct() {

Out Of Memory Exception Xampp

I have this function :
public function RemplirTab($nomCol)
{
$username = $this->getDb()->getUsername();
$sql = "SELECT DISTINCT $nomCol
FROM nautilus_users_page, nautilus_users_acces, nautilus_users_droit, nautilus_users_privilege, nautilus_users_menu
WHERE nautilus_users_page.id_page = nautilus_users_acces.id_page
AND nautilus_users_acces.id_droit = nautilus_users_droit.id_droit
AND nautilus_users_droit.id_droit = nautilus_users_privilege.id_droit
AND nautilus_users_page.id_menu = nautilus_users_menu.id_menu
AND login='$username'";
$row = $this->getDb()->fetchAssoc($sql, array($nomCol, $username));
$i = -1;
$Tab = array();
while($result = $row)
{
$i = $i+1;
$Tab[$i] = $result[$nomCol];
}
return $Tab;
}
Which shows me an error:
I use Silex with Doctrine DBAL.
This function was mysqli with this form:
function RemplirTab($nomCol, $login)
{
$sql = "SELECT DISTINCT $nomCol
FROM nautilus_users_page, nautilus_users_acces, nautilus_users_droit, nautilus_users_privilege, nautilus_users_menu
WHERE nautilus_users_page.id_page = nautilus_users_acces.id_page
AND nautilus_users_acces.id_droit = nautilus_users_droit.id_droit
AND nautilus_users_droit.id_droit = nautilus_users_privilege.id_droit
AND nautilus_users_page.id_menu = nautilus_users_menu.id_menu
AND login='$login'";
$link = connectdb('nautilus_users');
$req = execquery($link, utf8_decode($sql));
$i = -1;
while($row = $req->fetch_assoc())
{
$i = $i+1;
$Tab[$i] = $row[$nomCol];
}
return $Tab;
}

Categories