PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
hi this is krishna kanth
Iam breaking my head with this problem.
i run my php file which is as follows
<?php
echo "connecting wait.....";
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
echo mysql_error();
mysql_close($con);
?>
after running this file iam not getting any thing except "connecting wait....." as output ,
it is not connecting to database and even it is not giving "Could not connect:" message also
can anyone plz tell me the problem ,iam not at all understanding iam new to php and databases
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I tried according to u what u told ,but that also not working and this is my code
<?php
echo "connecting wait.....";
$con = mysql_connect("localhost","dagada1","dagada");
mysql_select_db($con,'kanth') or die(mysql_error()."your connected to db but db not found");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_close($con);
?>
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Later give the password, if you are able to connect then it should be fault with your installation of php. In this case you check with phpinfo(); function for Mysql is enable in php or not. Hoppe this could be the problem
Ok, tell me how did you create the user dagadda, from where, does it have a permissions.
I mean to say php-mysql is not working, not whole php.
Jus run phpinfo(); function and check for Mysql is there or not
Later give the password, if you are able to connect then it should be fault with your installation of php. In this case you check with phpinfo(); function for Mysql is enable in php or not. Hoppe this could be the problem
ni dagada1 simply i gave i did nt get it from somewhere i thought that whatever name we give it will take like that i thought but password i gave while instaling Mysql
i ran phpinfo(); then it gave a large list in that
ODBC Support enabled
Active Persistent Links 0
Active Links 0
ODBC library Win32
Directive Local Value Master Value
odbc.allow_persistent On On
odbc.check_persistent On On
odbc.default_db no value no value
odbc.default_pw no value no value
odbc.default_user no value no value
odbc.defaultbinmode return as is return as is
odbc.defaultlrl return up to 4096 bytes return up to 4096 bytes
odbc.max_links Unlimited Unlimited
odbc.max_persistent Unlimited Unlimited
and sql.safe_mode Off Off like that it is mentioned means is SQL enabled or not ?
MySQL and a blue box down. Anyhow, in windows you need to type user as root and passwors by default is blank i.e. '' or else try to connect with your password.
That says that your php-mysql functions will not work.
Mostlpeople face problems on windows is that they cannot install PHP properly. So better go for xammp.
Suggestion:
Google for apachefriends. Download xampp. It has built in everything.
Why dont you go for xammp. it will give you all the basic necessites.