Var_dump outputs object(stdClass)#93?

$query = $this->db->query("select `license_key` from `oc_key` where `key`='local_key'");

var_dump($query );

var_dump should output string(58) "select `license_key` from `oc_key` where `key`='local_key'"
but the result
object(stdClass)#93 (3) { ["num_rows"]=> int(1) ["row"]=> array(1) { ["license_key"]=> string(5) "ggggg" } ["rows"]=> array(1) { [0]=> array(1) { ["license_key"]=> string(5) "ggggg" } } }
what's wrong?
July 8th 19 at 15:34
2 answers
July 8th 19 at 15:36
Solution
$query = "select `license_key` from `oc_key` where `key`='local_key'";
var_dump($query);
$query_key = "select `license_key` from `oc_key` where `key`='local_key'";
var_dump($query_key);
$query_res = mysql_query($query_key);
$query_row = mysql_fetch_assoc($query_res);
$lkey = $query_row['license_key'];

Don't tell me why then Warning: mysql_query(): No such file or directory in /home/* on line 34Warning: mysql_query(): A link to the server could not be established in /home/* on line 34Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/* on line 35 - Uriel.Schneid commented on July 8th 19 at 15:39
mysql_ functions are deprecated, use mysqli_ or PDO, well first you need to make a connection to a mysql databasei_connect - Violet_Wiso commented on July 8th 19 at 15:42
"well, first you need to make a connection to the database mysqli_connect"
$query_key = "select `license_key` from `oc_key` where `key`='local_key'";
var_dump($query_key);
tell me why then is triggered var_dump($query_key); it also connects to the database? - Uriel.Schneid commented on July 8th 19 at 15:45
no, php.net/manual/ru/pdo.query.php - Violet_Wiso commented on July 8th 19 at 15:48
July 8th 19 at 15:38
what is $query_res?
var_dump($query ); wrong - Uriel.Schneid commented on July 8th 19 at 15:41

Find more questions by tags PHP