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

Recommended Answers

All 10 Replies

Hmmm... probably some of your programs are using the same socket...

@divyakrishnan u r right i m unable to access phpmyadmin and i m getting the error shown below

error is:

Welcome to phpMyAdmin


Error
MySQL said:

#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)


// error finished here

note: what should i do now the link u sent me last time has no solutions till end so kindly seek me some easy solution asap
thank you for ur last post at least now i know where the error is occuring. I vl b grateful to u if u solve my problem. thank u
reply me asap

thank u ma friends but i hv tried all wat u posted ,visited all d links still cdn get it right. Suggest me some more solutions

@diyvakrishnan thnks ma friend. I have tried both of ur links they were good but still i am at the same place where i was earlier . I tried every possible thing in those links still cdn get it right can u please enlightn me with some more solutions and links

@diyvakrishnan thnks ma friend. I have tried both of ur links they were good but still i am at the same place where i was earlier . I tried every possible thing in those links still cdn get it right can u please enlightn me with some more solutions and links

It seems mysql server is not running or is running on another port. try
mysql -h localhost -u root -p
and give what output you get.
Also can you scan the ports?
Which OS do you use (windows?)

Where am i suppose to write this "mysql -h localhost -u root -p". and how can i scan the ports is der any command for that. tell me the steps to do this. I am using windows7 home premium. wamp server and mysql 5.1.53, apache 2.2.17. thanks for replyng to my problem

Where am i suppose to write this "mysql -h localhost -u root -p". and how can i scan the ports is der any command for that. tell me the steps to do this. I am using windows7 home premium. wamp server and mysql 5.1.53, apache 2.2.17. thanks for replyng to my problem

On Command line (Window Key+R then type cmd then return key) then type mysql .....

On how to scan ports see:
http://www.petri.co.il/quickly_find_local_open_ports.htm
http://www.petri.co.il/quickly_find_local_open_ports_gui.htm

Post results here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.