Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/
Share on other sites

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"

Link to comment
https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1189821
Share on other sites

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');

?>

Link to comment
https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1189824
Share on other sites

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'

Link to comment
https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1189890
Share on other sites

Thanks PFMaBiSmAd, That was it!

I just put the name of one of my data bases in the4th field and it fixed it!  :thumb-up:

 

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

Link to comment
https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1190017
Share on other sites

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.  :facepalm:

Link to comment
https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1190059
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1190063
Share on other sites

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 );

Link to comment
https://forums.phpfreaks.com/topic/231141-mysqlidll-will-not/#findComment-1190068
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.