473,729 Members | 2,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localho

40 New Member
i have a page funtion.php which hs the function to connect to the db

Expand|Select|Wrap|Line Numbers
  1. /* Mysql Connection */
  2. function connect(){
  3.     global $db_server,$db_user,$db_pass,$db;//Global Values from the config.php
  4.     $conn = @mysql_connect($db_server,$db_user,$db_pass) or die("Connection to Database Server Failed");
  5.     @mysql_select_db($db) or die("Database Selection Failed");
  6.     return $conn;
  7. }
  8.  
  9. /* MYSQL QUERY FUNCTION */
  10. function caseQuery($sqlString){
  11.     $conn = connect();
  12.     $rows = @mysql_query($sqlString,$conn);
  13.     @mysql_close($conn);
  14.     return $rows;
  15. }
  16.  
  17. /* MYSQL INSERT QUERY FUNCTION */
  18. function caseInsertQuery($sqlString){
  19.     $conn = connect();
  20.     $rows = @mysql_query($sqlString,$conn);
  21.     $insertId = @mysql_insert_id($conn);
  22.     @mysql_close($conn);
  23.     return $insertId;
  24. }
  25.  
2)i have a page page config.php which has the following code

Expand|Select|Wrap|Line Numbers
  1. $db_server = "localhost"; //Database server
  2. $db_user = "root";                //Database user name
  3. $db_pass = ""; //Database server password
  4. $db = "panchayatsgoa"; //Database Name
  5.  
  6. $filePath = $_SERVER['DOCUMENT_ROOT'].""; //Complete File Path on the webserver Without trailing slash
  7.  
  8. $downloadPath = "downloads"; //This should be in the root directory of the WEBSITE this is a Folder name
  9.  
  10. /* Default Session Time out */
  11. $sessionTimeout = 3600; //Session time out should be specified in SECONDS;

3)i have a page login_attempts. php which hs thecode shown below and which gives me the warning
Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localho st' (using password: NO) in C:\xampp\htdocs \panchayats\adm in\login_attemp t.php on line 24

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\xampp\htdocs \panchayats\adm in\login_attemp t.php on line 24

There was an error in selecting login logs

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. require_once "../inc/functions.php";
  3. sessionCheck();
  4. ?>
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  9. <title>Control Panel</title>
  10. <link rel="stylesheet" type="text/css" href="admin.css" />
  11. <script language="javascript" type="text/javascript" src="menu.js"></script>
  12. </head>
  13.  
  14. <body>
  15.  
  16. <h3> Login Attempts</h3>
  17. <?php
  18.     $page = $_GET['page'];
  19.     $records_per_page = 10;
  20.     if (!ctype_digit($page)) $page=1;
  21.     $offset = ($page-1) * $records_per_page;
  22.  
  23.     $getlogs = "SELECT * FROM login_attempts ORDER BY id desc LIMIT $offset, $records_per_page";
  24.     $result = mysql_query($getlogs) or die ("<div style='padding:20px; font-weight:bold; color:#FF0000;'>There was an error in selecting login logs</div>");
  25.     $rows = mysql_num_rows($result);
  26.     if ($rows) {
  27.         echo "<div style='padding-left:20px;'><table style='border-collapse:collapse; border-color:#000' border='1' cellspacing='0' cellpadding='5' width='400'>";
  28.         echo "<tr><td width='100'>IP Address</td><td width='60'>Attempts</td><td width='150'>Time Stamp</td></tr>";
  29.         for($i=1;$i<=$rows;$i++) {
  30.             $res=mysql_fetch_array($result);
  31.             echo "<tr><td>{$res['ipaddress']}</td><td>{$res['attempts']}</td><td>{$res['timestamp']}</td></tr>";
  32.         }
  33.         echo "</table></div>";
  34.         //paging toolbar
  35.         $count_result = mysql_query("SELECT COUNT(*) FROM login_attempts");
  36.         $count_row = mysql_fetch_array($count_result);
  37.         $count = $count_row["COUNT(*)"];        //fetch the total number of rows in the table
  38.         $numofpages = ceil($count/$records_per_page);        // how many pages we have when using paging?
  39.         echo "<div style='margin-left:20px;width:400px;'>";
  40.         if ($numofpages > '1' ) { pagingScript("login_attempt.php", $page, $numofpages); }
  41.         echo "</div>";
  42.     } else {
  43.         echo "<div style='margin-left:20px;'>No Login Attempts</div>";
  44.     }
  45. ?>
  46. </body>
  47. </html>
