Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




PHP/MySQL, No Longer Connecting To Db When In Function


I'm trying to clean up the code so that design changes will be easier. So, I've put the

$connection = mysql_connect($hostName,$username,$password) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db($databaseName, $connection);

etcetera... with output commands in global functions().

But for some reason (why?), it no longer "reads" the original include with all the database variables. Is there a way to help these new functions "read" the previously set variables?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
MySQL Administrator Mannual No Longer Avaiable?
I can not find MySQL Administrator Mannual on mysql .com ,

Anybody knows why and where I can find it?

Longer Than 255 Chars
I am here trying to learn MySQL and I have a freewebhost so I'm here just running a bunch of queries through its PHPmyAdmin, still learning..
I am wondering.. How do databases like this forum store values into columns (i suppose?) that are longer than 255 characters? or am I missing something here, I probably am.. can someone shed some light?
edit:Oh Nevermind. Just found out about 'text' online somewhere else.. yeah i thought something like that existed.. read a while back.. Hey does anyone know of any good up-to-date MySQL resource pages?

No Longer Login
I've been working with a mysql installation on my laptop using apache for about 2 months.
All of a sudden, I an unable to login at the root level. Specifically, I get the following message:

"Could not connect to the specified instance"

MySQL error 2003
can't connect to MySQL server on 'localhost' [10061]


When I ping the connection, the ping is successfull. I am unable to login from the mysql command line client or MySQL Administrator

Why Does Database Take Longer On First Query?
I was just wondering that when I do the first query on my database it can take around 3.15 seconds and when I do another query on the same database, but search for something else it does it in something like 0.50 seconds or something in that range. When I then do the first query that I had done it will also be much quicker, say around 0.50 seconds.

It seems that it takes a while for my database to do its first query? Why could that be and can it be amended as the first visit from my visitors is the most important as if it query's slow on their first view of my site then they will probably just click off my site.

Choose Row With Longer Strings
I want to say

WHERE Address >= CHAR.LENGTH(Address, 20);

only not quite like that because it doesn't work.

Longer Field Length
I have a field in my databse that stores comments submitted from a web
form. For some reason the data is being truncated when re-displayed. I
have the settings as follows:
varchar(255) is this the longest field length for varchar?

Suddenly A Script No Longer Works
I always get the following message when starting a search in my database:

Search for titles in the mylibrary database.

Search for titles beginning with a:

Need A Longer Field Length For Varchar?
I have a field in my databse that stores comments submitted from a web form. For some reason the data is being truncated when re-displayed. I have the settings as follows:

varchar(255) is this the longest field length for varchar?

IF Function,GROUP BY,aggregate Function Problems
Yep, I have all those problems in the title. So I'll explain each one at a time - I did have another thread relating to this very same query but I thought it was time to update where I am with the query because at the moment I feel like I am getting nowhere!

The query I have basically searches through an items_ordered table through each product and checks to see whether the item is VATable or not. This is not where I have the problem though. Where I am really having the first problem is when I am trying to use the IF function to check if the TOTAL of an order is over £300. IF it is then I multiply it my 0.95 (i.e. 5% off). With the query below I get no errors but neither do I get the desired result. It's as though it couldn't even see it. =....

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 Php And Mysql
how can i connect mysql database to php so that we can prepare it to upload online?

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 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 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 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 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 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 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 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?

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".

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?

Connecting To Mysql
I just brought a server for a Private WoW server, and i have already have mysql for the database, however i cannot connect to the database. I have all the relevant dlls in the Windows dir and the php.ini file is ok.
The file system goes as so:

C:
--inetpub
----www
--windows
D:
--WoW
----server
------mysql

Connecting To Mysql Using Asp.net
I want to connect to mysql 4.1 db using asp.net.I havent done this before but according to book im using it says all i need is the database provider name (like the provider name for ms access is something like microsoft.jet.oledb....)-i used the myodbc before with asp(which didnt work but thats another story) but the book doesnt mention anything about odbc...yet in the mysql manual it talks about the using the myodbc to connect with asp and asp.net
So the question i have is do i just use the same obdc driver i downloaded for use wih asp....or is the book right and if so does anyone have any idea what the mysql provider name is?

Connecting To MySQL From PHP
I'm newbie in the world PHP-MySql and I have a problem when I try to connect with my DB form a PHP script.

With the instruction
mysql_connect('localhost', user, password)

I get the error:
Fatal error: Call to undefined function mysql_connect in 'my phpscript'

