Questions tagged [mysql-select-db]
74 questions
0
votes
1 answer
How to Make Multiple Select with a Common Where Clause in Single Query?
How could I create a single query for all values from more than 1 tables where a county is equal to 'baawa'. I am using PHP to connect to the database.
What I tried:
SELECT (
SELECT * FROM health WHERE…

wondim
- 697
- 15
- 29
0
votes
2 answers
How quick is switching DBs with PHP + MySQL?
I'm wondering how slow it's going to be switching between 2 databases on every call of every page of a site. The site has many different databases for different clients, along with a "global" database that is used for some general settings. I'm…

Darryl Hein
- 142,451
- 95
- 218
- 261
0
votes
2 answers
PHP: mysql_connect() return true But mysql_select_db() return false _ After Ubuntu Update
After update my Ubuntu to 13.10 in php , mysql can connect by any user but can't select database with correct user and pass.
seem the User that sent to mysql is empty Instead root.
$myconn = mysql_connect('localhost' , 'root' , 'pass');
$seldb =…

Mohamad Khani
- 332
- 4
- 13
0
votes
3 answers
PHP mysql_query where x = $this or $that
I currently have a mysql_query line that looks like this:
mysql_query("SELECT * from users WHERE id = '". $id1 ."' ") or die(mysql_error());
However, I want to select everything from users where id = $id1 OR $id2. How would I edit this line to do…

user2898075
- 79
- 1
- 3
- 10
0
votes
5 answers
mysql SELECT not working shows error
I am getting the below error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'testing order by id'
Here is the main page..
echo "
0
votes
2 answers
How to get 10 closest locations from table
I want to get 10 closest locations with longitude and latitude. I store longitude and latitude as double. I tried this:
SELECT * FROM company as dest where 3956 * 2 * ASIN(SQRT( POWER(SIN((122.4058 - abs( dest.latitude)) * pi()/180 / 2),2) +…

malinchhan
- 767
- 2
- 8
- 28
0
votes
1 answer
Dynamic MySQL Statements with MySQL Variables, possible?
I've been thinking, might it be possible to dynamically change MySQL select-statement with variables.
ex.
SET @infile=1;
SELECT *
IF( @infile )
INTO OUTFILE 'myfile.csv'
ENDIF
FROM my_table;
Or do I just have to go with my current solution
SELECT…

JesuZ
- 1
0
votes
1 answer
HowTo: Connect to MySQL from PHP Using Different Files
Ok so I did a search to see if there other posts that explain this completely...
Well i'm here now :)
SCENARIO:
I want to connect to your mysql database via html.
I DO NOT want to set the parameters explicitly everytime I wish to perform a query
I…

Craig Wayne
- 4,499
- 4
- 35
- 50
0
votes
0 answers
mysql_connect and mysql_select_db can't be separated in code?
I'm not sure what the problem is, I have a file called dbs.inc.php which contains the user/pass/database variables and mysql_connect(); statement. If I include("dbs.inc.php"); in a function the next line underneath it always has to be…

Binxalot
- 41
- 7
0
votes
3 answers
php mysql_select_db returns blank page
I'm just starting out writing this code and when I add in the db select and refresh the page, instead of showing all the other html on the page or an error, it just shows up blank.
Here's what I've got-
$link = mysql_connect('vps2.foo.com:3306',…

Marty
- 2,606
- 7
- 29
- 35
-1
votes
1 answer
Multiple conditions in select statement based on values
I have a multiple ctes. In my select statement I must filter values base on the conditions. This is my query.
SELECT roadName
,sum(roadLength) AS sumRoadLength
,avg(elevationDifference) AS eglAvgDepth
,avg(elevationDifference) AS…

Vincent
- 145
- 2
- 11
-1
votes
2 answers
Parse error: syntax error, unexpected 'mysql_select_db' (T_STRING), expecting ',' or ';'
I have been looking the problem but I really dont know where the problem could be. It just give an error. (Parse error: 14 Line)

DavidQuezada7
- 149
- 2
- 7
-2
votes
1 answer
php mysql_select_db not working
I have created a class called 'class.admin.php' which does some checking.
I have a file that calls the class which works fine upto where it tries to select the db.
When I run mysql_select_db() or die I get the error 'No database…

Andy Webb
- 121
- 1
- 9
-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