cbtshare Posted December 4, 2008 CID Share Posted December 4, 2008 Hey sup, I have installed apache 2.2 on windows and mysql as well.I created a database and also a function , but I cant seem to connect to the database via the browser.(I installed php on apache as well)this is what I have and the error i'm getting. <code> <?php // Connect to the database $dbhost = 'localhost'; $dbusername = 'root'; $dbpasswd = '***'; $database_name = 'simple'; $connection = mysql_connect("$dbhost","$dbusername","$dbpasswd") or die ('Couldn't connect to server.'); $db = mysql_select_db("$database_name", $connection) or die('Couldn't select database.'); // Generate SQL code to store data on database. $insert_sql = 'INSERT INTO simple_table (text) VALUES ('test text, 1,2,3')'; // Execute SQL code. mysql_query( $insert_sql ) or die ( 'It Didn Link to comment Share on other sites More sharing options...
mudmanc4 Posted December 5, 2008 CID Share Posted December 5, 2008 That error looks like a new install without mysql support, you probably forgot to copy the mysql.dll to your php directory. No ? Link to comment Share on other sites More sharing options...
cbtshare Posted December 5, 2008 Author CID Share Posted December 5, 2008 wow never read that anywhere, where would I find the mysql.dll to copy(guessin in the mysql folder)..will try and get back to you. Thanks Link to comment Share on other sites More sharing options...
cbtshare Posted December 5, 2008 Author CID Share Posted December 5, 2008 still didnt work, I keep getting error @ mysql_connect("server", "root", "paws") or die(mysql_error()); Link to comment Share on other sites More sharing options...
Swimmer Posted December 5, 2008 CID Share Posted December 5, 2008 can you run this for us: <?php phpinfo(); ?> Link to comment Share on other sites More sharing options...
cbtshare Posted December 5, 2008 Author CID Share Posted December 5, 2008 here ya go http://ontariowiz.com/test.php Link to comment Share on other sites More sharing options...
Swimmer Posted December 5, 2008 CID Share Posted December 5, 2008 good.. you got php installed correctly.. php5 doesnt not include mysql support.. Unfortunately PHP5 removed built-in support for MySQL. To get it to work, the easiest way is to copy the mysql library file by hand. Open the folder you unzipped your PHP to. Copy the libmysql.dll file (should be located like C:phplibmysql.dll ) into your Window's System folder (usually C:WindowsSystem32 although might be C:WinNTSystem or something). Then open up your php.ini in a text editor and search for ;extension=php_mysql.dll and remove the ; infont of that line. Restart Apache and see if you get any errors. If it complains about "php_mysql.dll" either your extension directory isn't correct or windows can't find libmysql.dll That should fix the issue. System32 is the best bet.. as it is already in the Windows PATH variable. Link to comment Share on other sites More sharing options...
cbtshare Posted December 5, 2008 Author CID Share Posted December 5, 2008 thak you very very much IT guru swimmer!! it worked. **little note** when installing php you have to copy the php.ini file into windows system32 as well, but dont edit that one.Edit the one in your php folder...(Just incase anyone else has this issue.) Thanks ALOT Everyone Link to comment Share on other sites More sharing options...
Swimmer Posted December 5, 2008 CID Share Posted December 5, 2008 Not a problem.. glad it worked! I normally dont use Windows for website stuff.. So I learned something also. Link to comment Share on other sites More sharing options...
Recommended Posts