Connecting To MySQL
I have 2 web servers running. One has MySQL installed and all my pages on that server connect to it fine (using localhost in the connection string). But I cannot connect from my other server, I get the error - Warning: mysql_connect(): Can't connect to MySQL server on '**the server with MySQL**'

I've scoured Google all day and can't figure it out. The bind-address line in my.ini is commented out, skip-networking has been turned off, and the all the users in MySQL are host-independent (they all have the @ sign), so it's not a permissions thing. Other than these issues, what else could be causing a remote connection error?

Connecting To Mysql
i have just installed mysql on my windows 2003 server and nwo i have a question,

1: after installing it. how do i connect to it to make tables etc?

2: i use IIS 6 and i have my webroot folder on q:/webroot and wonder if i can set the mysql database to be in q:/webroot/database and how i would do that

Connecting To Mysql.exe
Im trying to set up MySql on an appache server on my laptop. However everytime i try to connect to mysql.exe within the bin directory i get the following error message

Access denied for user 'ODBC'@'localhost' <using password:NO>

i have obviously tried to enter a password and the same error message is displayed with the exception of 'password: YES.I have downloadd ODBC drivers but it made no difference.

Problems Connecting To MySQL With Php
i am new here and have been doing webdesign for a while now and i thought its about time to give MySQL and php a go; so i bought this book (build your own database driven website using php+mysql by kevin yank) but i am having one or two problems

I can connect to the mysql server fine using the client programe and the command prompt and make tables etc etc, but when i try to connect to it using php then the trouble strikes it just donst want to work. I have opened all the ports etc everything seems to work fine until i try and connect to it using php i am using this

PHP

