php – Não executes stored procedures

Ocode for execução das Stored Procedures, is not corrected.

PHP Code:

public function execSPForInsUpd ($ sql)
{

                $ link = connMySQL ();
$ result = @mysqli_multi_query ($ link, $ sql) or die (mysqli_error ($ link));


if (mysqli_multi_query ($ link, $ sql)) {

$ result = mysqli_store_result ($ link);
$ row = mysqli_fetch_row ($ result);
mysqli_fetch_row ($ result);

while ($ link = more_results () && $ link-> next_result ())
{
$ extraResult = $ link-> use_result ();
if ($ extraResult instanceof mysqli_result) {
$ extraResult-> free ();
}
}

$ link = closeConnMySQL ();

return $ row[0];

} else {
echo "

There is no possibility to execute a new instruction. SQL:

$ sql

n "."

Erro MySQL: ". Mysqli_error ($ this-> conn)".

"; exit(); $ link = closeConnMySQL (); } }

PHP code onde will be published as information:

static public function efetuarLogin ($ email, $ senha)
{
require_once & # 39; MySQLDC.php & # 39 ;;

                $ sql = "CALL SP_EFETUARLOGIN (& # 39; $ email & # 39 ;, & # 39; $ senha & # 39;);";

$ mysql = new MySQLDC ();

$ result = $ mysql-> execSPForDataSet ($ sql);

$ JSON = json_encode ($ result);

if ($ JSON = "null") {
$ JSON = "[]";
}

returns & # 39; {"data": & # 39; $ JSON. & # 39; 1 & # 39 ;;

}

}

Stored procedure:

CREATE DEFINER =root@localhost PROCESS SP_EFETUARLOGIN(in cEmail varchar (256), in cSenha varchar (10))
START

SELECT ACCOUNT (*) AS QUANTIDADA of tb_usuario
WHERE EMAIL = email
And SENHA = cSenha;

FINISH

object orientation – User system as a group of permissions in PHP

I'm an intermediary in PHP OO and I'm studying. At that time I need help to study how systems work whose privilege per user group. I have seen the Opencart administrative area and there is a sector that lists access and editing permissions per system area.

Could someone give me material for the study, a script to test and scrutinize how it proceeds?

Thank you.

Saving a php file with emojis

When I replace an HTML emoji with its code and try to save the page:

$ text = preg_replace ("/
2.gif
/ "," & # 128515; ", $ text);

I get a message that says something like "Some items may not be saved correctly since it has Windows-1251 element encoding, etc."

If I continue and save the page, the code after preg_replace is cut and the emoji
2.gif
It seems like a crazy code.
SEMrush

Is there a way to save a php page with HTML emojis in it?

Variable values ​​are not updated PHP

Then follow the variable that adds the faults of students within 4 periods of time and shows the number of faults per period. It always returns the value that is inside the matrix. If 0 is 0, if I replace 1 that returns 1, it should update dynamically.

$ absences = array (
& # 39; 0 & # 39; => 0,
& # 39; 1 & # 39; => 0,
& # 39; 2 & # 39; => 0,
& # 39; 3 & # 39; => 0,
);

Follow the complete code of the complete structure:

    0
& # 39; 1 & # 39; => 0,
& # 39; 2 & # 39; => 0,
& # 39; 3 & # 39; => 0,
);

$ studentAttendance = $ this-> db-> get_where (& # 39; attendance & # 39 ;, array ()
& # 39; section_id & # 39; => $ section_id,
& # 39; class_id & # 39; => $ class_id,
& # 39; year & # 39; => $ running_year,
& # 39; student_id & # 39; => $ student_id,
)) -> result_array ();

($ i = 1, $ i <= 12, $ i ++) {
$ year = exploits (& # 39; - & # 39 ;, $ running_year);
$ days = cal_days_in_month (CAL_GREGORIAN, $ i, $ session_year);
($ d = 1, $ d <= $ days, $ d ++)
$ timestamp = strtotime ($ d. & # 39; - & # 39 ;. $ i. & # 39; - & # 39 ;. $ session_year);

$ attendance = array_filter ($ studentAttendance, function ($ v) use ($ timestamp) {
return ($ v['timestamp'] == $ timestamp);
});

($ ab = 0; $ ab. < sizeof($attendance); $ab++) {
          if ($attendance[$ab]['status'] == 2) {
            $attd = gmdate("Y-m-dTH:i:sZ", $attendance[$ab]['timestamp']);
            $attTimestamp = new DateTime($attd);
            // echo $attTimestamp->FORMAT (& # 39; m / d / y & # 39;);

$ dateBegin = new DateTime ($ period_data-> first_start);
$ dateEnd = new DateTime ($ period_data-> first_end);

($ attTimestamp-> getTimestamp ()> $ dateBegin-> getTimestamp () && $ attTimestamp-> getTimestamp () < $dateEnd->getTimestamp ())
$ absences[0]++;

$ dateBegin = new DateTime ($ period_data-> second_start);
$ dateEnd = new DateTime ($ period_data-> second_end);

($ attTimestamp-> getTimestamp ()> $ dateBegin-> getTimestamp () && $ attTimestamp-> getTimestamp () < $dateEnd->getTimestamp ())
$ absences[1]++;

$ dateBegin = new DateTime ($ period_data-> third_start);
$ dateEnd = new DateTime ($ period_data-> third_end);

($ attTimestamp-> getTimestamp ()> $ dateBegin-> getTimestamp () && $ attTimestamp-> getTimestamp () < $dateEnd->getTimestamp ())
$ absences[2]++;

$ dateBegin = new DateTime ($ period_data-> fourth_start);
$ dateEnd = new DateTime ($ period_data-> fourth_end);

($ attTimestamp-> getTimestamp ()> $ dateBegin-> getTimestamp () && $ attTimestamp-> getTimestamp () < $dateEnd->getTimestamp ())
$ absences[3]++;
}
}
}
}
?>
  

What can I be forgetting or doing wrong?