MYSQL HELP!!
Posted by: Russ (---.dyn.optonline.net)
Date: September 11, 2007 02:51PM

Hi, I'm sorry I've been struggling this for a couple weeks.

I don't seem to be able to connect to mysql from php. I can edit tables through php my admin, but my php text editor will not be able to access it (or at least I don't think it will).

I never changed my password at phpadmin.config.inc.php until today so I thought that would have solved the problem but it didn't.

I put the following code in just to test
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '(my password)';

$conn = mysql_connect($dbhost, $dbuser, $dbpass)
If !$conn {

echo 'Error connecting to mysql';
}
else
{
echo 'hello world'
};


?>
When i try to run a page like this nothing happens. Are there other modifications that I have to make on WAMP. Whenever I try to access mysql from php a blank page runs.
The reason why i put this code at the end, is because I don't know whats supposed to happen why mysql actually connects. I always just get a blank page.

Options: ReplyQuote
Re: MYSQL HELP!!
Posted by: CyberSpatium (---.hsd1.or.comcast.net)
Date: September 11, 2007 08:34PM

you need to tell php what mysql database to use, so you need to add a mysql_select_db() to your script.

$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '(my password)';
$dbname = '_Database_Name_Here_'; // put the name of your database here

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Could not connect to mysql server : ' . mysql_error());

$link = mysql_select_db ($dbname, $conn) or die ('Can\'t connect to table: ' . mysql_error());

echo 'hello world';

obviously you are a newbie, check out some of these newbie totorials on my WebDev for Newbies Blog.

MySQL Tutorials

PHP MySQL Tutorial
I just found this great site with a tutorial geared to all those newbies and goes into great detail about using PHP and MySQL together to create dynamic website applications.

MySQL Table Types
When you create a new table, you can tell MySQL what type of table to create. MySQL supports several storage engines that act as handlers for different table types. MySQL storage engines include both those that handle transaction-safe tables and those that handle non-transaction-safe tables.

MySQL Statement Syntax
To help you find the syntax you need when you need it. To help you find the syntax you need when you need it, this appendix lists the syntax for the most frequently used MySQL operations. Each statement starts with a brief description and then displays the appropriate syntax. For added convenience, you’ll also find cross-references to the tutorials where specific statements are taught.

MySQL Datatypes
This tutorial explains the different datatypes used in MySQL.

Ten of the Biggest Mistakes Developers Make With Databases
Although fashions come and go in software development, some things stay remarkably constant. One of these is the use of databases. You may be wonderfully up-to-date with an AJAX Web interface or the latest whizbang Windows user interface, but under the covers, you’re probably still pumping data in and out of a database, just as we all did a decade or more ago. That makes it all the more surprising that developers are still making the same database mistakes that date back to those good old days of Windows 95 and before. Perhaps it’s just that most of us learn to use databases on the side, rather than really studying them. In any case, here are my nominations for the biggest mistakes that I see over and over again.


PHP Tutorials

What is PHP
PHP, which stands for “Hypertext Preprocessor”, is a server-side scripting language used for creating HTML embedded dynamic Web pages. PHP is used mainly in server-side scripting, but can be used from a command line interface or in standalone graphical applications.

Basic PHP Security
Basic PHP script security covers issues like prevention of SQL injections, XSS and CSRF attacks, variable tampering, etc.

Creating Forms with PHP
Having problems createing form’s with PHP? No problem, because this is the pefect tutorial to learn how to create a mail forms using PHP and HTML.

PHP Security by Example
Nice flash presentation that will provide you with a good foundation on how to make your PHP apps more secure. This is the best tutorial I have found so far covering the difficult tasks of understanding, implementing and securing your php code.

Dreamweaver, Photoshop, HTML, CCS, MySQL, Perl and PHP in Pictures
I have just stumbled upon the moterload of tutorials for all you newbies out there. These tutorials are the best out there I have found so far for the web developer newbie. These tutorials cover the basics of Dreamweaver, Photoshop, HTML, CSS, MySQL, Perl, and PHP. All of these tutorials are extremely easy to follow, as they each step is well not only well explained, there are also screen shots so you can easily follow, understand, and learn what is going on.