<?php
mysql_connect(&#3982;.32.144.96', 'root', '********');
?>

and this error comes up:

PHP

Fatal error: Call to undefined function mysql_connect() in C:WEB_ROOTphptestssql.php on line 2

(btw line 2 being:
PHP

mysql_connect(&#3982;.32.144.96', 'root', '********');

)
if you need any more info on this please ask me and i will give it to you asap!
please help me on this i really would like to advance but i cant with no MySQL! or can you point me to a free web host that would offer me a MySQL server for me to use, with the code

Connecting To Mysql For The First Time!
Just learning from a php/mysql book, really getting through it ( the larry ullman visual quickstart one) and i left it on the train on the way back from london! IM gutted

Could anyone help me lessen the blow and help me with how to connect to mysql from an installation of mamp via the terminal. I dont have a clue what the path to it is and then im a little confused as what i need to do with all the -u root -p stuff.

Could anyone give me a little run down? the reason i chose mamp becuase it thought it would get me off the ground quicker, now ive lst my book its put me back a good half a week!

Connecting To MySQL From Another Server
I have two sites. They are on two separate servers that I both control. However, when I try and connect to mysql from another site, it does 'Host so.and.so.com is not allowed to connect to this MySQL Server.' How can I make it so so.and.so.com is allowed to connect? Is there a command through shell that I can run to allow host so.and.so.com to connect?

Problems Connecting To MySQL From PHP
I'm having a hard time figuring this one out...

I'm trying to connect to my MySQL server with the 'mysql_connect()' function but I keep getting "Fatal Error: Call to undefined function: mysql_connect() on line 125."

The code worked perfectly on my desktop but as soon as I tried using my laptop I get this error. I can't remember what version of PHP I'm using on my desktop (either 4.2.3 or 4.3.0), but my laptop has version 4.3.3.

I'm been searching the forums and php.net for an answer but I'm not having much luck. Obviously the version of PHP doesn't support the 'mysql_connect()' function, either because of deprecation or because PHP is not set up to support MySQL.

Connecting To MySQL Web Server
I have an Access database created for a non-profit. They would like to have this database be shared among all of their chapters, and the web hosting site seems to be the best option. My options seem to be either develop pages in PHP and upload, or use Access to connect to the MySQL database hosted on the web server.

Can an Access database be connected to an MySQL database online? I imagine it can, and it shouldn't really be much different than connecting via an intranet right?

Connecting To MySQL Through Dreamweaver 8
I'm taking an online class in php, and am trying to follow a tutorial that is supposed to teach me how to connect to MySQL through Dreamweaver. I get to the part where I'm supposed to click the + sign on the databases tab, which brings up the MySQL Connection box.

I type in my connection name, username and password (the tutorial says not to type in the server, because it should be able to find it itself, although I've tried it both ways) and when I click the "select" button to make it find my database, I get this error message: "can't connect to local mysql server through socket '/usr/local/mysql-5.0/data/mysql.sock'(2)"

I'm not running a firewall, and I'm pretty sure I have everything set up correctly, but I may be wrong.

Connecting To MySQL On Another Computer
if possible, how can I connect to mysql on another computer on my home network?

Connecting To MySQL Database
I have a windows program that retrieves and stores information into a mysql database. I ran this program a couple of months ago without a problem but now when I try to run it I cannot connect to my database.

What all do I need to make a windows program connect to a mysql database?

So far I have downloaded the MyODBC driver. Also I am able to connect to the database via webpages.

Is there anything else that I would need besides that MyODBC driver? I do have the right port(s) open also...

Connecting To MySQL From Other Workstations
I downloaded and installed mysql4.0 on Windows 2000 professional workstation (not a server). I can access the mysql from this workstation and everything is OK. I wanted to be able to access the mysql databases on this workstaion from other PCs in my network that run either Windows 2000 or XP...

VB6 - Connecting To A MySQL Database
I know how to connect to and access MS Access databases with VB6, but I'd really rather use MySQL. Can anyone tell me where I might be able to find a VB6 code example of how to connect & access a MySQL database?

Connecting Php To Mysql Version 5
My problem is,am trying to connect php with mysql so that i can write to the database and also read from the database in de mysql server. I tryed to use the function mysql_connect(),but i get a message like "Call to undefine function mysql_connect()" in the browser. I have mysql and php on de same computer.

I think i must make some changes in the php ini file(the configuration settings) but i have no idea how to accomplish it. And also which username must i use in the function since i don't use any username when connecting to mysql or i should leave that argument empty?

Connecting To Mysql Server
I am trying to use mysql on win98 I downloaded mysql control center. I fill out the info it asks for and it shows it registers the the server but then I cannot connect to setup my db. heres the info I put in.

name:upload
host:localhost
username:root
password:******

Ihave tried stopping and restarting everything. I used the default install settings for mysql.

Connecting To MYSQL Via MS Access
I have recently decided to start using MYSQL instead of MS Access 2003.
After reading through numerous articles i have learnt that i can use
access as a GUI for making changes etc to the MYSQL databases.

My problem is that i am unable to set this up correctly.
give me a set by set guide on how to do this or give me a
link to a site or post that outlines how to do this.

i have searched google without much luck at this point.
I have attempted to use the odbc method but i do not know what to
browse for when the wizard prompts me to browse.
i have never use this method before.

Connecting To MySQL From A PHP Script
i have installed the latest version of MySQL, and Wordpess, a PHP-based blog. Wordpress has a config file where you set the db name, user name/password, and host name (in this case, 'localhost'). In the past, I have simply input those variables and proceeded with the Wordpress install with no problem. This time, however, it's not working (I get this message: "Error establishing a database connection.This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at localhost. This could mean your host's database server is down.").

I know the database exists,I know the user name and password are correct,and I know the user has the correct rights,because I gave that user *all* rights.I suspect that there is a flag or option I need to set to allow PHP to connect to the db from a web script.

I start the server by manually typing:

/usr/local/bin/mysqld_safe &

Looking at the .err file doesn't show any unusual activity.

Any ideas? Is there "extra" stuff to do to allow internet connections?

Connecting MYSQL To TOAD
I downloaded TOAD Freeware from the internet - and I want to connect it to my MySQL database - can I do this, if yes how?  I have to fill in database, user, password - where do I find all these things in MySQL.

Connecting To MySQL In Localhost
I am totally new to php and i am using Dreamweaver 8. I am trying to create a page to initiate connection to the MySQL Server 5.0 at localhost, but the browser returns me this error message:

"Fatal error: Call to undefined function mysql_connect() in c:InetpubwwwrootMy_PHPconnect_to_mysql.php on line 11"


The testing code i was trying as below:

<?php
$connection = mysql_connect('localhost', 'root', 'password');
if (!$connection) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($connection);

Problems Connecting Mysql With Php
I'm building a PHP website with MySQL databases under windows xp, and i want to know how can i verify that MySQL is comunicating with PHP because the script i got says that there's an error connecting to the database.

Connecting To A MySQL Database
I'm trying to connect to a database from an ASP.NET page with VB.NET scripting on it. How can I do this? More specifically, what's the VB.NET code for connecting to a database?


Copyright © 2005-08 www.BigResource.com, All rights reserved