php mysql help

Reply

Join Date: Mar 2005
Posts: 12
Reputation: androstendione is an unknown quantity at this point 
Solved Threads: 0
androstendione androstendione is offline Offline
Newbie Poster

php mysql help

 
0
  #1
Mar 1st, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2003
Posts: 360
Reputation: Gary King will become famous soon enough Gary King will become famous soon enough 
Solved Threads: 5
Team Colleague
Gary King's Avatar
Gary King Gary King is offline Offline
PHP/vBulletin Guru

Re: php mysql help

 
0
  #2
Mar 1st, 2005
I edited the post to make the code easier to read.
Reply With Quote Quick reply to this message  
Join Date: Nov 2003
Posts: 360
Reputation: Gary King will become famous soon enough Gary King will become famous soon enough 
Solved Threads: 5
Team Colleague
Gary King's Avatar
Gary King Gary King is offline Offline
PHP/vBulletin Guru

Re: php mysql help

 
0
  #3
Mar 1st, 2005
After mysql_connect(), put this:

[php]if (!$conn) {
die('Not connected : ' . mysql_error());
}[/php]
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 355
Reputation: DanceInstructor is an unknown quantity at this point 
Solved Threads: 14
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: php mysql help

 
0
  #4
Mar 1st, 2005
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
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 12
Reputation: androstendione is an unknown quantity at this point 
Solved Threads: 0
androstendione androstendione is offline Offline
Newbie Poster

Re: php mysql help

 
0
  #5
Mar 2nd, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 12
Reputation: androstendione is an unknown quantity at this point 
Solved Threads: 0
androstendione androstendione is offline Offline
Newbie Poster

Re: php mysql help

 
0
  #6
Mar 2nd, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 355
Reputation: DanceInstructor is an unknown quantity at this point 
Solved Threads: 14
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: php mysql help

 
0
  #7
Mar 2nd, 2005
For php5, did you use the msi installer or download the zip file for installation?

Dance
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 12
Reputation: androstendione is an unknown quantity at this point 
Solved Threads: 0
androstendione androstendione is offline Offline
Newbie Poster

Re: php mysql help

 
0
  #8
Mar 2nd, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 355
Reputation: DanceInstructor is an unknown quantity at this point 
Solved Threads: 14
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: php mysql help

 
0
  #9
Mar 2nd, 2005
Is libmysql.dll in your c:\windows directory?

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
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 12
Reputation: androstendione is an unknown quantity at this point 
Solved Threads: 0
androstendione androstendione is offline Offline
Newbie Poster

Re: php mysql help

 
0
  #10
Mar 2nd, 2005
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC