Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 16th, 2008, 03:36 PM
Registered User
 
Join Date: Oct 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ramon
Default Connecting to mysql withh PHP

Hi I've got Apache2.2.9, PHP 5.2.6 and Mysql5.0.6 running fine on my machine under windows XP media center 2005. but each time I try to connect to Mysql with php, nothing happens, the browser seems to ignore all the lines of my program starting form the line "$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to" mysql'); it works until that line, but after that line nothing happens and it doesn't connect to mysql. the code I' using is below:

<html>
<body>
   <?php
      $dbhost = 'http://localhost';
      $dbuser = 'ramon';
      $dbpass = 'mypasword';
      print 'here it is going to try to connect to mysql';
      $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
      print 'Connected to mysql';

      $dbname = 'dados';
      mysql_select_db($dbname);
   ?>
   <br>
   end of program
</body>
</html>

I doesn't show "Error connecting to mysql" or "Connected to mysql" not either " End of Program". Does anyone know where might be the problem? Does Mysql run with apche on windows? help me please.
ramon

 
Old October 18th, 2008, 03:40 PM
Registered User
 
Join Date: Oct 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ramon
Default

I've got it now....

Thanks.

ramon






Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble connecting MySQL to PHP nofences84 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 June 14th, 2007 11:21 PM
Connecting mysql to php?? Manu Sharma BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 3 March 5th, 2007 01:40 AM
Connecting To MySQL from PHP AlisP2P MySQL 1 January 4th, 2006 02:27 AM
connecting to mysql using Php webmoron BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 6 August 24th, 2004 04:30 AM
list_db.php - Connecting to a MYSQL server phpnukes BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 3 March 3rd, 2004 08:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.