Jan 15 '10 #1
5 9136
dgreenhouse
250 Recognized Expert Contributor
My first guess is that the server has a password set and you're not providing it in the code...

Expand|Select|Wrap|Line Numbers
  1. db_server = "localhost"; //Database server
  2. $db_user = "root"; //Database user name
  3. $db_pass = ""; //Database server password - MISSING PASSWORD
  4. $db = "panchayatsgoa"; //Database Name
  5.  
Jan 15 '10 #2
lisles
40 New Member
any idea how i can do dat?
Jan 15 '10 #3
Markus
6,050 Recognized Expert Expert
@lisles
Huh? You do not know your own MySQL server password?
Jan 15 '10 #4
nomad
664 Recognized Expert Contributor
to find your password look it up on privileges
Jan 18 '10 #5
first Establish the Connection then only it will work
Sep 29 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
12690
by: Neo | last post by:
It's really strange. I downloaded the latest 4.0.16 RPM from mysql.com and installed it to my Fedora system, and did *not* do anything else (Actually I am completely new to mysql). I wrote a test php script to test mysql (ftp_connect('localhost', 'root');), but got the following error: Warning: mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/custcare/dbconn.inc on line 2
2
2286
by: Fang | last post by:
Hi, I installed MySQL4.1.11 and PHP4.3.10. When trying to connect an existing database, it showed me the following warning message which I have no idea how to solve it. Hope someone can kindly tell me what I should do. Thanks in advance. Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in c:\inetpub\wwwroot\project\connection.php on line 12 Could not...
1
2096
by: myaashik | last post by:
Hello! All I have a Error message saying that: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/rocks/public_html/colorado3.php on line 32 I have error on this code below: <html> <head> <titleColorado</title>
6
2169
by: geevaa | last post by:
Hi Group, The page 167 of book Learning PHP5 by David Sklar says that setcookie() and session_start() must be added before any output. I tried to use that functions at last line but no warning!. The warning which i got 1 month back is not issued now. ------------------------------------------------------------------ The following is my PHP program <?php function Intelli()
2
2065
by: geevaa | last post by:
Hi Group, The page 167 of book Learning PHP5 by David Sklar says that setcookie() and session_start() must be added before any output. I tried to use that functions at last line but no warning!. The warning which i got 1 month back is not issued now. ------------------------------------------------------------------ The following is my PHP program <?php function Intelli()
4
7834
by: Ryanlawrence1 | last post by:
Heya, I get these 2 errors: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/themepar/public_html/changepass.php on line 20 You have not entered all the fields Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/themepar/public_html/changepass.php on line 34 Sorry You failed to enter the correct old password I was wondering if anyone could help me, I have...
2
16929
by: techjohnny | last post by:
Error: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/jplane/certcent/phpweb/quiz/index.php on line 20 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/jplane/certcent/phpweb/quiz/index.php on line 21 PHP CODE:
11
13211
by: Kurda Yon | last post by:
Hi, I got this warning: mysql_query(): 4 is not a valid MySQL-Link resource. The line which cause this warning is: mysql_query("insert into $tablename (id,priority) values('$id', '0.00')", $link2); As far as understand the problem is that $link2 is "not a valid MySQL-
3
1421
by: gubbachchi | last post by:
Hi, I have written php code to retrive the image from mysql and display it on the webpage. Here is the code <?php require_once("DBConnect.php"); $gotten = @mysql_query("select user_photo from User_Info_Other where user_id = '1'"); header("Content-type: image/gif"); while ($row = mysql_fetch_array($gotten)) {
4
5029
by: fisherd | last post by:
When i run this code, i keep getting this message; Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\checklogin.php on line 26 i use this code to check login details. Here is the code for the pages that i used. main_login.php <html> <body>
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8148
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2163
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.