473,385 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Access denied when connecting to MySQL

Warning: mysql_connect(): Access denied for user: 'ODBC@localhost' (Using password: NO) in c:\appserv\www\sql.php on line 12

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in c:\appserv\www\sql.php on line 13

Warning: mysql_query(): Access denied for user: 'ODBC@localhost' (Using password: NO) in c:\appserv\www\sql.php on line 14

Warning: mysql_query(): A link to the server could not be established in c:\appserv\www\sql.php on line 14

Warning: mysql_insert_id(): A link to the server could not be established in c:\appserv\www\sql.php on line 15

Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in c:\appserv\www\sql.php on line 16

thanks 1st.
Aug 5 '07 #1
14 2763
pbmods
5,821 Expert 4TB
Heya, jolinlim. Welcome to TSDN!

Where's the code that connects to the database?
Aug 5 '07 #2
gnawz
64
we need to see the code that connects to the db,
Otherwise make sure the username and password in your script is the same as that in your mysql database connection settings.
Aug 6 '07 #3
below is sql.php
Expand|Select|Wrap|Line Numbers
  1. <? 
  2.     $mysql_server_name  = "localhost";
  3.     $mysql_username     = "root";
  4.     $mysql_password     = "";
  5.     $mysql_database     ='freesms';
  6.  
  7. function insert_sql($sql)
  8. {
  9.     global $mysql_server_name, $mysql_username, $mysql_password, $mysql_database;
  10.  
  11.     $conn = mysql_connect( $mysql_server_name, $mysql_username, $mysql_password);
  12.     mysql_select_db($mysql_database,$conn);
  13.     $result = mysql_query($sql);
  14.     $id = mysql_insert_id();
  15.     mysql_close($conn);
  16.  
  17.     return $id;
  18. }
  19.  
  20. function select_sql($sql)
  21. {
  22.     global $mysql_server_name, $mysql_username, $mysql_password, $mysql_database;
  23.  
  24.     $conn=mysql_connect( $mysql_server_name, $mysql_username, $mysql_password);
  25.     $result=mysql_db_query( $mysql_database, $sql, $conn);
  26.     while($row=mysql_fetch_row($result))
  27.         $array[] = $row;
  28.     mysql_free_result($result);                                                           
  29.  
  30.     return $array;
  31. }
  32.  
  33. function other_sql($sql)
  34. {
  35.     global $mysql_server_name, $mysql_username, $mysql_password, $mysql_database;
  36.  
  37.     $conn=mysql_connect( $mysql_server_name, $mysql_username, $mysql_password);
  38.     mysql_select_db($mysql_database,$conn);
  39.     $result = mysql_query($sql);
  40.     mysql_close($conn);
  41.  
  42.     return $result;
  43. }
  44.  
  45. ?>
__________________________________________________ ________________

