waveform Posted March 20, 2011 Share Posted March 20, 2011 Hello, and thank you for reading my post. I'm trying to learn PHP with the PHP 6 book from Larry Ullman. The issue I'm having at the moment is; I am able to load a basic test connect script for (mysql.dll) and it loads fine. That is, I get the blank page as the book says I should. example: I ran a test php file in FireFox browser: <?php mysql_connect ('localhost', 'root', 'password', 'example'); ?> But I can't get (mysqli) to run, and I checked and the extension mysqli.dll file "is" in the ext folder with the path set in the php ini. My php.ini file has the following: --------------- extension_dir = "C:/php/ext" also, I Uncommented extension=php_mysqli.dll It will not work. At the moment, I'm using the extracted PHP install php-5.3.5-Win32-VC9-x86.zip, mysql-5.5.9-win32.msi, and httpd-2.2.17-win32-x86-no_ssl.msi Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/ Share on other sites More sharing options...
Pikachu2000 Posted March 20, 2011 Share Posted March 20, 2011 Since you've edited the php.ini file, restart Apache and see if that clears it up. Quote Link to comment https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1189807 Share on other sites More sharing options...
waveform Posted March 20, 2011 Author Share Posted March 20, 2011 Hello Pikachu2000 I do realize the server needs to be restarted anytime you edit a config file, this is something else. Both the mysql.dll, and mysqli.dll came bundled in the php v5.3.5-Win32-VC9 download, and being that the mysql.dll is working great with this Apache server, I don't understand why the mysqli extension is not. As far as I'm aware, the only two parameters that need to be set in the ini are; extension=php_mysql.dll extension_dir = "C:/php/ext" Quote Link to comment https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1189821 Share on other sites More sharing options...
Pikachu2000 Posted March 20, 2011 Share Posted March 20, 2011 Have you run a phpinfo() to see if the extension shows up there? Quote Link to comment https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1189822 Share on other sites More sharing options...
waveform Posted March 20, 2011 Author Share Posted March 20, 2011 for phpinfo() I have... Mysqli Support enabled Client API library version =mysqlnd 5.0.7-dev - 091210 - $Revision: 304625 $ Active Persistent Links = 0 Inactive Persistent Links = 0 Active Links = 0 Directive Local Value / Master Value mysqli.allow_local_infile On On mysqli.allow_persistent On On mysqli.default_host no value no value mysqli.default_port 3306 3306 mysqli.default_pw no value no value mysqli.default_socket no value no value mysqli.default_user no value no value mysqli.max_links Unlimited Unlimited mysqli.max_persistent Unlimited Unlimited mysqli.reconnect Off Off This is the error I'm getting; Warning: mysqli_connect() [function.mysqli-connect]: (42000/1049): Unknown database 'example' in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\phpmyadmin\mysqli_test.php on line 2 And this is what is in my test php file; <?php mysqli_connect ('localhost', 'root', 'my pass hidden', 'example'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1189824 Share on other sites More sharing options...
PFMaBiSmAd Posted March 20, 2011 Share Posted March 20, 2011 A) Your mysql_connect() statement that you think is working 100%, isn't. The 4th parameter of it is not the database name and you are not getting an error from it because php thinks you are trying to force a new link to be created. B) The error you are getting from mysqli_connect() is telling you what the problem is. C) Therefore, it is likely that your database name is not 'example' Quote Link to comment https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1189890 Share on other sites More sharing options...
waveform Posted March 20, 2011 Author Share Posted March 20, 2011 Thanks PFMaBiSmAd, That was it! I just put the name of one of my data bases in the4th field and it fixed it! On a side note, I'm not sure why the mysql didn't give the same error because the connect script for that also used "example" as the database name. In anycase, they're both working now, Thank you again! By the way, is it ok to have both mysql, and mysqli extension active at the same time? I just tested both and they both seem to work, but I'm not sure if having both will cause conflicts down the road? extension=php_mysql.dll extension=php_mysqli.dll Quote Link to comment https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1190017 Share on other sites More sharing options...
Pikachu2000 Posted March 20, 2011 Share Posted March 20, 2011 mysql_connect() doesn't use the 4th parameter as the database name. mysql_connect() mysqli_connect() Quote Link to comment https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1190024 Share on other sites More sharing options...
waveform Posted March 20, 2011 Author Share Posted March 20, 2011 Thanks Pikachu2000 I have to be honest, I have no idea what to do with them linked examples at this stage. I bought a php/Mysql book to learn this stuff, and it seems there's always something left out, making it difficult to move forward. I am venturing out on the net to get the fill in the spaces, and thanks to guys like you I'm getting closer. Again, thank you! In regard to the book I have and some of it's incomplete examples, I'm on page 22 and I often see the book reference this -> () as a connection venerable of some kind. I've been looking for an explanation in the book what these parentheses means. Right now the book is just explaining the quotes, and escaping which I understand. But I can't understand why they're showing something before they've explained what they are, or how to use them. I usually work with more then one book when I'm trying to learn something for this exact reason. Anyway, I just thought I should mention my level. Right now I'm just taking notes on basic commands, like how to connect, and get a list of databases. That's pretty much where I am. Quote Link to comment https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1190059 Share on other sites More sharing options...
waveform Posted March 20, 2011 Author Share Posted March 20, 2011 Sorry, meant to edit what I said above about the parentheses (), since I mistakenly referred to them as having something to do with variables. The book references them as echo statements, but at this stage I have not seen them use parentheses in any of their echo statement examples. So I don't understand why they are showing them, but not explaining how to use them. Anyway, that was just an example of how the book kind of leaves you hanging. I'm guessing they probably want to get it into the readers head for a latter lesson. Quote Link to comment https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1190063 Share on other sites More sharing options...
Pikachu2000 Posted March 20, 2011 Share Posted March 20, 2011 The parentheses are typically shown after a php function, and would enclose any arguments that are passed to the function. For example, below '$array' would be the argument to the print_r() function. print_r( $array ); Quote Link to comment https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1190068 Share on other sites More sharing options...
waveform Posted March 23, 2011 Author Share Posted March 23, 2011 Great example Pikachu2000! You were a great help, thank you again! Quote Link to comment https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1191151 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.