database not connecting
Posted by: k12 (---.easynet.co.uk)
Date: November 25, 2006 12:55AM

hi i recently installed wamp5 1.6.6 and everything working fine. i created database using myadmin and when i try to run the created file from my root directory got error message for each file

Fatal error: Call to undefined function mysql_connect() in C:\wamp\www\www\student_login.php on line 48

could you help me?



kaan

Options: ReplyQuote
Re: database not connecting
Posted by: yfastud (---.mia.bellsouth.net)
Date: November 25, 2006 02:12AM

Check my simple test files here, also good samples for people have problem w/ flash and images:

[jlbn.com]
[test.jlbn.com]
[mail.jlbn.com]
[forum.jlbn.com]
[ftp.jlbn.com]
[jlbn.com]
[jlbn.com]


Also, post the code of student_login.php here so people can help you out



Post Edited (11-25-06 02:27)

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: database not connecting
Posted by: k12 (---.easynet.co.uk)
Date: November 28, 2006 01:06AM

Fatal error: Call to undefined function mysql_connect() in C:\wamp\www\www\student_login.php on line 48

this is the error message i got when i try to run the created files on wamp local server page under project where is my root directory files. the error message showing below when i try run student login and i get same error message for al the files in root directory.
is it to do with my database or php code

please check the php code and let me know if there anything wrong or help me to solve this problem

thank you

Fatal error: Call to undefined function mysql_connect() in C:\wamp\www\www\student_login.php on line 48



<
?php
session_start();
?>

<html>
<head>
<title> Student login page </title>
<script language="JavaScript"><!--
function changeFrames(url1,url2) {
parent.options.location.href = url1;
parent.banner.location.href = url2;
}
//--></script>
</head>
<body>

<?php


$s_id = trim($_POST['s_id']);
$s_pwd = trim($_POST['s_pwd']);

$_SESSION[s_id] = $s_id;


// set up error list array
$errors = array();


// validate text input fields

if (empty($s_id) || empty($s_pwd))
{
$errors[] = "Enter the username and passwoed";

}



else
{

// select database and table
$db_name = "industrial_placement";
$table_name = "student";


$Link = mysql_connect("localhost","root","www"winking smiley;
$result = mysql_select_db($db_name,$Link);

$query = "select s_forename from $table_name where s_id = '$_POST[s_id]' AND s_pwd = '$_POST[s_pwd]'";

$result = mysql_query($query,$Link);

$row = mysql_fetch_array($result);

if(mysql_num_rows($result)==1){

echo "<script language=javascript> changeFrames('student_menu.htm', 'banner1.htm') </script>";


echo "<center><h3><font face=Geneva, Arial, Helvetica, sans-serif> $row[s_forename] </font></h3></center>";
echo "<hr><br>";

}else{

$errors[] ="Invalid Username or Password";


}


mysql_close($Link);
}

?>

<?php
if (count($errors) > 0) {

$num_errors = count($errors);
for ($i = 0; $i < $num_errors; $i++)
$login_errors=$errors[$i];


require("student_login.htm"winking smiley;
}

?>

</body>
</html>



kaan

Options: ReplyQuote
Re: database not connecting
Posted by: yfastud (---.cable.mindspring.com)
Date: November 28, 2006 05:02AM

Quote

$Link = mysql_connect("localhost","root","www"winking smiley;

i'm not really a good mysql programmer, but try this line instead

@ $Link = mysql_pconnect('localhost', 'root', 'www');

Edit: Notice it has letter "p" before the word "connect" and symbol "@" beginning at the line, also single quote instead double.



Post Edited (11-28-06 05:26)

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: database not connecting
Posted by: k12 (87.86.48.---)
Date: November 28, 2006 10:52PM

i tried with those code you given me but it did not work and gives same error message

when i open the myadmin the messages showing on the bottom as it below
i know i did not create password for my sql and i not too sure about the first error message




Cannot load mysql extension. Please check your PHP configuration. - Documentation
Your confi
iguration file contains settings (root with no password) that correspond to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole.



kaan

Options: ReplyQuote
Re: database not connecting
Posted by: yfastud (---.cable.mindspring.com)
Date: November 28, 2006 11:05PM

in that case, check through tray icon that both services running or not and also php_mysql and php_mysqli already enable which can be recognized by the arrow in the front

Options: ReplyQuote
Re: database not connecting
Posted by: k12 (87.86.48.---)
Date: November 29, 2006 12:04AM

i checked everything u suggested all the services is running and when i try to login or register i got these error message


Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in C:\wamp\www\www\student_login.php on line 48

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\www\student_login.php on line 51

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\www\student_login.php on line 55

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\www\student_login.php on line 57

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\www\student_login.php on line 59

Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\www\student_login.php on line 75

Student Login

--------------------------------------------------------------------------------


Invalid Username or Password
Student Login
Username:
Password:




Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\www\student_registration.php on line 38

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\www\student_registration.php on line 39

Warning: mysql_db_query(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\www\student_registration.php on line 49
Unable to register!

Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\www\student_registration.php on line 57



kaan

Options: ReplyQuote
Re: database not connecting
Posted by: yfastud (---.cable.mindspring.com)
Date: November 29, 2006 12:18AM

how did you set up password? check my old post here for correct way

[forum.wampserver.com]

Options: ReplyQuote
Re: database not connecting
Posted by: k12 (87.86.48.---)
Date: November 29, 2006 01:00AM

hi i changed the password through the sql console and changed the config.inc.php

now it won,t let me run the sql console or myadmin

phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in config.inc.php and make sure that they correspond to the information given by the administrator of the MySQL server.

Error
MySQL said:

#1045 - Access denied for user 'root'@'localhost' (using password: YES)



kaan

Options: ReplyQuote
Re: database not connecting
Posted by: yfastud (---.cable.mindspring.com)
Date: November 29, 2006 01:31AM

did you restart wampserver after change?

Options: ReplyQuote
Re: database not connecting
Posted by: k12 (87.86.48.---)
Date: November 29, 2006 01:55AM

i made mistake when i changed the password on the sql console i copy and paste as it was i did not change the password now i corrected everything and can access the myphpadmin but it still showing the same message
as it below
now no error message on myadmin page
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in C:\wamp\www\www\student_login.php on line 48

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\www\student_login.php on line 51

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\www\student_login.php on line 55

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\www\student_login.php on line 57

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\www\student_login.php on line 59

Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\www\student_login.php on line 75

Student Login

--------------------------------------------------------------------------------


Invalid Username or Password
Student Login
Username:



kaan

Options: ReplyQuote


Sorry, only registered users may post in this forum.