What do you think is/are error(s)
Posted:
11. May 2009 14:51
by oculus
When I click CD Collection, this appears:
CD Collection (Example for PHP+MySQL+PDF Class)
(Requests allowed from localhost only)
A very simple CD programm.
CD list as PDF document.
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in C:\xampp\htdocs\xampp\cds.php on line 77
Could not connect to database!
Is MySQL running or did you change the password?
In Excel_Writer, when I type a word in the box and hit "Submit Query," Microsoft Excell opens with the word I've typed in the box.
In ADOdb, I entered the corresponding info in each box, but something appears on the top:
DBServer: mysql
Question: Is this normal?
Thank you.
Re: What do you think is/are error(s)
Posted:
11. May 2009 15:54
by oculus
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in C:\xampp\htdocs\xampp\cds.php on line 77
Could not connect to database!
Is MySQL running or did you change the password?
But I really can't connect to the MySQL (database).
I just tried this putting on index.php
<?
$user="root";
$password="mypass";
$database="db1";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="CREATE TABLE contacts (id int(6) NOT NULL auto_increment,first varchar(15) NOT NULL,last varchar(15) NOT NULL,phone varchar(20) NOT NULL,mobile varchar(20) NOT NULL,fax varchar(20) NOT NULL,email varchar(30) NOT NULL,web varchar(30) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))";
mysql_query($query);
mysql_close();
?> but when I access the page, it says,
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: YES) in C:\xampp\htdocs\login\index.php on line 5
Unable to select database
What do you think is the problem with the code(s)?
Re: What do you think is/are error(s)
Posted:
11. May 2009 16:02
by Wiedmann
What do you think is the problem with the code(s)?
Sure.
PHP can't know that you mean the same with $user and $username.
Re: What do you think is/are error(s)
Posted:
11. May 2009 16:06
by oculus
Oh my gosh! I haven't seen it. hahaha
Well, yes... you're right. I've changed it now; they're both $username now. But when I access the page, nothing appears on the browser. It becomes blank.
Re: What do you think is/are error(s)
Posted:
11. May 2009 16:08
by Wiedmann
But when I access the page, nothing appears on the browser. It becomes blank.
Correct, the above script does not output anything to the browser.
Re: What do you think is/are error(s)
Posted:
11. May 2009 16:13
by oculus
HUWAAAT?!!!
I should have connected to the database named "contacts," shouldn't I?
Re: What do you think is/are error(s)
Posted:
11. May 2009 16:21
by Wiedmann
I should have connected to the database named "contacts," shouldn't I?
No.
- You are connect to a MySQL at "localhost"
- Your current (selected) database is "db"
- You have created a table "contacts" in that database (well, i have not verified if this statement can work)
That's all.
Re: What do you think is/are error(s)
Posted:
11. May 2009 16:23
by oculus
I guess, this is affected by the following output in
http://localhost/xampp/index.phpCD Collection (Example for PHP+MySQL+PDF Class)
(Requests allowed from localhost only)
A very simple CD programm.
CD list as PDF document.
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in C:\xampp\htdocs\xampp\cds.php on line 77
Could not connect to database!
Is MySQL running or did you change the password?I just can't figure out the error...
Re: What do you think is/are error(s)
Posted:
11. May 2009 16:26
by oculus
Oh my bad! It was supposed to be "database named 'db1' not actually the 'contacts'"
I'm just following a tutorial in PHP and I have "insufficient" knowledge with regard to this... All I know is simple HTML, but it's not secured. This is why I'm learning PHP.