Questions tagged [mysql-connect]

The `mysql_connect` function opens a connection to a MySQL server.

The mysql_connect function opens a connection to a MySQL server. However, this function, along with all other mysql_* functions, are deprecated in PHP 5.5.0 and should be avoided (see the red box). Consider using prepared statements with either PDO or MySQLi instead.

192 questions
-2
votes
1 answer

Android Mobile warning: mysql_connect(); access denied for user 'root@localhost'

I am using android mobile LG 445 model. I installed palapa web server. I am getting warning when I am running my php code for connecting mysql database. The Warning is that warning: mysql_connect(); Access denied for user 'root'@'localhost'(using…
-2
votes
1 answer

mysqli_select_db() not working properly ..?

function db_connect($db_host, $db_user, $db_pass, $db_name) { $db_connect = mysqli_connect($db_host, $db_user, $db_pass) or die('Could not connect: ' . mysqli_error($db_connect)); $db_select = mysqli_select_db($db_name, $db_connect) or die…
Genapex
  • 1
  • 1
  • 1
  • 2
-2
votes
2 answers

How to connect to remote MYSQL database via php

I have to build an android app which connects to a remote MYSQL webserver and retrieve information for display purpose. So I did research coz I had no idea where to start. I read an article it mentions the better approach for that is to use php…
Raj23
  • 57
  • 2
  • 2
  • 5
-2
votes
4 answers

Can I switch database with mysql_select_db?

Will this works, or should I disconnect first?
Keoma Borges
  • 683
  • 2
  • 12
  • 27
-2
votes
1 answer

In the book PHP and MySQL Missing Manuals 2nd Edition, I get error: Warning: mysql_connect() [function.mysql-connect]: Access denied for user

I'm using zymichost.com trying to follow the book in the title. This is the error I get: Warning: mysql_connect() [function.mysql-connect]: Access denied for user '831445_juzer'@'192.168.1.1' (using password: YES) in …
-2
votes
2 answers

Should I connect to a database once in a constructor or within each method that works with a database?

I have a class that contains three methods: insert update delete Each of these methods works with a database. Which is a better method? Connect to the database in the constructor and close the connection in the destructor, or Open and close a…
Wizard
  • 10,985
  • 38
  • 91
  • 165
-3
votes
1 answer

How can combine two different MySQL connections in PHP?

I followed many tutorials to set up a registration form on my site. Now I added file upload on a extra site and I'm not sure how to combine the MySQL connections. I want to make a PDO Solution. database.php (MySQL Connection #1) for register…
-3
votes
2 answers

Error while connecting to Database on hosted server

Warning: mysql_connect(): (HY000/2002): Connection refused in /home/vol14_1/byethost31.com/b31_16461744/htdocs/Mysql/con.php on line 7 Warning: mysql_select_db(): No such file or directory in …
SUM
  • 23
  • 1
  • 10
-3
votes
1 answer

Cannot connect to mysql from PHP

The credentials are working from mysql workbench, but when I try it from PHP it takes a lot of time loading then gives 500 - internal server error. $DB_HOST = some ip here (NOT localhost or 127.0.0.1) ; $DB_USER = "myuser"; $DB_PASS =…
Digital fortress
  • 737
  • 8
  • 18
  • 31
-4
votes
3 answers

mysql_connect('mysite.com', 'root', ' '); not working

I have spent my few hours on finding out why mysql_connect('localhost', 'root', ''); works fine on localhost but mysql_connect('mysite.com', 'root', '''); does not works on the server , can anyone please help !!!
Abhay Kumar
  • 5,048
  • 2
  • 16
  • 21
-6
votes
3 answers

How to use mysqli in PHP in this code

Currently My code is this to connect my database. connect(); } // destructor function…
-6
votes
2 answers

How to execute queries in remote servers

I am trying to insert data to a web site from the code of another web site. How can I use the mysql_connect() command for that. Can I use the IP address of the first web site in the second web site code? Please help me
user1467983
  • 47
  • 2
  • 6
1 2 3
12
13