 |
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6  | This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 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
|
|
|
|

July 6th, 2005, 07:32 AM
|
|
Registered User
|
|
Join Date: Jul 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Connecting to the MySQLServer - page 96
I am having a problem I do not understand. I have gone through everything in the book and have had no problems until I started to use PHP to connect to the MySQL server (page 96/96) at which point my browser displays the following error message:
"Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\desops\PHP with MySQL\createmovie.php on line 3"
I can connect to the server from the command prompt without any problems and I cannot understand why I am getting this particular error.
Does anyone out there have any idea what is going on please?
SleepyD
|
|

July 8th, 2005, 11:16 PM
|
|
Authorized User
|
|
Join Date: Jun 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
MySQL is not yet enabled in php, so it does not recognise the mysql_connect query as an existing function.
you have to make sure that libmysql.dll is in your \windows\system32 folder.
If that doesn't solve it, try looking in your php.ini in the \windows folder to see if you have the correct steps enabled for mysql support and just to be sure, backup the php.ini in your \PHP folder and replace it with the EXACT same copy as the one in your \windows folders as i have heard of instances where php refuses to use the php.ini in windows.
|
|

July 14th, 2005, 01:45 AM
|
|
Registered User
|
|
Join Date: Jul 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you club662, your suggestion partially worked. I moved libmysql.dll into my \windows\system32 folder. It didn't work straight away, so I had a look around and found that I had to enable the loading of the php_mysql.dll module in php.ini in the \windows directory (it had no effect in the \php directory!!)
However, I am now getting another error, namely "Fatal error: Call to undefined function mysql_create_db() in C:\Program Files\Apache Group\Apache2\desops\PHP with MySQL\createmovie.php on line 6", which is the very next php command.
Now if the first error was caused by MySQL not being enabled in php, why am I now getting a create_database error? I would have thought that the procedures would have corrected the php/MySQL recognition problem. Hmmmmm...something to think about.
Incidentally, whilst looking at the php.ini file, I did notice that, by default, none of the modules were enabled , neither was the path to the loadable modules set. I did set the path and enabled only the php_mysql.dll module, but would I also need to enable the rest? The path setting on its own appears to have no effect. Any thoughts please? Would be most appreciated.
By the way, I am using Apache 2.0.54, MySQL 4.1 and php 5.0 on Windows XP Professional, all on a Toshiba Satellite Pro laptop. Does this help?
|
|

July 14th, 2005, 02:45 AM
|
|
Registered User
|
|
Join Date: Jul 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Aha, I thought that I had read of someone having the same problem as I had outlined above - I found the answer to the "call to undefined function" error presented by Triplegee and answered by garethtaylor 04/06/2005. I changed the "mysql_create_db()" function to "$query = mysql_query("CREATE DATABASE wiley") or die(mysql_error());" and - voila - database successfully created.
I would like to extend many thanks for all your help and assistance, but, being an awkward cuss - I would really like to know why one form works and the other fails (in addition to the other queries posted earlier!!).
SD
|
|

July 15th, 2005, 04:23 AM
|
|
Authorized User
|
|
Join Date: Jun 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
It probably has to do with diffrent versions of MySQL,
the book i have only uses the mysql_query("CREATE DATABASE moviesite") function and thus never gives me any trouble.
I guess this has been done for several reasons, unknown to me.
The only functions used in the next book are the following:
$connect = mysql_connect()
mysql_select_db("databasename", $connect)
and for any other query
$query = "whatever"
mysql_query($query)
if you use these options you'll get along just fine.
be sure to check back here once in a while though, to see if you can help someone, or just for general solutions, maybe we can kick this forum back to life :).
good luck
|
|

July 16th, 2005, 06:41 AM
|
|
Registered User
|
|
Join Date: Jul 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you again Club662. The information was very helpful.
And yes, I will be checking in often - I appreciated your assistance and am more than willing to contribute in any way that I can.
Thank you again
SD
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| MySQL Fatal Error Chap 3, Pg 96-96 |
joshkosmala |
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 |
2 |
January 8th, 2007 01:55 PM |
| Chp 3 96-98 syntax error: ') TYPE=MYISAM |
saross |
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 |
7 |
January 29th, 2006 05:28 PM |
| Connecting Oracle Database with an ASP page |
krisvamshi |
Oracle ASP |
3 |
November 14th, 2004 05:56 PM |
| CH 3 pg 96 Question |
mririe |
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 |
8 |
August 25th, 2004 04:17 AM |
| CH3, pg 96 Hidden Form Fields |
wadesmart |
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 |
19 |
October 28th, 2003 03:18 PM |
|
 |