This is my blogic.php file. The problem is i have created a patient login form and a database name"gmd" so as soon as i fill in d username n password in patient login form it should retrieve the whole information from "gmd" database bt it is showing an error in ma blogic file n pops out "server not connected". please help me i have very less time to submit ma project. Below is the blogic file and after that i have posted the error too.
<?php
$link;
$val1;
$val2;
function connection()
{
global $link;
$link=mysql_connect("localhost",'root','') or die("server not connected");
$db=mysql_select_db("gmd") or die("db not selected");
}
function insert($qr)
{
global $link;
$qr1=$qr;
$result=mysql_query($qr,$link) or die("query not fired");
echo "Record successfully inserted";
}
function delete($qr)
{
global $link;
$qr1=$qr;
$result=mysql_query($qr,$link) or die("query not fired");
echo "Record successfully deleted";
}
function update($qr)
{
global $link;
$qr1=$qr;
$result=mysql_query($qr,$link) or die("query not fired");
echo "Record successfully updated<br/>";
echo("<a href=\"pdashboard.php\">go to home</a>");;
}
function search($qr,$table)
{
global $link,$val1,$val2,$name,$address,$gender,$age,$emailid,$password,$username;
$a="patient";
$qr1=$qr;
$result=mysql_query($qr1,$link);
if(mysql_affected_rows()>0)
{if($result)
{session_start();
$_SESSION['user']=$_POST['username'];
$temp=$_SESSION['user'];
session_id();
while($col=mysql_fetch_row($result))
{
$name=$col[0];
$address=$col[1];
$gender=$col[2];
$age=$col[3];
if($table==$a)
{$emailid=$col[4];
$password=$col[5];
$username=$col[6];
}
else
{$specialization=$col[4];
$username=$col[5];
$emailid=$col[6];
$password=$col[7];
}
$val1= $col[6];
$val2= $col[5];
}
$_SESSION['age']=$age;
$_SESSION['name']=$name;
$_SESSION['emailid']=$emailid;
$_SESSION['address']=$address;
if($table==$a){$_SESSION['id']=$a;header("location:Pdashboard.php");}
else{$_SESSION['id']="doctor";header("location:ddashboard.php");}
}
else
{echo "Invalid username or password";
}
}
else
{
echo "NO RECORD FOUND";
}
}
?>
//the error that is occuring
( ! ) Warning: mysql_connect() [function.mysql-connect]: [2002] An attempt was made to access a socket in a way forbidden by its (trying to connect via tcp://localhost:3306) in C:\wamp\www\myprojectpr\blogic.php on line 9
Call Stack
# Time Memory Function Location
1 0.0041 675144 {main}( ) ..\patientlogin.php:0
2 0.0223 711912 connection( ) ..\patientlogin.php:5
3 0.0223 712336 mysql_connect ( ) ..\blogic.php:9
( ! ) Warning: mysql_connect() [function.mysql-connect]: An attempt was made to access a socket in a way forbidden by its access permissions. in C:\wamp\www\myprojectpr\blogic.php on line 9
Call Stack
# Time Memory Function Location
1 0.0041 675144 {main}( ) ..\patientlogin.php:0
2 0.0223 711912 connection( ) ..\patientlogin.php:5
3 0.0223 712336 mysql_connect ( ) ..\blogic.php:9
server not connected
help me asap