Hi everybody, i have problem in my php code (it just showing nothing....means no error no results).......can anybody tell me what is wrong with this code.....i'm new to PHP........here is my code
<?php
try
{
$config=array(
'DB_USERNAME'=>'root',
'DB_PASSWORD'=>''
);
$conn=new PDO('mysql:host=localhost;dbname=scc',$config['DB_USERNAME'],$config['DB_PASSWORD']);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo rand_id();
}
catch(Exception $e)
{
echo 'error: '.$e->getMessage();
}
function rand_id()
{
$id=rand(1200,9600);
$results=$conn->query("select * from student_personal_info where id='".$id."'");
if($results->rowCount()>0)
{ rand_id(); }
else
{
return $id; }
}
?>
plz help me waiting for reply..................