Introduction to PHP
I just found this great tutorial on the net. This is the perfect tutorial for those who want to get started with php, but don’t know where or how to start. Quote from tutorial: This tutorial is a basic introduction to PHP. You need two things to be able to do this tutorial: basic knowledge of HTML and a working installation of Apache and PHP.

PHP Programming Basics
Are you new to PHP or have limited knowledge of it? Here is the perfect tutorial for anyone with no, or limited knowledge of PHP to start off with the basics and work your way up from there.




CyberSpatium
----------------------
WAMP English Forum Admin

I have WAMP5 working with (for development use only):
Windows Vista Ultimate x64 (64 bit)
Kaspersky Internet Security Suite 7.0.x
Spyware Terminater 2.x
CounterSpy 2.5.x


Need help? Check out my WAMP User Manual/Guide here!


Cellular Phone Deals - The Best on the Net! - FREE PHONES! Take your pick from our featured cellular phone deals by Cingular, Verizon, T-Mobile, Sprint PCS, Nextel, and more! Most of our cellular phone offers include a FREE cellular phone with FREE shipping!


Web Development for Newbie's Blog - Check out my new blog. It is for web developers, and especially tailored for the web development newbie. If you are not fluent in “geek speak”, then this incredible resource is just you. And even if you are a web development pro, this is a great resource to check out some of the latest web development tips, news, tutorials, codes and more.


Clarify Loans
Mortgage and Home Loan Advice


LaxGo Web Directory
Powerful human edited web directory of quality, spam-free sites organized via a comprehensive category structure.

Options: ReplyQuote
Re: MYSQL HELP!!
Posted by: Russ (---.dyn.optonline.net)
Date: September 11, 2007 09:27PM

i just tried doing the method that you said. And i had three different responses depending on how I attempted to enact the php code. If I hit debug on my editor, it would just say 'hello world' if i tried opening it up in firefox, nothing would happen. Finally, if I uploaded it with ftp i would get an error saying that i could not connect to the mysql server.

I then looked at the tutorials that you showed, but the same problem happened to me, literally with copying and pasting the code. The specific error shown was
Could not connect to mysql server : Access denied for user 'root'@'localhost' (using password: YES)

i am 100% sure I entered the right password. I also set mysql to take a password and edited the appropriate config.inc.php file as well.



Post Edited (09-11-07 21:51)

Options: ReplyQuote
Re: MYSQL HELP!!
Posted by: CyberSpatium (---.hsd1.or.comcast.net)
Date: September 12, 2007 03:02AM

read my wamp manual. link to manual is in my sig.



CyberSpatium
----------------------
WAMP English Forum Admin

I have WAMP5 working with (for development use only):
Windows Vista Ultimate x64 (64 bit)
Kaspersky Internet Security Suite 7.0.x
Spyware Terminater 2.x
CounterSpy 2.5.x


Need help? Check out my WAMP User Manual/Guide here!


Cellular Phone Deals - The Best on the Net! - FREE PHONES! Take your pick from our featured cellular phone deals by Cingular, Verizon, T-Mobile, Sprint PCS, Nextel, and more! Most of our cellular phone offers include a FREE cellular phone with FREE shipping!


Web Development for Newbie's Blog - Check out my new blog. It is for web developers, and especially tailored for the web development newbie. If you are not fluent in “geek speak”, then this incredible resource is just you. And even if you are a web development pro, this is a great resource to check out some of the latest web development tips, news, tutorials, codes and more.


Clarify Loans
Mortgage and Home Loan Advice


LaxGo Web Directory
Powerful human edited web directory of quality, spam-free sites organized via a comprehensive category structure.

Options: ReplyQuote


Sorry, only registered users may post in this forum.