Connecting Tech Pros Worldwide Help | Site Map

mysql issues (no real group for mysql)

vbaspcppguy@gmail.com
Guest
 
Posts: n/a
#1: Jul 17 '05
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?

Pedro Graca
Guest
 
Posts: n/a
#2: Jul 17 '05

re: mysql issues (no real group for mysql)


vbaspcppguy@gmail.com wrote:[color=blue]
> Nothing past this line
>
> $linkid = @mysql_connect($server, $user, $password);
>
> executes...just stops dead in its track like exit() was called...
> Any ideas?[/color]

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!
vbaspcppguy@gmail.com
Guest
 
Posts: n/a
#3: Jul 17 '05

re: mysql issues (no real group for mysql)


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.

vbaspcppguy@gmail.com
Guest
 
Posts: n/a
#4: Jul 17 '05

re: mysql issues (no real group for mysql)


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.

Tim Van Wassenhove
Guest
 
Posts: n/a
#5: Jul 17 '05

re: mysql issues (no real group for mysql)


In article <1102577697.148569.30230@z14g2000cwz.googlegroups. com>, vbaspcppguy@gmail.com wrote:[color=blue]
> 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[/color]

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>
vbaspcppguy@gmail.com
Guest
 
Posts: n/a
#6: Jul 17 '05

re: mysql issues (no real group for mysql)


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

Markku Uttula
Guest
 
Posts: n/a
#7: Jul 17 '05

re: mysql issues (no real group for mysql)


vbaspcppguy@gmail.com wrote:[color=blue]
> 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.[/color]

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.
[color=blue]
> Note that I put this on my host...works mint.[/color]

It just means that that PHP on that given host has support for mysql.
[color=blue]
> Ive also used the same
> code on this pc with a previous install.[/color]

See above.
[color=blue]
> This is two installs in a row
> (reintalling windows and all inbetween) that have done this.[/color]

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

--
Markku Uttula

Flash Love
Guest
 
Posts: n/a
#8: Jul 17 '05

re: mysql issues (no real group for mysql)


Markku Uttula wrote:
[color=blue]
> vbaspcppguy@gmail.com wrote:[color=green]
>> 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
>>[/color][/color]
[snip][color=blue]
>
> Enable mysql-support of this latest PHP-installation and everything
> should work fine.
>[/color]

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
Closed Thread