Example-1
mysql_fetch_array code demo<?php
//error_reporting(0);
session_start();
include "include/connection.php";
include "include/functions.php";
if(@$_REQUEST['act']=='confregis')
{
$user_id=urldecode($_REQUEST['a']);
$confirm_code=$_REQUEST['b'];
$sql="select * from `users` where `id`='$user_id' and `confirm_code`='$confirm_code'";
$res=mysql_query($sql);
$count=mysql_num_rows($res);
$r=mysql_fetch_array($res);
if($count > 0)
{
$sql1="update `users` set `status`='1' where `id`='$user_id'";
mysql_query($sql1);
$sql2="select * from `users` where `id`='$user_id' and `status`='1'";
$res2=mysql_query($sql2);
$row2=mysql_fetch_array($res2);
$_SESSION['userId']=$row2['id'];
$_SESSION['UserName']=getUserNameByuserId($r['id']);
//$_SESSION['adviser_email']=$row['email'];
header('Location: Location:profile.php');
}
}
header('Location: index.php');
?>
Example-2
<?php
echo $sql="select * from `user_profile` up,`user_freelance` uf,list_industry ind,list_functional_area fa
where up.userId=uf.userId
and uf.industryName=ind.id
and uf.functionalArea=fa.id
and (ind.`industryName` like '%$attrName%' or fa.functionalArea = '%$attrName%')
and up.`status`='1'
and uf.`status`='1' ";
$sql="select * from `user_profile` up,`user_freelance` uf,list_industry ind,list_functional_area fa
where up.userId=uf.userId
and uf.industryName=ind.id
and uf.functionalArea=fa.id
and (ind.`industryName` like '%$attrName%' or fa.`functionalArea` like '%$attrName%')
and up.`status`='1'
and uf.`status`='1' ";
$res= mysql_query($sql);
$count=mysql_num_rows($res);
while($r=mysql_fetch_array($res)){
?>