Connecting To Value Instead Of Column
myTable1
n country_id city
1 3 Tokyo
2 1 New York
4 1 Chicago
5 2 Peking
6 3 Nagoya
7 4 Paris
myTable2
id continent_id country
1 1 America
2 2 China
3 2 Japan
4 4 France
myTable3
c continent
1 America
2 Asia
4 Europe
myTable4
time param
10 : 10 c=4
10 : 12 c=2
10 : 30 n=4
10 : 35 c=1
10 : 37 n=5
10 : 50 c=2
10 : 54 c=2
10 : 55 n=1
10 : 58 c=2
11 : 15 n=7
11 : 20 c=1
I have data in my tables like the above.
And I have a numeric variable which is connected to c in myTable3.
Let's suppose the numeric variable is "1."
The following code produces the following result.
code
select time
from myTable4
where substring(param,3)=1
result
10 : 35
10 : 55
11 : 20
But I don't like to produce 10:55, because param value of 10:55 is n=1 instead of c=1.
The following would-be code doesn't work correctly, but it will show what I want.
code
select time
from myTable4
where
<IF left(param,1) is c>
substring(param,3)=1
<ELSEIF left(param,1) is n>
select time
from myTable1
inner join myTable2 on myTable1.country_id=myTable2.id
inner join myTable3 on myTable2.continent_id=myTable3.c
where myTable3.c=1
</IF>
order by time
target result
10 : 30
10 : 35
11 : 20
target result when the numeric variables=2
10 : 12
10 : 37
10 : 50
10 : 54
10 : 55
10 : 58
target result when the numeric variables=4
10 : 10
11 : 15
I hope you give me a precise solution.
Should I use UNION?
(I am using mySQL 4.0)
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Selecting Records, Then Summing Parts Of A Column, Then Sorting By That Column...
I’m keeping track of baseball stats, and each row represents one line of stats (from a box score) for one player of a single game. Because of this, a single player may have multiple rows in the table. I want to cumulate each player’s stats (so they’ll be one row per player) and display as output, which isn’t a problem. Then I want sort by a certain stat, but by now I’ve already looped through the table, so I can’t sort using a mySQL query at this point. I tried first putting values into an array in a previous project, but that became extremely complicated. What’s the best way to approach this?
I Really Need Some Help With Connecting
Hi I am new to mysql and am having trouble logging into mysqladmin. I have no idea if I am even doing it right. I have read the mysql manual many times and still can not find out what I am doing wrong. Please help. OS & version: Windows XP Professional What version of MYSQL: 4.0 EXACTLY what are you doing: i am going into my command promt and entering this C:mysqlinmysqladmin mysql -h "my IP" -u root -p Password: **** EXACTLY what message(s) are you seeing: Connect to the server failed error: Host is not allowed to connect to this MySQL server I also am getting the error code 1130
Connecting
I have a MySQL database set up on a FreeBSD box. I can connect to the database using Localhost without any problem but trying to connect remotely does not work. I have checked the variables and this shows that it should be working on nport 3306 and that skip-networking is OFF as it is supposed to be. If I try to Telnet to the server on Port 3306 then it will not respond.
Connecting (MAC OS 10.3)
I have installed MySQL on my Mac and set up a new user with a password. I created a small PHP document with the following opening line: $connect = mysql_connect("localhost","USER","USERPASS") or die ("Check your server connection."); Where USER and USERPASS are the username and password I created. I saved the file, but when I try to open it in a browser, I get the "Check your server connection." message. I'm not even sure where to start troubleshooting this. Does anyone have any suggestions for what might be going wrong?
Connecting Via ADO And VB6
I'm trying to connect to MySQL5 from my VB6 app. My code for connecting to SQLServer works fine. To MySQL5, it doesn't. It doesn't like the provider, but I'm not sure what's wrong and why. SQLDB is an ADODB.Connection, by the way. SQLDB.Provider = Provider ' I've tried "MYSQLPROV" and "MYODBC" End If Select Case UCase(Provider) Case MYSQLDB, MYODBCDB SQLDB.Properties("Location") = ServerName SQLDB.Properties("User ID").Value = UserName SQLDB.Properties("Password").Value = Password SQLDB.CommandTimeout = 300 SQLDB.Open It blows up when it hits the open, sometimes, saying something's wrong with the provider. Other times, depending on what I use for Provider, it will blow up at setting the first property, saying that Provider is missing.
Connecting
I have a MySQL database set up on a FreeBSD box. I can connect to the database using Localhost without any problem but trying to connect remotely does not work. I have checked the variables and this shows that it should be working on nport 3306 and that skip-networking is OFF as it is supposed to be. If I try to Telnet to the server on Port 3306 then it will not respond.
Connecting
I have installed mysql on my pc so i can develop a front end.... now i can connect using mysql_real_connect if i set the host to localhost, but what i need to do is install mysql on our server and enable other people to connect to it using the front en... if i try and connect using an ip address it wont work? I am using the call: ....
Connecting
I have a large table of keywords identifying thumbnail pictures. A serch will return many images so I break down results into pages. every pages starts with connecting to server like: $db_link=mysql_pconnect("$server","$user","$pass") ....... Is it there a faster way? [perhaps passing $db_link to next page?] Am I doing the right thing
Connecting To A DB
i have the following code: CODEmy $dbh2 = DBI->connect('dbi:mysql:dbName','',''); my $sthX1 = $dbh2->prepare("select oneA, oneB, oneC from products where prodID = '321'"); $sthX1->execute; use constant ONEA => 0; use constant ONEB => 1; use constant ONEC => 2;
Connecting To A Database?!?!?!
Ive only ever developed locally on my machine and thats why i dont have a clue how to do this! Im trying to connect to a database online using mysql via the command line. I have a https address, a username and a password. How the hell do i connect? Ive searched the web but i cant find an answer! Also once im in i really need to make a backup of the database. Any chance anyone could tell me how to do this. I can do it through phpmyadmin but i dont have that where i am right now.
Connecting To A DB On A Different Host
Say, I have 2 shared hosting account. Hosting A(www.aaa.com / 202.111.111.11) and Hosting B(www.bbb.com/202.222.222.22). How do I connect to a dbase in Hosting B from Hosting A? Say my access host in Hosting B is called "localhost" by default. I am using PHP to do the connection. mysqli_connect("accesshost", "username", "password", "dbname"); What do I specify for "accesshost" in the mysqli_connect?
Connecting To MySQL With PHP
Originally Posted by tluther I am new to MySQL & PHP. I am following samples in book by Kevin Yank on how to connect to MySQL with PHP. I have installed Apache, MySQL 5.0 & PHP 5.2 and am attempting to run as local host. When following the lessions in the book everything was working ok until I tried to connect to MySQL. In the PHP script I am using localhost as the address, root as username and the same password I use when I open MySQL through the command line clinet. I have been able to create and modify a sample database but just can't get PHP to connect. Any suggestions would be appreciated. I will be glad to email you the script I am using to try to connect if you need it. This is the code I am using: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Our List of Jokes</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> </head> <body> <?php // Connect to the database server $dbcnx = @mysql_connect('localhost', 'root', 'mypasswd'); if (!$dbcnx) { exit('<p>Unable to connect to the ' . 'database server at this time.</p>'); } // Select the jokes database if (!@mysql_select_db('ijdb')) { exit('<p>Unable to locate the joke ' . 'database at this time.</p>'); } ?> <p>Here are all the jokes in our database/p> <blockquote> <?php // Request the text of all the jokes $result = @mysql_query('SELECT joketext FROM joke'); if (!$result) { exit('<p>Error performing query: ' . mysql_error() . '</p>'); } // Display the text of each joke in a paragraph while ($row = mysql_fetch_array($result)) { echo '<p>' . $row['joketext'] . '</p>' } ?> </blockquote> </body> </html>
Connecting To Localhost
Despite the fact that I can connect to my localhost MySQL using EngInSite MySQL Client and the MySQL Administrator, I can't get connected using: PHP $db = mysql_connect($host,$user,$password); I've tried setting $host to 'localhost' and I've tried using 127.0.0.1, but neither works; and I've checked and rechecked the user and password values, and I've tried the hostname:port syntax.
Connecting To Own PC Database
i dont know how it works when using your own PC to do database connections, so i am seeking your guidance on this question i recieved... I am having great difficulty in setting up a data base on my PC I have XAMPP with Apaache and MySql running I have specified my username and password in C:apachefriendsxamppphpMyAdminconfig.inc.php my .php file is in C:apachefriendsxampphtdocs Using this code to connect... <?php // set your infomation. $dbhost='localhost'; $dbusername='myusername'; $dbuserpass='myuserpass'; $dbname='test'; // connect to the mysql database server. $...........................................................
Connecting With JDBC
I am using Hibernate and mySQL in my java application, and I had a hopefully very simple question. When I use JDBC to connect to mySQL over a remote network, is the password sent in clear text? If this is true by default, is there any way to change it? I do not want to move on to using an SSL connection for all of my queries due to the 35-50% performance penalty reported by the mySQL website. Ideally, we would like to authenticate without sending the password in clear text, but we are not concerned with someone sniffing our data once the authentication has taken place.
Error Connecting To DB
I get an error when I try to connect to the sql database. Here's the code: $sql_connection = mysql_connect("$sql_server","$sql_username","$sql_password"); Here's the error: fatal error: Call to undefined function mysql_connect() in c:projectxxxxx If it helps, I am using PHP designer 2006 beta 4.
Connecting To Database
i am able to connect to mysql database located at localhost:3306 inside tomcat. But i wanna do it in stand alone command line java program. this is what my code looks like: com.mysql.jdbc.jdbc2.optional.MysqlDataSource d = new com.mysql.jdbc.jdbc2.optional.MysqlDataSource(); Properties prop = new Properties(); prop.put(Context.INITIAL_CONTEXT_FACTORY, provider); ctx = new InitialContext(prop); ctx.bind("jdbc:mysql://localhost:3306/bsidb", d); // where provider is a string equal to "com.sun.jndi.fscontext.RefFSContextFactory" // and bsidb is my database name when i do the look-up it successfully returns the datasource. and when i do getconnection it returns a connection to the datasource. the problem is when i do query... it returns an SQLException: No database selected i am not using any config files because as i've said, i will do the connection using stand alone java program. i use mysql4.1 and mysql-connector-java-3.0.16-ga-bin.jar, fscontext.jar are in my classpath.
Connecting DMW With PHP/MySQL !!!
When attempting to test the connection to a MySQL database within a PHP site in Dreamweaver, the following error occurs: An unidentified error has occurred. I have installed Mysql 4.1 and php 5 and run dreamweaver MX with an apache web server. If i create a simple php info() page it pops up fine so the server is fine and so must php. I can log into my Mysql database and select tables etc, so that's fine. But i just can't get Dreamweaver to connect to the database. I get a 'unidentified error' message something to do with the selectDatabase.js.
Connecting To Mysql
I am not able to connect to the mysql DB if I am not the root user. I have already found identified an issue: * mysql.sock is NOT located in /tmp So, to get around it I created a sym link to the actual location (/var/lib/mysql/mysql.sock). This file, and the sym link, are both owned by root but they have full permission for all user. But the parent directories are ONLY READ and EXECUTABLE for non root users. If I change the permissions on: * /var * /var/lib * /var/lib/mysql I am able to connect to mysql (from both command line and my PHP script). But I really don't want to leave it so open. Any ideas how to get around this? I'm thinking the best solution would be to make mysql create the .sock file in /tmp so that I don't have to create the sym link. But I an open for any / all suggestions.
Connecting To Database
I have everything made and ready to go on my website and eveything, but I cannot get it my site to connect to the database. Is my "pages.php" wrong or do I have to do something to connect to the database? If it's my .php problem, how do I fix it?
Connecting To A MySQL DB With .NET
I was looking to create a VS.NET program that can connect to a MySQL database on a Linux server. I see that MySQL has some projects that integrate .NET with MySQL but my question is are those projects restricted to using MySQL on a Windows OS or can my program, on a Windows OS, connect remotely to MySQL, on a Linux OS?
Connecting MySql To VBA
I am asked at work to connect MySql database to excel through VBA (macros)..how do i do this, does anyone knows a tutorial or somehitng like that, I have prety much created a code, but it does not through me any data back..
Connecting From Another Server Possible?
Is it possible to connect to a database from another server? I'm using these lines: mysql_connect ("localhost", "my_user", "my_pass") or die (); mysql_select_db ("my_db"); All I have to do is change "localhost" right? to...?
Connecting To SQL Database Using Dev-C++
I'm trying to connect to a database using Dev-C++. If anyone could tell me what headers and code I need for this to work in windows it would be much appreciated.
Connecting To The Server
how can you connect to the server (I am on win 2K pro) ? I create a new connection with MySQL Administrator Connection = myTest Username = papillon Password = fraise HostName = localhost Port = 3306 Type = MySQL I get the message Could not connect to the specified host MySQL Error nr 2003 i try a ping pong >>> Ping = Reply form 127.0.0.1 Time-0ms TTL = 128
Connecting To MySQL
I'm running mysql on windows and I would like to connect to the database by typing mysql (only) and not mysql -uroot -proot. This works just fine from my linux and i cant figure out why it wont work on my windows box. I get the following error: C:>mysql ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO) Do I have to modify my.ini? Also, I would like to grant the user phpuser access to a particular database. How can i do this?
Connecting Between Two IP's
I've done a little preliminary research on connecting to a remote host, but I need a clarification. I see there is MyODBC etc. but that sounds as though it is from a remote PC to a server. I'm trying to query a Mysql DB from one web server to another. ie the php files are on one IP/host and the database resides on another IP/host. Initally, I tried to connect using an IP. (This code example is just an IP that I pulled up at random. The actual one's that I use, will be those that I have legal and authorized use of for both hosts). $db_name = "public_DB"; $connection = mysql_connect("208.21.27.10", "public_DB", "Password") or die("Couldn't connect."); $db = mysql_select_db($db_name, $connection) or die("Couldn't select database."); just wondering if I'm chasing after something that may not be done or...if so, that may not be a good idea to do.
Connecting To Localhost
I am facing problem in connecting to MySql from my PHP code. PHP : 5.x MySql : 5.x Apache : 2.x OS : WindowsXP I am running the program in the same system. i am able to access the mysql from the command prompt. not able to access through the program. the following is the code used for connecting mysql. <?php $db_name = "dlinks"; $db_user = "root"; $db_pass = "admin"; $db_host = "10.99.88.11"; $dbcon = mysql_connect('10.99.88.11','root', 'admin'); mysql_select_db('dlinks'); ?>
Connecting To MySql DB From Different PC
I just made a test with mySql on Windows NT. I created a table with different fields, and I made a Java program to connect with JDBC to that DB. It works if I connect from the same PC where mySql DB is. I used this Java sentence to connect: .....DriverManager.getConnection( "jdbc:mysql://localhost/...... And it made the query I want. But I would like that a PC in Internet could connect to that DB. I suppose I must put the IP of the mySql server instead of "localhost" on that sentence, but I got this error: java.sql.SQLException: Invalid authorization specification: A cess denied for user: 'a@cable87a004.usuarios.retecal.es' (Using password: YES) I think I should change something on Winmysqladmin at bind-address (my.ini Setup) ?...I have tried to uncomment bind-address and write the IP of the mySql server, but it doesnt work...
Connecting From Other Computer
I'm using mysql-server 4.0.13-3 on Debian. I wish to be able to connect to that server using a mysql frontend from my other computer, which is a Win32 box. However, when I try "telnet 192.168.1.40 3306" on the win32 box, or "telnet localhost 3306" on the host box, I get connection refused.
Connecting To ODBC
I have transferred the data from Access to MySQL using MySQL's tool. The transfer worked great and saved me a lot of time (thanks MySQL). Now I'm trying to get the Access database, or a new access database, to talk across ODBC and see the data. I created the DSN through the control panel and it works without error. How do I setup Access so it can see the data. The data was on windows (M$ Access) and is now on linux (Fedora Core 5). Followup: Seems like it connects, the 'Test' in the DSN definition returns data. I turned on logging through the DSN dialog and I see traffic between the DSN/application (MS Access) and the MySQL server. Still, I do not see anything usable returned from the MySQL server to Access.
Connecting To Databse
i've made a databse called aprildea_tommer, in that databse there is a table called friends(which is a test and has names etc..)i'm trying to show the contents of that table on a .php file on my site, here's my code ............................ <html> <head><title>SQL Query Sender</title></head> <body> <?php $connection=mysql_connect("localhost","aprildea_tommer","joanna") or die("no connection to databse aprildea_tommer"); $db=mysql_select_db("friends",$connection) or die ("no connection to friends database in aprildea_test"); $query = "select * from friends"; $result = mysql_query($query) or die ("!error!") ?> </body></html>
Connecting To Database
Ive only started using MySQL this week and fraid im getting stuck on the basics! Im using the mysql server from a localhost and having problems connecting to the database. (im using a php programme for the mysql queries) I can connect to mysql itself if i use the default settings: mysql_connect("localhost") But when i try to connect to my database i keep getting the same error messages: "Access denied for user: '@localhost' (Using password: NO)" Ive tried creating a new user in MySQL and granting privileges such as: GRANT ALL PRIVILEGES ON my_database.* TO user@'%' IDENTIFIED BY 'passw'; When i change the connect settings to: mysql_connect("localhost", "user", "passw") then i dont connect to mysql, but get an error message saying: "MySQL connection failed: Access denied for user: 'user@localhost' (Using password: YES)"
Connecting To Server
I am having trouble on getting my sql to work. I am using windows XP and I keep getting this error about using password YES. This is a copy of my dos window so you can see what the error is. ***************************************** C:mysqlin>mysqld C:>cd mysql C:mysql>cd bin C:mysqlin>mysql Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 3 to server version: 4.0.20a-nt Type 'help;' or 'h' for help. Type 'c' to clear the buffer. C:mysqlin>mysqladmin -u root -p shutdown Enter password: ******* mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user: 'root@localhost' (Using password: YES)'
Connecting To Mysql
when I try to connect i get the following error, you can see the website at amoudonline.net. I would very much appreciate any help. Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/fhlinux182/g/goyaonline.org.uk/user/htdocs/news_in_somali.php on line 4
Connecting To Localhost
when i tried to connect to local host using this code: <?php $conn=mysql_connect("localhost", "root", "elephant"); echo "$conn"; ?> this message appeared to me: Warning: MySQL Connection Failed: Client does not support authentication protocol requested by server; consider upgrading MySQL client in C:apachehtdocs estmysql.php on line 2
Connecting PHP With MySQL
I wanna connect a php document with mySql. So i write the following code...: $link = mysql_connect("127.0.0.1:3306", "HostName", "Password"); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($link); I have tried this instead of 127.0.0.1:3306 with localhost but the result i get is: Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in D:ServerApache2htdocsPHPFILEsmyfirst.php on line 51 Could not connect: Client does not support authentication protocol requested by server; consider upgrading MySQL client I have MySQL 4.1 and i do not know what to do! Please help me i am in great need thank u. I would appreciate it if u mailed me also.
Connecting To Database
I'm trying to install osCommerce and going through the install process. I'm getting the following error: Database Import A test connection made to the database was NOT successful. The error message returned is: Client does not support authentication protocol requested by server; consider upgrading MySQL client Can anyone shed some light. Please keep in mind that I have full access to the database and can make any changes need.
Connecting To MYSQL From VC++ 6
I'm looking for some assistance in using Embedded SQL in C using VC++ 6.0 to connect to MYSQL in Windows XP. This is new to me, but it is my understanding that I need to use a precompiler. I'm confused about where to get the precompiler. Can someone explain in simple straight forward terms what I need in order to do this? I've been Googling for hours with no real answers.
Connecting To A Outside Database
I have an account at hostultra, but they have no MySQl for free. I got two free database from freesql.org, but they do not provide hosting. You can only connect to thier database from another host. I don't know how to do that. This is the information that I recieved for my MySQL account: Database xtremegamer99 created The permissions have been set on xtremegamer99 You should now be able to connect to: www.freesql.org port 3306 as user XtremeGamer99 I have tried this, but it didn't work: <?php // Connect to the database server $connect= @mysql_connect('freesql.org:3306', 'XtremeGamer99', 'PASSWORD') or die ('Unable to connect to the MySQL database at this time.' ); // Select the database @mysql_select_db('xtremegamer99', $connect) or die('Unable to locate the cheats database at this time.' ); ?> It gives me the die() for mysql_connect.
Connecting Server
ive got 2 linux servers, each runs mysql on tcp 3306 and an httpd on tcp 80. I can telnet to port 80 from server 1 to server 2 and visa versa, but can't telnet to port 3306 from server 1 to server 2 and visa versa. I can telnet to both 80 and 3306 on both servers from a 3rd server ive got, I can also telnet to 3306 on someone elses server from both of them. Any ideas why I cant connect properly?
Connecting To MySQL
I have a php script trying to connect to mySQL server. i am unable to connect. I think my issue is the login details to mySQL - my php code is fine.I've done my installations recently and I've never needed to use logins to access mysql. are there any? i think i read somewhere that the password for the root login in mySQL is blank so I've left it like that in my script. $conn = mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db(mysql, $conn) or die(mysql_error());
Connecting To MySQL
so I have used mySQL once and it was a long time ago. I am more of an Oracle person We had some sort of front end tool. I am now faced with developing php pages and they are using a mySQL database. I am connecting remotely to a linux server which has the mySQL database. So once I am connected to the server, how do I get to the database? With Oracle I would launch SQLPlus, connect to the database, and run my SQL statements. Is there something similar with mySQL?
Re-connecting Dreamweaver
I had to re-install everything. I was able to save all my site files from dreamweaver. I opened up my site and can't connect to mysql with my old connection string says the server url is not pointing to the folder in C: My question: since I have the old server files is there an ini file or something I can just paste over the new one to point to this folder or do I have to code it in? Does anyone know which file in mysql has the url connection?
Connecting To Mysql
i have installed mysql ODBC connector 3.51.10 from the site. to connect to the database i have created a DSN. but the asp file from which i am trying to connect to the databse is giving error as : Error Type: Provider (0x8000FFFF) Catastrophic failure
Connecting To Mysql
I am unable to connect to my mysql database running on slackware linux from my windows xp comp using the odbc connector. I get error "can't connect to mysql server on '71.10.22.210' (10061)". I have tried using the ip, and I have also tried using the hostname, "admin.zipinet.com".
Remote Connecting
The admin on my work server won't give me access to the mysql control panel. So what I'm thinking is using my yahoo mysql database instead. What would I replace for localhost? $oConn = mysql_connect("localhost", "user", "pass"); Second question, would yahoo allow remote connects? Third question, will the queries run slowly when remote connecting?
Connecting 2 Colomns
i wana make two tables, when i wana delete a record in the first table, all the corresponding records in the second table will be deleted, assume that the relation between the two tables is one to many.
|