Errors - Putty.exe (telent Connection To Mysql Database)
The following code produces an error when I try to run it under
putty.exe (telent connection to mysql database). Can anyone identify
the error in the code? The server is running PHP5.
DELIMITER ;;
/*!50003 DROP PROCEDURE IF EXISTS `aaa` */;;
/*!50003 SET SESSION
SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE PROCEDURE `aaa`()
begin
declare iTest int;
set iTest = 5;
end */;;
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Php Mysql Database Connection
i want to add my form details to the mysql database. i had done it with mysql_connect('localhost','root',''); but the error was localhost connection failed. Code:
PHP MySQL Database Connection
I'm involved in a project where I have to create a web application with PHP and MySQL. My question is, usually we use one user name and password to connect to the database for the whole application, in which case all the users will connect to the database with that username we set in PHP script. If we want to have different users with various access rights on the database this strategy will not work, because we give one username and give maximum access rights for that username. Is there any way where you can define the access rights of a user in the database(MySQL) and use the same username and password when the user connects to database through PHP application? If so, we will have hundreds of users connecting through the PHP application with different usernames and password, will this have any impact on the web server or DB server? Is it secure? Is there any other way this can be done?
PHP/MySQL Database Connection Problem
when I'm doing an insert (using mysql database) it produces the following two error messages : Warning: MySQL: Unable to save result set in [file]. Lost connection to MySQL server during query These errors occur after the number of conncections increases, before this there is'nt any problem. I am using PHP 4 with Apache on Redhat Linux 6.2.
What Is Going Wrong In The Database Connection With PHP MYSql
I am setting up a site for a client that requires signup and login. I have written most fo the code but, for some reason am have trouble with the database connection. The problem is with the connection. I believe I have the right server but, have had trouble getting the correct iser and password. Is there a way to determine what is going wrong in the connection because setting up die with a message doesn't tell me anything other than the connection failed. I going back to client and getting the support # from yahoo who set up the server and database. Hopefully I can talk to the person who set up the server for him and get the proper server, user and password. It would be nice to know how to troubleshoot the connection in a more meaningful way.
Connection Errors ?
host -{ The server }- is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts' anyone know why this message show up allot of times and goes away only after restarting mysql and apache ? is there a other way if fixing this ?
Multiple Connection Errors
I am facing multiple connection error in one site.This mean when mulitple users work simultaniously on any site that time some errors display. Can anybody tell me the solution of this type errors.
Database Connection ?
I am very new to PHP...Can i get the starting code for connecting to database....how to open the connection...what is the connectionstring ?
Database Connection
<?php I have a question about 2 connection strings to a ms sql database. # TEST DATABASE $connecttest = MSSQL_CONNECT("TEST", "sa", "123456") or exit("Unable to connect to MS SQL Server at 10.0.10.58"); $select = mssql_select_db ("database1",$connecttest) or exit("Unable to select database TEST"); # PRODUCTION DATABASE $connectprod = MSSQL_CONNECT("PROD", "sa", "654321") or exit("Unable to connect to database at 10.0.10.59"); $select = mssql_select_db ("database2",$connectprod) or exit("Unable to select database PROD"); $SQL = "SELECT * FROM table1"; $RESULT = mssql_query($SQL); // What data will i find here? Is it data from the TEST or from PROD and will it be data from database1 or from database 2? ?>
Connection To Database
Running RH8 and have installed mysql, apache, php. I have pypmyadmin working fine, adding and editing databases.. but when I try to get a form (to enter data) its does not connect or just sumbits as if all was ok but nothing happend.
Database Connection Limits?
I am in big confusion right now plz tell me one thing with explaination. Situation is: I have a script in that i am using database connection and some database operation. 10 users are accessing this script same time. what happen is there 10 connection to database sever or there will be only one connection?? if there would be 10 connections then what is the max limit of mysql.
Class For Database Connection
Can anyone tell How to write class for database connection in PHP . Class must provide a general function for executing queries.
Closing A Database Connection
for my php site, i open a mysql connection for each page cause most of my pages uses some data from the database. however, i did not close the mysql connection - will this have any bad effect to my database? or is it better to have all connection closed once my php script is finished?
Database Connection Problems?
I am all new to php/mysql and was wondering if someone might help me out on a little problem that I am having. It must be something very simple that I am missing, it seems that I am having trouble connecting to the database, yet all of my information seems to be correct - the error is as follows: Parse error: parse error in /data/members/free/tripod/uk/t/h/e/theresearcher/htdocs/scripts/conf.inc.php on line 6 the error repeats twice. Line 6 in my conf.inc.php states: $mysql_database='theresearcher_uk_db' I have enabled both php and mysql twice just to be sure. Hostname localhost is correct. Double checked the database name. No password is required so i left it blank. (should I take the line out alltogether?) I dont know what to do about the port..lycos didnt say anything about it so I left it blank. The table prefix I am not sure of either. Here is the surrounding code: $mysql_hostname='localhost' $mysql_port='' $mysql_user='theresearcher' $mysql_password='' $mysql_database='theresearcher_uk_db' $mysql_table_prefix='' $mysql_pconnect="NO"; $pages_dir='/data/members/free/tripod/uk/t/h/e/theresearcher/htdocs/' $pages_url='http://members.lycos.co.uk/theresearcher/pages/' $scripts_dir='/data/members/free/tripod/uk/t/h/e/theresearcher/htdocs/; $scripts_url='http://members.lycos.co.uk/theresearcher/scripts/'
Connection To Database Or Die Message
When connection to the database fails I would like to include an email link in the response message, but I need help with how it can be done. Below is my code and I want the error message text to include a Report This email html link. Code:
No Luck Making A Database Connection
I've included db.php into my script, and this is all it contains: $host = 'localhost' $username = '***' $password = '***' $database = '***' $connection = mysql_pconnect($host, $username, $password); $mysql_select_db($database, $connection); obviously with the other fields filled out. My webhost tells me to use this script: $dbh=mysql_connect ("localhost", "<USERNAME HERE>", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("<TABLE NAME>"); neither one of these methods work, actually - I get this error: [the contents of my db.php file here, in plain text!]No Database Selected
Database Class: Closing Connection
I am just learning OOP in PHP and I decided making a DB class would be a good start for my first real type of OOP class. Everything is working fine but I am having problem's closing the connection. I was wondering if anyone can see what the problem might be if it is in the coding. database.class.php PHP Code:
Hiding Database Connection Info
In a php script, I have to connect to a remote mysql database. I'm a bit worried that some user might be bale to retrieve the source of the page and see the user name and password to connect to the db. Is this resonable? What's the best way to avoid it?
ADODB Multiple Database Connection
I'm using ADODB for a PHP project and am having problems with multiple (MySQL) databases. I've looked through all the docs and am stumped. I know how to use PHP and MySQL and I still haven't got a clue why this isn't working. Code:
Using Global Variables In The Database Connection String
I'm sure this has been asked a million times but I can't seem to formulate a google search that returns what i'm looking for. I've go a dev and live environment. Currently the DB connect string is hard coded into each php file which means i'm going to have to change every page - Arrgh!! If i put the DBonnect into a function and store it in an include file, it doesn't seem to work, Also the connetion works with inline PHP statements, but I have to repeat it in every function even if they are in the main php file??? which doesn't seem right to me.. I need to either :- Store the connection variables in an include file and retrieve them as global values OR Store the connection string in a function in an include file which can be accessed by all functions. also do I really have to call the dbconnect inside every function. Please note, if it makes any difference, I still havn't got my head round OO programming in PHP so it is still pretty much procedural. I am using PEAR but dont really understand (or care at the moment) about what it is doing.
Connection With MySQL. Navicat - CANNOT CONNECT TO MYSQL SERVER ON LOCALHOST
I am new in PHP & MYSQL. I installed PHP & MYSQL properly. To easy operate for MYSQL I installed Navicat and it installed properly. But when I am going to test the connection between MYSQL & Navicate the error message showing CANNOT CONNECT TO MYSQL SERVER ON LOCALHOST (10022) it should mention that my connection name = localhost, Ip = localhost,port = 3306 , user name = root in Navicat.
Database Connection Problem In Included File On Root Directory
I have a file called tophtml.php that connects to the database. It's in the root directory of the site. It works perfect in the root directory. But if I call it in a sub directory. (e.g. require("../tophtml.php") or require("C:websitesdogrealm ophtml.php")) I get errors saying it can't connect to the database.
How Do I Get MySQL Errors?
I just started going from ASP to PHP about a week ago, and I'm absolutely loving it, but what is up with PHP and MySQL errors? When I insert data with a mysql_query() and nothing gets inserted, I have no way of knowing what went wrong. Where are the errors?
No Errors ( Mysql )
<?php echo "a href="index.php?alp=a">A</a> ] " ."- [ <a href="index.php?alp=b">B</a> ] " ."- [ <a href="index.php?alp=c">C</a> ] "; if (isset($_GET['alp'])) { // Now what must i make the sql statment so that it will display all the names that starts with a $_GET['alp'] ( a ) // // and if i use like then it will display all names that has a 'a' some where in the word. // $sql = "SELECT * FROM store_items WHERE name = '$sid'"; $result = $db->sql_query($sql); while($row = $db->sql_fetchrow($result)) { $name = $row[name]; } } ?>
Errors In Php/mySQL
I wonder if there is any command to hide php and mySQL errors from the user, and replace them with a customized message, en maybe even send a mail with the error to a defined email adress..
Mysql Errors
I've run a php script that uses mysql databases without problems on one server, but then I changed web hosts and installed it the same way buy I get a lot of errors which are all derived from the script not being able to interact with the database. It finds the database and connects, but then can't do anything else. When it uses a database on a different server, things work fine, so I'm guessing it's just a mysql error and not the fault of the script.
Hiding Mysql Errors
Occasionally (during a reboot, etc.) the mysql server is unavailable, and I wish to display something other than the mysql_connect error that I get now, along with an otherwise blank screen. I would prefer to display a custom error page that state's 'we are currently updating the database...yada, yada, yada...' I'm just really not certain where to put this custom html.
CSV - MySql Upload Getting Errors
I have a csv file like this Quote: Telephone: An invention of the devil which abrogates some of the advantages of making a disagreeable person keep his distance.,Computer / Technology / Science,Ambrose Bierce Quote: "Patience is a minor form of despair, disguised as a virtue.",Patience,Ambrose Bierce How can I upload it to mysql database. Upload.php and 3.csv in the same folder. PHP Code:
Dealing With PHP / MySQL Errors
I am familiar with the "die" string you can add to a MySQL statement what if an error occurs, the error is displayed on screen. What I'd like to know is if there is a way to redirect a user on getting an error to a custom error page, which I would also be able then to send an email to myself (as admin) that an error had occurred?
Supress Errors At The Page Level? Undefined Index Errors.
I'm creating a simple reply form, and if a form item isn't answered I get an error: "Notice: Undefined index: rb_amntspent in c:inetpubwwwrootmackinawsurvey.php on line 36" even if in the code I allow for an unselected item. (Code at the bottom here.) It works fine otherwise. Now in the past I've made a change to php.ini to repress errors, but for this project I don't have access to the php.ini. Is there a way to supress errors on that page for that session? Or, is there a way to just not get that error at all? Here's a sample of the code that gets the form response. If an item is selected, no error for that question, but if an item is not selected I get the error above even though I still get a successful echo for the "else" or "default" option which occurs if nothing is selected: $rb_visited = $_POST["rb_visited"]; //Have you ever visited Mackinaw City, Michigan? if ($rb_visited == "1") { $rb_visited_reply = "Yes"; } elseif ($rb_visited == "0") { $rb_visited_reply = "No"; } else { $rb_visited_reply = "You did not answer this question"; }; $rb_lastvisit = $_POST["rb_lastvisit"]; //When was your last visit to Mackinaw ity? switch ($rb_lastvisit) { case "1": $rb_lastvisit_reply = "Earlier this year (2003)"; break; case "2": $rb_lastvisit_reply = "Last year (2002)"; break; case "3": $rb_lastvisit_reply = "2 years ago (2001)"; break; case "4": $rb_lastvisit_reply = "3 years ago (2000)"; break; case "5": $rb_lastvisit_reply = "4 or more years ago (1999)"; break; default: $rb_lastvisit_reply = "You did not answer this uestion"; }
Errors Building PHP4.3.8 With MySql
I'm having a problem compiling PHP 4.3.8 with MySQL standard 4.0.20. There errors are: ext/mysql/php_mysql.o: In function `zif_mysql_create_db': /download/php-4.3.8/ext/mysql/php_mysql.c:1160: undefined reference to `mysql_create_db' ext/mysql/php_mysql.o: In function `zif_mysql_drop_db': /download/php-4.3.8/ext/mysql/php_mysql.c:1202: undefined reference to `mysql_drop_db' I've looked through usenet and found some other similar problems, but none of the solutions (i.e. duplicate mysql.h files) seems to be my problem. The config paramater is --with-mysql=/usr/local/mysql which is a symlink to the mysql 4.0.20 build directory. Does anyone have an idea about this?
Mysql Errors And Transaction Handling
(1) The "standard method" for handling errors when executing queries to a mysql database, which is shown in most tutorials and books is: mysql($query) or die("select/insert/update/delete query failed for table_name"); Actually that is hardly what should be done in a good application. Every other function has a means of returning a value, often true/false or "0"/"1". I feel it is best if we had something like : $success = mysql($query); if ( $sucess) { //do something } else { //log error //show customized error page } True, we can do the following: mysql($query) or my_own_db_error_handler(); Is there anything that I dont know or any better idea? Also, a basic question I have is - why we do have to do "or die()"? Is it because we need to ensure that a moment a db script gives an error, we have a query that has failed, so as damage control, we immediately terminate the script, knowing that some queries have been executed and others have not. If this is the reason to use "or die()" is it not better to use mysql_query("start transaction") and mysql_query("commit") or "rollback" and put the commit at the end of the script and the rollback in the above mentioned my_own_db_error_handler() ? Is this a good way? (2) Also, most big web hosts (shared hosting - I cannot afford to set up a host myself or even dedicated hosting) do not have PHP5, which has MySQLi which has much better MySQL functionality(bind variables etc) . They have PHP 4.3.x. I am under the impression that for an efficient PHP4 app you need to use the procedural style, since PHP4's OO features are "slow and inefficient". Am i correct ?
MySQL Passwords Shown In Php Errors
I'm buiding a rather large database driven content site for a client (a bank that's why this is so important). As I've been tinkering and making some database calls I got wondering if php will ever get confused and output the script as the "text file and display your db info on someones screen? I remember php was installed wrong the first time and that's what it did.
PHP SSH And Mysql Connection
For a long time I've been trying to connect to mysql through a SSH tunnel. Although that si possible by setting up the tunnel manually (with 'ssh -L ...'), I'd like it to be done by PHP itself. Now, with the SSH2 extension (http://www.php.net/manual/en/ref.ssh2.php) it is possible to issue a 'ssh2_connect' and then a 'ssh2_tunnel' command. That returns a socket resource to the destination server. So far, all fine. Problem: How can I force that socket onto 'mysql_connect'? I mean, what I have is: $tunnel = ssh2_tunnel($connection, ཆ.0.0.101', 12345); But $tunnel is a PHP resource, and not in the format ':/path/to/socket' that mysql_connect expects... Is this possible at all?
MySql Connection
Is it necessary to close a db connection at the end of a session?? Or does it autoclose?
Getting Same Mysql Connection With Php?
I have a database class i made however when i create 2 instances of it, it gives me the same connect resource id, is that normal? is there a way in php to have different resource connection id but connect to the same database with the same login on the same server?
Mysql Connection Problem
On one computer with win98 and apache 13.22+mysql+php and the dynamic server is www.xxx.dns2go.com. All running fine. 1. I tried the code( from DevShed ): <? $dbuser = 'name' $dbhost = 'localhost' $dbpass =' password' $dbname = 'auth' $dbtble = 'auth' $mysql_link = mysql_connect($dbhost,$dbuser,$dbpass); $column = mysql_list_fields($dbname,$dbtble,$mysql_link); for($i=0; $i< mysql_num_fields($column); $i++ ) { print mysql_field_name($column,$i )."<br>"; } ?> This code worked fine. 2. If I replace 'localhost' with the server name, I got the error message: Warning: Can't connect to MySQL server on 'www.xxx.dns2go.com' (10061) in d:homewebmasterpubhtm est_mysql2.php on line 13 Warning: MySQL Connection Failed: Can't connect to MySQL server on 'www.xxx.dns2go.com' (10061) in d:homewebmasterpubhtm est_mysql2.php on line 13 Warning: Supplied argument is not a valid MySQL-Link resource in d:homewebmasterpubhtm est_mysql2.php on line 15 Warning: Supplied argument is not a valid MySQL result resource in d:homewebmasterpubhtm est_mysql2.php on line 17 I tried to test from another machine. Also tried to look at the port but did not seem to work.
Secure Connection To MySQL
I need some explanation about connection to MySQL: should I encrypt data if: 1) MySQL server is on the same machine as HTTP serwer (IP: localhost), 2) I transfer data from/to MySQL server on another machine? If yes, what must I do?
Connection To MySql Error
Whenwever I try to connect to the MySql server from php page, I get the following error: WARNING: Lost connection to server during query. On a second attempt to connect, it says, unable to connect to localhost. I can connect to the MySql server from a telnet session. But then after trying to use the php page connection. I get an error in back in the telnet session that it can't connect to a temp.socket. What kind of problem is this indicating?
Connection Problem To MySQL
I am having problem on connecting to my MySQL Server. I have Redhat 6.2 Linux Server with PHP4 and MySQL. i have written a simple code : $link = mysql_connect("localhost","username","password") or die("error"); and it gives me error like : Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)
MySQL Connection Problem
I just don't get it, I have searched everywhere and can not find what I am doing wrong. I am familiar with SQL, but I typically use ASP, Access so this MySQL thing is very new. Here's my attempt at inserting data into the database: // Connection Strings $username = "-------"; $password = "-------"; $hostname = "localhost"; $dbConnect = mysql_connect($hostname, $username, $password) or die("Unable to connect to the Database, please try again."); mysql_select_db("database1") or die(mysql_error()); $theSQL = "insert into table (Item1, Item2, Item3) values "; $theSQL = $theSQL."('".$Item1."','".$Item2."','".$Item3."')" mysql_query($theSQL, $dbConnect) or die(mysql_error()); I know my connection is good, the problem is with the mysql_query line. I've tried it with and without the $dbConnect and neither works. What am I doing wrong?
Connection Problems MySQL
I am using Windows XP, IIS 5.1, PHP 5.1.4 and MySQL 5.0.23 and Dreamweaver 8. When I try to create a database connection I get the "Your PHP server doesn't have the MySQL module loaded or you can't use the mysql_(p)connect functions" error. I have downloaded the latest mysqli and mysql extensions (PHP 5.1.6 and MySQL Server 5.0.24a) and copied these into my C:PHPext directory. I believe I have already made the required changes to the php.ini file however this may not be 100% right.
Keeping MySQL Connection
Is there a way to open a mysql connection and have it remain open while a user is at my site? Is it better to just keep a connection throughout their visit or connect only when the database is needed? Right now I have these two lines at the beginning of most pages (about 6 pages): mysql_connect($host, $user, $pwd) mysql_select_db($dbase) I was thinking something involving sessions would work, but I am having trouble with it...
PHP -> MySQL Connection Trouble
I'm currently running the latest build of PHP4 on server1. However, I am running mySQL on server2. When I goto connect to mysql, I keep getting, "connection failed." I am thinking maybe something isn't setup right. For mySQL I am running mysqld and have it set up to work through port 3306. I've tried my hostname (what linux printed out0 and nothing works). I also have mySQL setup so you don't have to login to use it. PHP Code:
MySQL Existing Connection?
is there a way to check with PHP whether a mySQL connection already exist between a script and the database. In that case it can be decided to connect or leave things as is.
MySQL Connection Method With PHP..?
I have done a search and could not find an answer for this although I am sure someone has asked this before. What I am looking to do is this say I have 5 PHP files on a website and they all use the same database and mysql_connect string. PHP Code:
|