By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,828 Members | 2,241 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,828 IT Pros & Developers. It's quick & easy.

mysql issues (no real group for mysql)

P: n/a
I cant seem to find a good sized group for mysql so I figured you guys
that do PHP ought to be able to help.

Problem is simple to explain, hard to figure out. Ive installed PHP and
MySQL on my PC, with IIS. PHP works 100%, MySQL works with the admin
tools real nice but when I try to connect to my mysql server in php the
just stops...

Nothing past this line

$linkid = @mysql_connect($server, $user, $password);

executes...just stops dead in its track like exit() was called...
Any ideas?

Jul 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
vb*********@gmail.com wrote:
Nothing past this line

$linkid = @mysql_connect($server, $user, $password);

executes...just stops dead in its track like exit() was called...
Any ideas?


Yes.

First remove the '@' from there: when you're developing your code you
want to notice *ALL* errors, warnings and notices.

First (yes, both are "first"s) validate the return of *ALL* functions

$linkid = mysql_connect();
if ($linkid == false) {
/* failed to connect */
echo 'Connection failed: ', mysql_error();
exit();
}

or, more concisely:

$linkid = mysql_connect() or die('Connection failed: ' . mysql_error());

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
Jul 17 '05 #2

P: n/a
ok.... so i tried just doing htat... with no @ i get

Fatal error: Call to undefined function mysql_connect() in C:\Documents
and Settings\Matt\Desktop\New IJ\index.php on line 2

Add the @ and im back to square one...dead in the water after that
line. Nothing.

Note that I put this on my host...works mint. Ive also used the same
code on this pc with a previous install. This is two installs in a row
(reintalling windows and all inbetween) that have done this.

Jul 17 '05 #3

P: n/a
ok.... so i tried just doing htat... with no @ i get

Fatal error: Call to undefined function mysql_connect() in C:\Documents
and Settings\Matt\Desktop\New IJ\index.php on line 2

Add the @ and im back to square one...dead in the water after that
line. Nothing.

Note that I put this on my host...works mint. Ive also used the same
code on this pc with a previous install. This is two installs in a row
(reintalling windows and all inbetween) that have done this.

Jul 17 '05 #4

P: n/a
In article <11*********************@z14g2000cwz.googlegroups. com>, vb*********@gmail.com wrote:
ok.... so i tried just doing htat... with no @ i get

Fatal error: Call to undefined function mysql_connect() in C:\Documents
and Settings\Matt\Desktop\New IJ\index.php on line 2


With http://www.php.net/function_exists you can test if a function
exists or not. If mysql_connect does not exists it is time to make sure
the mysql(i) extension is loaded.
--
Met vriendelijke groeten,
Tim Van Wassenhove <http://www.timvw.info>
Jul 17 '05 #5

P: n/a
Ok... say it isnt installed (cant check, at work atm) what would I do
to get it installed?

Jul 17 '05 #6

P: n/a
vb*********@gmail.com wrote:
ok.... so i tried just doing htat... with no @ i get

Fatal error: Call to undefined function mysql_connect() in
C:\Documents and Settings\Matt\Desktop\New IJ\index.php on line 2

Add the @ and im back to square one...dead in the water after that
line. Nothing.
Of course. @ is only there to suppress the error message that
otherwise would tell you what happened. If there is an error, there's
an error, and just stopping the error message does not make the error
itself disappear.

PHP is telling you exactly what is wrong; the function mysql_connect()
is not defined. This propably means that your system has no support
for mysql at all.
Note that I put this on my host...works mint.
It just means that that PHP on that given host has support for mysql.
Ive also used the same
code on this pc with a previous install.
See above.
This is two installs in a row
(reintalling windows and all inbetween) that have done this.


Enable mysql-support of this latest PHP-installation and everything
should work fine.

--
Markku Uttula

Jul 17 '05 #7

P: n/a
Markku Uttula wrote:
vb*********@gmail.com wrote:
ok.... so i tried just doing htat... with no @ i get

Fatal error: Call to undefined function mysql_connect() in
C:\Documents and Settings\Matt\Desktop\New IJ\index.php on line 2
[snip]
Enable mysql-support of this latest PHP-installation and everything
should work fine.


I am receiving the same error after compiling and installing PHP 4.3.10RC2
(cli) using ./configure --with-mysql=[DIR] --with-mysqli. There were no
complaints during the building of php 4.3.10RC2 and it seem to have found
the mysql headers.

What did I miss during the compilation/installation of php?

Flash
Jul 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.