Brain In Vat Posted April 30, 2006 Share Posted April 30, 2006 This is the code I am using:<?php$dbh=mysql_connect ("localhost", 'user', "password") or die ('I cannot connect to the database because: ' . mysql_error());mysql_select_db ("user_data", $dbh);$sql = "select lname from experiment fname='Jouko'";$result = mysql_query ($sql) or die (mysql_error().$sql);$b_row = mysql_fetch_array($result);?>This is the result:Warning: mysql_connect(): Access denied for user: '[email protected]' (Using password: YES) in /home/bill5040/public_html/Test/sql.php on line 2I cannot connect to the database because: Access denied for user: '[email protected]' (Using password: YES)I changed some things for security purposes. Link to comment https://forums.phpfreaks.com/topic/8749-need-help-with-mysql/ Share on other sites More sharing options...
Brain In Vat Posted April 30, 2006 Author Share Posted April 30, 2006 I made a couple of changes and now I get the error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '='Jouko'' at line 1select lname from experiment fname='Jouko'How do I find the manual that correspond to my MySQL server? How do I find out my MySQL server version? Link to comment https://forums.phpfreaks.com/topic/8749-need-help-with-mysql/#findComment-32131 Share on other sites More sharing options...
.josh Posted April 30, 2006 Share Posted April 30, 2006 well first off, your sql statement is missing WHERE$sql = "select lname from experiment where fname='Jouko'"; Link to comment https://forums.phpfreaks.com/topic/8749-need-help-with-mysql/#findComment-32132 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.