944,120 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 11956
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Mar 1st, 2005
0

php mysql help

Expand Post »
hi im new to php/mysql i have developed a code in asp and converted it to php with asp2php programme. the original solution asp/sqlserver iis works fine..the new solution will be a iis php mysql. mysql server works fine iis works fine however the php wont let me connect to the mysql database i have created..when i connect with asp it does! there must be something missing in the code. i tried all kinds of config
so this is whats happening when i try to connect with php the page returns on itself as if the username and password submitted in the form is wrong or not found. yet when i connect to the same database with asp it goes correctly. when i alter the connection strings (php) i get the error
#1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client

therefore i go back to my original script which is as follows
[php]//check that user exists and login is correct

// $conn is of type "adodb.connection"

$conn=@mysql_connect("localhost","root","astra123");
@mysql_select_db("mildmaydemo",$conn);
//root", "astra123"
$RSStudent=$RSStudent_query=@mysql_query(("SELECT StudentID FROM MMStudents where StudentEmailAddress = '"
.$_POST["EmailAddress"]."' and StudentPassword = '"
.$_POST["Password"]."'"),$conn);
$RSStudent=@mysql_fetch_array($RSStudent_query);
if (($RSStudent==0))
{

//invalid login

$TheMessage="Student not found. Re enter the correct email and password.";
}
else
{

//valid entry[/php]
as you can see the user is sent back to the logging page when the username and password is not verified against the database...
im sure there is something missing in the code that is preventing it from connecting to the database to retrieve the details..as i say im completely new to php and cant see what is wrong here..
any help would be great!
thanks in advance chris
Reputation Points: 10
Solved Threads: 0
Newbie Poster
androstendione is offline Offline
12 posts
since Mar 2005
Mar 1st, 2005
0

Re: php mysql help

I edited the post to make the code easier to read.
Team Colleague
Reputation Points: 53
Solved Threads: 5
PHP/vBulletin Guru
Gary King is offline Offline
360 posts
since Nov 2003
Mar 1st, 2005
0

Re: php mysql help

After mysql_connect(), put this:

[php]if (!$conn) {
die('Not connected : ' . mysql_error());
}[/php]
Team Colleague
Reputation Points: 53
Solved Threads: 5
PHP/vBulletin Guru
Gary King is offline Offline
360 posts
since Nov 2003
Mar 1st, 2005
0

Re: php mysql help

What version of mysql?? If it is new and php is not new, you might try starting the mysql server with the option --old-passwords. If you use mysqladministrator (gui) you can choose the old passwords option under the security tab.

You can read about it in detail here:

A.2.3. Client does not support authentication protocol

Dance
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005
Mar 2nd, 2005
0

Re: php mysql help

hi the version of mysql is mysql client version 5.0.0 and the php version is 5. im using windows 2003 and iis 6. My previous error was that the page returned on itself stating that the user was not found. the database, iis odbc are all in place and work fine with ASP. however the php wont let me logg in.
to try and fix this i upgraded the php to 5 and i now get a blank white page returned when i try to logg into the site. the code im using to connect is:
// $conn is of type "adodb.connection"

$conn=@mysql_connect("localhost","root","astra123");
mysql_select_db("mildmaydemo",$conn);
//root", "astra123"

the server name user database name and password are all correct

as im new to mysql +php im not sure if its a code error or a mysql/php version incompatability issue
when i alter the code i get different error messages or as in the latest case i get returned a blank white page with no error message
for example if i remove the "@" in the line

$conn=@mysql_connect("localhost","root","astra123");

i get the error
Fatal error: Call to undefined function mysql_connect() in C:\Inetpub\wwwroot\mildmayphp\index.php on line 22

line 22 in my code is highlighted in bold above

i figure the "@" is a way to prevent ugly error messages presenting on the page
its all very frustrating any help appreciated and thanks in advance
cheers
chris
Reputation Points: 10
Solved Threads: 0
Newbie Poster
androstendione is offline Offline
12 posts
since Mar 2005
Mar 2nd, 2005
0

Re: php mysql help

firstly apologies for the double submission
hi the version of mysql is mysql client version 5.0.0(4.1.10nt-via TCP/IP) and the php version is 5.0.3. im using windows 2003 and iis 6. My previous error was that the page returned on itself stating that the user was not found. the database, iis odbc are all in place and work fine with ASP. however the php wont let me logg in.
to try and fix this i upgraded the php to 5 and i now get a blank white page returned when i try to logg into the site. the code im using to connect is:
// $conn is of type "adodb.connection"

$conn=@mysql_connect("localhost","root","astra123");
mysql_select_db("mildmaydemo",$conn);
//root", "astra123"

the server name user database name and password are all correct

as im new to mysql +php im not sure if its a code error or a mysql/php version incompatability issue
when i alter the code i get different error messages or as in the latest case i get returned a blank white page with no error message
for example if i remove the "@" in the line

$conn=@mysql_connect("localhost","root","astra123");

i get the error
Fatal error: Call to undefined function mysql_connect() in C:\Inetpub\wwwroot\mildmayphp\index.php on line 22

line 22 in my code is highlighted in bold above

i figure the "@" is a way to prevent ugly error messages presenting on the page
its all very frustrating any help appreciated and thanks in advance
cheers
chris btw i have reset the old password in mysqladministrator and reset it to old password from a dos prompt. i tried those options( which didnt work) before i upgraded to php 5
Last edited by androstendione; Mar 2nd, 2005 at 7:05 am. Reason: MISTAKE
Reputation Points: 10
Solved Threads: 0
Newbie Poster
androstendione is offline Offline
12 posts
since Mar 2005
Mar 2nd, 2005
0

Re: php mysql help

For php5, did you use the msi installer or download the zip file for installation?

Dance
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005
Mar 2nd, 2005
0

Re: php mysql help

i installed from zip and copied libmysql.dll and php5ts.dll to win/system 32. my php.info page works ok i was reccomended to configure my php.ini file to recognise mysql ie

;extension=php_msql.dll
extension=php_mysql.dll
;extension=php_oci8.dll

yet still my login php page gives the error
Fatal error: Call to undefined function mysql_connect() in C:\Inetpub\wwwroot\mildmayphp\index.php on line 22

and my phpmyadmin page gives the error

cannot load mysql extension,
please check PHP Configuration

i am sure the problem is that php 5 cannot recognise ,mysql server, or that in php 5 mysql server recognition isnt built in as default...one thing is for sure it should work fine but it isnt connecting to the mysql databse..before i upgraded i was getting the error message user not found...even though all the connection details were correct..this re itterates my point...php either cant connect or cant recognise mysql for some reason...any help would be appreciated
cheers
chris
Reputation Points: 10
Solved Threads: 0
Newbie Poster
androstendione is offline Offline
12 posts
since Mar 2005
Mar 2nd, 2005
0

Re: php mysql help

Is libmysql.dll in your c:\windows directory?

Quote ...
Note: Windows users will need to enable php_mysql.dll inside of php.ini and either copy libmysql.dll into the Windows system directory, or make it available to the PATH. from: http://us4.php.net/mysql
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005
Mar 2nd, 2005
0

Re: php mysql help

yes i have enable php mysql in php.ini
also libmysql.dll is located in c:\windows
this is the error from the index.php (phpmyadmin)

cannot load mysql extension,
please check PHP Configuration
Documentation

aside from pulling hair out do i need to unninstall everything i can find on the system to do with php in order to install an earlier version of php? what version of php works best with mysql ? and which version of php works best with which version of mysql?
v frustrating
thanks in advance
ive tried all sorts of things to get this to work
seasrched 100s of sites and forums
maybe a complete re install is required with a compatable php/mysql config
rather than on a php version that requires a manual re config of all the guts
thanks in advance
chris
Reputation Points: 10
Solved Threads: 0
Newbie Poster
androstendione is offline Offline
12 posts
since Mar 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: USB device command
Next Thread in PHP Forum Timeline: Creating linked pages





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC