Need Help in PHP & MYSQL
Hai All,
I hope here i can get my solution. While browsing via IIS, PHP shows message "Fatal error: Call to undefined function mysql_connect() in D:\....\8.php on line 7"
In line 7 I wrote the code as:
$connect=mysql_connect("localhost","root");
What will be the problem? Pls anyone help me I could not find out the reason.
What are the parameters that includes in mysql_connect() command?
Eagerly waiting for the reply. If you can pls send me the brief explanation about sessions and how to do sessions in php (with examples).
Thanking You
VS
Busy posted this at 11:47 — 21st September 2004.
He has: 6,151 posts
Joined: May 2001
missing password
mysql_connect("localhost","root","password");
if no password just leave the quotes
sessions:
you start a session, assign it a value and call it whenever
// very top of page
session_start();
// anywhere in page
$_SESSION["My_Session"] = "my session value";
// anywhere in page
echo "My session has the value: ".$_SESSION[My_Session];
Starting a session after anything printed to the screen will show a "headers already sent" error.
more info at http://www.php.net/session
Greg K posted this at 23:54 — 21st September 2004.
He has: 2,145 posts
Joined: Nov 2003
But would just missing the password casue it to say it was an "undefined function mysql_connect()" ?
Also just checked http://us2.php.net/manual/en/function.mysql-connect.php and found the following:
mysql_connect() establishes a connection to a MySQL server. The following defaults are assumed for missing optional parameters: server = 'localhost:3306', username = name of the user that owns the server process and password = empty password.
Maybe PHP isn't set up on the server to use mysql? Does the install default to including these? or maybe need soemthing set in a php config file?
-Greg
Abhishek Reddy posted this at 04:30 — 22nd September 2004.
He has: 3,348 posts
Joined: Jul 2001
I think Greg is on the right track. The MySQL modules are probably not installed -- it happened to me recently too. Iirc, that was the same error I got.
Busy posted this at 10:26 — 22nd September 2004.
He has: 6,151 posts
Joined: May 2001
I assumed mysql was installed, sorry
you can do a search on your pc for mysql (should be a folder) or run php info() file to see whats installed
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.