Hi.
I have just started learning PHP along with MySQL.
I am trying to connect to the MySQL DB server but unable to. I have been tryin. Please help. Its urgent cos I shall soon have to work on PHP .
My testing program is as follows : - <?php
-
-
$si = function_exists('mysqli_connect');
-
if($si == 1)
-
{
-
echo 'MySQL is installed <br />';
-
}
-
else
-
{
-
echo 'Not able to connect';
-
}
-
?>
-
Please help. I am unable to connect to the MySQL server
23 4113
[PHP]function_exists('mysqli_connect');
[/PHP] mysqli_connect is not the correct function mysql_connect is the function
remove "i" from the function name
When you post next time please read the posting guidelines.
Please give a proper title to your thread and wrap the coding using tags. because then from this page itself we can read the codings without going for a IDE.
Yes. Ok I ll Follow the rules from the next time.
But For now, I still am not able to connect. Please see the following statement.
$dbcnx = mysql_connect("localhost","root","my_pass");
This is in the browser gives me a Fatal Error.
Wats the prob. Please help.
Yes. Ok I ll Follow the rules from the next time.
But For now, I still am not able to connect. Please see the following statement.
$dbcnx = mysql_connect("localhost","root","my_pass");
This is in the browser gives me a Fatal Error.
Wats the prob. Please help.
[PHP]$dbcnx = mysql_connect("localhost","root","my_pass");[/PHP]
this line is not in your original post.
I just made the correction of your script.here its checking weather [PHP]mysql_connect[/PHP] is defined or not.
what do you really wanted. post the complete script here.
[PHP]$dbcnx = mysql_connect("localhost","root","my_pass");[/PHP]
this line is not in your original post.
I just made the correction of your script.here its checking weather [PHP]mysql_connect[/PHP] is defined or not.
what do you really wanted. post the complete script here.
Hi.
Thanks for takin time to help me.
This is my first program where I am tryin to connect to MySQL server. The complete code is as follows:
<?php
$dbcnx = mysql_connect("localhost","root","my_pass");
if ($dbcnx)
{
echo 'Success';
}
else
{
echo ' Unable' ;
}
But I still get the same error.
Fatal Error: Call to undefined function mysql_connect
Thanks in advance
Did you install mysql in your machine. this script is working fine with correct username and password to mysql server witch runs in the same machine.
[PHP]<?php
$dbcnx = mysql_connect("localhost","root","dba");
if ($dbcnx)
{
echo 'Success';
}
else
{
echo ' Unable' ;
}
?>[/PHP]
use [PHP] tags arround your php lines ;)
Is that So??
Yes I have MySQL, Apache and PHP all installed on my system. But then, why is it not working for me?
Thanks again for tryin to help me
Is that So??
Yes I have MySQL, Apache and PHP all installed on my system. But then, why is it not working for me?
Thanks again for tryin to help me
Do you have phpMyAdmin installed in your system. and what is the O/S.
I have XP and I don have PhpMyadmin.
I have XP and I don have PhpMyadmin.
download appserv and install it.
remove all your PHP,MySQL,Apache from the system.
give a fresh copy. Appserv is consist of PHP,APACHE,MySQL,phpMyAdmin in a single pack.
once you done try the coding again.
But do i need phpmyadmin? Is it not possible without it?
Sorry. but the reason why I am asking is because I just installed all the three, mysql, PHP5 and apache. Is there anything that I have to do in the php.ini file. i even added the php_mysql.dll extension in the php.ini
But do i need phpmyadmin? Is it not possible without it?
Sorry. but the reason why I am asking is because I just installed all the three, mysql, PHP5 and apache. Is there anything that I have to do in the php.ini file. i even added the php_mysql.dll extension in the php.ini
You have to put libmysql.dll to Windows dir.
You have to put libmysql.dll to Windows dir.
I tried doin it. But still without any results, I still get the same error.. please help.
Problem is with your system not in the coding. so it is up to you. here we can help if there is a error in the coding. again we can give the suggestions for up your system.thats it.
Thanks again for replyin.
Well let me tell you everythin. I have altered my php.ini file.
Uncommented the extension=php_mysql.dll statement
I have the dll files in the system32 directory.
Php works with apache.
The phpinfo() function shows me all the configuration of php.
I am even able to create tables in MySQL, but the prob is when I try to connect to MySQL thru PHP. I have been tryin for nearl 24 hrs now and no success. Thanks for helpin me all the while. Can you suggest somethin..
what are the dlls are available under system32.
what are the dlls are available under system32.
php_mysql.dll
php_mysqli.dll
libmysql.dll
under Apache httpd file try to find out this line.
LoadModule php5_module D:/AppServ/php5/php5apache2_2.dll
here in my machine php5 and apache2.2 so in your one version number might be changed.
if it not available add it.first do a search in your php directory. *php*apache*.dll
if it available check the loadmodule line in httpd.
Thanks again.
But then, as I said I have no problems in viewing php files in my browser. PHP works fie with Apache. I had also modified the LoadModule statement in the httpd.conf file.
Thanks again.
But then, as I said I have no problems in viewing php files in my browser. PHP works fie with Apache. I had also modified the LoadModule statement in the httpd.conf file.
oops I missed that. ok in php.ini check this line. mysqli.default_port = 3306
Yes thats the same as what u have mentioned. its 3306. But still cant get it connected
Add the extention line for msqli to ini file and always restart the node other wise changes never work. extension=php_mysqli.dll
Yes. I ll do that. Also BTW, if I rollback to php4 will there be chances that I can get it working? Right now I am using PHP5. I have heard that there is no embedded support for MySQL in PHP5. Thanks again
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Mr Dygi |
last post by:
Hi,
PHP 4.3.4 installed manually from package *.zip and Apache 2. I have a
problem with this simple code:
<?php
$link = mysql_connect("127.0.0.1","","")
or die("Could not connect: " ....
|
by: Rahulnewdelhi |
last post by:
hello all
Hello all
I installed php, mysql and IIS in xp. Problem is this while i run following file
PHP Code:
----------------
<?php
|
by: iceboy |
last post by:
Hello to all,I have a problem to connect PHP & MySQL together.
I have created a form that gets the username & password from admin and connect him to database.the part of PHP script that connect to...
|
by: ynyus75 |
last post by:
Hey!
I am unable to connect some of the services that I host from my laptop at home, such as SMTP and MySQL on port numbers 25 and 3306 respectively.
But I am able to some services such as...
|
by: malaysiauser |
last post by:
Im new user of PHP and MySQL.
I tried to use a script package for my web. I'd created a database.
And my connection scripts are as follow;
<?php
$mysql_host="localhost";
...
|
by: Markw |
last post by:
Hi folks I think I've got a variable problem but not 100% sure.
Background: I took the CMS example from chapter 6 in "Build your Own Database Driven Website Using PHP&MySQL" and have attempted to...
|
by: swarajtnj |
last post by:
HI Everybody,
I am a newly person on MySql Database.
I am using ASP.net 2.0 with Using the Database as MySql 5.0.
My client server 63.247.82.34. The server previlages as create a database as 2....
|
by: Markus |
last post by:
I'll leave out the annoying 'i'm a newbie' speech and get to the point: i'm a newbie at perl ;)
First thing i ever wrote in perl and it doesnt work.
I'm using xampp as my localhost - with perl...
|
by: rhitam30111985 |
last post by:
hi all .. java/jdbc newbie here ... i cant seem to perform the most basic step for database connectivity using java . here is my code :
import java.sql.*;
public class connect
{
...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
|
by: Johno34 |
last post by:
I have this click event on my form. It speaks to a Datasheet Subform
Private Sub Command260_Click()
Dim r As DAO.Recordset
Set r = Form_frmABCD.Form.RecordsetClone
r.MoveFirst
Do
If...
|
by: DizelArs |
last post by:
Hi all)
Faced with a problem, element.click() event doesn't work in Safari browser.
Tried various tricks like emulating touch event through a function:
let clickEvent = new Event('click', {...
| |