below is contact_us.html
Expand|Select|Wrap|Line Numbers
  1. <?
  2.     include "sql.php";
  3.  
  4.  
  5.     insert_sql("INSERT INTO `contactus` ( `id` , `name` , `mobno` , `email` , `coname` , `enquires` , `ip` , `time` )
  6. VALUES (
  7. '', '$name', '$mobno', '$email', '$coname', '$enquires', '$REMOTE_ADDR', NOW( )
  8. );");
  9. ?>
  10.  
  11.  
  12. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  13. <html xmlns="http://www.w3.org/1999/xhtml">
  14. <head>
  15.  
  16.     <title>Sms2u FREE!</title>
  17.     <meta name="keywords" content="free sms">
  18.     <meta name="description" content="send free sms">
  19.     <meta name="author" content="on_soft@hotmail.com">
  20.     <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  21.     <meta http-equiv="Content-Type" content="text/html; charset=big5">
  22.     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  23.  
  24.     <link rel="stylesheet" type="text/css" href="http://sms2u.myvnc.com/style.css">
  25.     <link rel="icon" href="http://sms2u.myvnc.com/imgs/fv.ico" type="image/x-icon" />
  26. <link rel="shortcut icon" href="http://sms2u.myvnc.com/imgs/fv.ico" type="image/x-icon" />
  27. </head>
  28. <div align="center">
  29.     <img src="http://sms2u.myvnc.com/imgs/logo.jpg" alt="" width="348" border="0" height="85" />
  30.     <table cellpadding="0" cellspacing="0" border="0">
  31.         <tr>
  32.             <td class="tahoma9boldblue">
  33.                 <a href="index.html" class="tahoma9boldbluelink">HOME</a>
  34.  
  35.                 &nbsp;|&nbsp;
  36.                                 <a href="register.html" class="tahoma9boldbluelink">REGISTER</a>
  37.                 &nbsp;|&nbsp;
  38.                 <a href="login.html" class="tahoma9boldbluelink">LOGIN</a>
  39.                 &nbsp;|&nbsp;
  40.                                 <a href="sendsms.html" class="tahoma9boldbluelink">SEND SMS</a>
  41.  
  42.  
  43.                 &nbsp;|&nbsp;
  44.                 <a href="faq.html" class="tahoma9boldbluelink">FAQ</a>
  45.                 &nbsp;|&nbsp;
  46.                 <a href="contact_us.php" class="tahoma9boldbluelink">CONTACT US</a>
  47.  
  48.  
  49.             </td>
  50.         </tr>
  51.     </table><div  style="padding: 20px; width: 500px; text-align: left"> </div>
  52.     <div style="background-color: #054691; height: 20px"><img src="http://sms2u.myvnc.com/imgs/lbl.contactus.gif" alt="" width="78" border="0" height="19" />
  53.     </div>
  54. <br> <img src="http://sms2u.myvnc.com/imgs/support.gif" alt="" width="328" border="0" height="55" />    
  55.  
  56.  
  57.  
  58. <br>
  59. <body>
  60. <form id="forml" name="form1" method="post" action="contactus">
  61.  
  62.   <table width="499" border="1" cellpadding="3" bordercolor="#99CC99" bgcolor="#CCFF99">
  63.     <tr>
  64.       <th width="151" scope="row"><div align="left"><strong><span class="style2">CONTACT NAME: </span></strong></div></th>
  65.       <td width="324"><input name="name" type="text" id="name" size="33" /></td>
  66.     </tr>
  67.     <tr>
  68.       <th scope="row"><div align="left"><span class="style2">H/P NUMBER: </span></div></th>
  69.       <td><label>
  70.         <input name="mobno" type="text" id="mobno" size="33" />
  71.       </label></td>
  72.     </tr>
  73.     <tr>
  74.       <th scope="row"><div align="left"><span class="style2">EMAIL:</span></div></th>
  75.       <td><input name="email" type="text" id="email" size="33" /></td>
  76.     </tr>
  77.     <tr>
  78.       <th scope="row"><div align="left"><span class="style2">COMPAY NAME:  </span></div></th>
  79.       <td><input name="coname" type="text" id="coname" size="33" /></td>
  80.     </tr>
  81.     <tr>
  82.       <th scope="row"><div align="left"><span class="style2">ENQUIRES:</span></div></th>
  83.       <td><p>
  84.         <textarea name="enquires" cols="36" rows="5" id="enquires"></textarea>
  85.       </p>      </td>
  86.     </tr>
  87.     <tr>
  88.       <th colspan="2" scope="row"><div align="left"><span class="style3">
  89.         </span><span class="style3">
  90.         <label>
  91.         </label>
  92.         </span>
  93.         <label><div align="right">
  94.           <div align="right"></div>
  95.           <div align="center"><span class="style3">
  96.                 <input name="submit" type="image" src="imgs/btn.submit.gif" value="SUBMIT">
  97.           </span></div>
  98.         </div>
  99.         </label>
  100.         <span class="style3"></span><span class="style3">        </span></div>
  101.         <div align="right"></div><div align="justify"></div></th>
  102.     </tr>
  103.   </table>
  104.   <p>&nbsp;</p>
  105. </form>
  106. </body>
  107. </html>
__________________________________________________ ________________
Database freesms - Table contactus running on localhost
Aug 6 '07 #4
i have double checked the username and password, it was putted corrrectly
and the problem now is

Not Found
The requested URL /contactus was not found on this server.

Apache/1.3.33 Server at localhost Port 80
Aug 6 '07 #5
dafodil
392 256MB
Check this part of your code:
Expand|Select|Wrap|Line Numbers
  1. <form id="forml" name="form1" method="post" action="contactus">
  2.  
check the file contactus.
It should be located to the same path as contact_us.html. What type of file is that .html or .php? Since you used method as post the file should end in .php
You should write it too.
It should be like this:
Expand|Select|Wrap|Line Numbers
  1. <form id="forml" name="form1" method="post" action="contactus.php">
  2.  
Aug 6 '07 #6
Contactus not found on server.....................
just check it
<form id="forml" name="form1" method="post" action="contactus">
extension of your file contactus.html or .php
Aug 6 '07 #7
Thanks dafodil, u f give me the exactly right point. thank you very much.
i m very appreciated your help .meanwhile, can u tell me how to post a return page with written "thank, for contact us" page. then, back to front page.
Aug 6 '07 #8
dafodil
392 256MB
Thanks dafodil, u f give me the exactly right point. thank you very much.
i m very appreciated your help .meanwhile, can u tell me how to post a return page with written "thank, for contact us" page. then, back to front page.
You'll just need to redirect a user to another page. You also need to put a button on that redirected page to allow the user to go back.

create a page first with your design..

Coming from a php page, insert this code:
Expand|Select|Wrap|Line Numbers
  1. header("location:nameofthepage.php");
  2.  
Aug 6 '07 #9
dafodil,

Pls specify more details. thanks in advance.
Aug 6 '07 #10
settled again, dafodil. and thanks again for your helping.
Aug 6 '07 #11
do u know how to make advertisement in the website for user to upload. thanks in advance.
Aug 6 '07 #12
and also how to make
Method:insert WIN PIZZA send to 36188,each sms charged $0.30

again, thank in advance.
Aug 6 '07 #13
dafodil
392 256MB
and also how to make
Method:insert WIN PIZZA send to 36188,each sms charged $0.30

again, thank in advance.
About this part you need to contact a telecommunications company. I think you will pay for about a month or year for that service.

Then they can send the results to your e-mail.

do u know how to make advertisement in the website for user to upload. thanks in advance.
This will be a little bit complicated and the answer will be based on your design. My only advice for securing it is to scan the uploaded file for viruses and disallow users to upload programming scripts as much as possible so that it will not run inside your server..
Aug 7 '07 #14
pbmods
5,821 Expert 4TB
Heya, jolinlim.

The phrase 'thanks in advance' is actually considered borderline rude on forum sites, as it implies that you won't be taking the time to thank the people who help you individually.

I'm glad that you're appreciative of the help you're receiving on this site. Consider thanking posters *after* they help you to make your token of gratitude more meaningful.

Thanks!

MODERATOR
Aug 7 '07 #15

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

Similar topics

0
by: Ryan Schefke | last post by:
------=_NextPart_000_0077_01C34C8B.2B90C960 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ..I just sent this out to the win32 distribution list but no one has...
8
by: John | last post by:
Hello. I am currently working through a book on Dreamweaver and using PHP. I am having a little trouble with setting up the database though. I have php 4.2.3 and MySQL 4.0.20a. I am running...
0
by: Steve | last post by:
Hi, Yesterday I signed up for another dedicated linux server with the hosting company I use and I am having problems getting MySQL 4.1.3 working on it. I've tried just about everything I can...
2
by: adnan alsamari | last post by:
Hi, I can only access mysql through the root by typing mysql -u root -p. But when I use any other user to connect to mysql I get the access denied error message. Mysql is installed on windows xp. ...
3
by: dstewart | last post by:
Situation: One common MySQL database server on SuSE 9.1 with all updates. Uses 'rinetd'. Has entries for the appropriate IP addresses of all servers. NOTE: If the appropirate entries are NOT in...
2
by: SKB | last post by:
Hi, I am absolutely new to this area. I am getting the following difficulty : Access denied for user 'ODBC'@'localhost' (using password: NO) when I try the mysql command from within the...
7
by: rajbala.3399 | last post by:
Hi , I want to download sql in my linux system........... # rpm -ivh MySQL-server-5.0.24a-0.glibc23.i386.rpm MySQL-cl ient-5.0.24a-0.glibc23.i386.rpm Preparing... ...
1
by: servo | last post by:
I created a user "test1" (which then got the username "debscrof_test1" from CPanel), a password for the user "test2", and then added the user to a new database "testdb" with all priviliges Then a...
2
by: sbettadpur | last post by:
hello I am getting following error while connecting to mysql through php Warning: mysql_connect() : Access denied for user: 'pds@localhost' (Using password: YES) Actually I hosted one...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.