I am using oracle db and I want to output the count of v$session in my php code. But when I run it, php reads it as a variable because of "$". Can anyone help me? Thanks!
This is my code:
$sql = "select COUNT(*) SID from v$session";
$array = oci_parse($conn, $sql);
oci_execute($array);
$row = oci_fetch_array($array);
echo $row;
Error: Notice: Undefined variable: session in C:\xampp\htdocs\test\index.php on line 12
you should change double quotes to single quotes like :
$sql = 'select COUNT(*) SID from v$session';
Strings with double quotes :
<?php
$name = "ilyas";
$age = 42
echo "Hi, my name is $name and I am $age years old.";
?>
this will print :
Hi, my name is ilyas and I am 42 years old.
Strings with single quotes :
<?php
$name = 'ilyas';
echo 'Hi, my name is $name mimo.';
?>
this will print :
Hi, my name is $name mimo.