Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysql_connect() 1

Status
Not open for further replies.

skottieb

Programmer
Jun 26, 2002
118
AU
Hi,
when I call mysql_connect() in any of my sripts I get ->

Fatal error: Call to undefined function: mysql_connect() in /var/ on line 12


-----------------------------------------------------

this hapens to any calls to mysql_*() functions.

any ideas on this one ???

All help will be greatly appreciated.

skottieb:)
 
Hello;

without a code sample all I can do is guess at what your problem is.

If your string looks something like
******************************************************
$connection = mysql_connect ('localhost', 'name', 'pass');
******************************************************
you should be ok.
* if you're not using a password for mysql delete , 'pass');

remember to fill in the correct information

Good luck
 
Hi,
the mysql_connect() call is as you posted above, the the
problem is , if Iput a "mysql_close()" (which I did just
for testing) I get the same problem.

thus, The problem is not the syntax to the actual call, it is
that php does not recognise the "mysql_*()" function calls
at all, which is why I get the "undefined function" fatal error
php thinks I have to write the function call !!! Just at if
you called "fubar();" but had no :

function fubar()
{
print("im fubared");
}

:definition of the function

Here is the code snippet


$user = $HTTP_POST_VARS['user'];
$pword = $HTTP_POST_VARS['passwd'];
$link = mysql_connect("192.168.0.2", "php", "party") or die("could not connect to MySQL Db");
mysql_select_db("netgamer") or die ("could not select netgamer Db");

$handle_q = "select handle from users where handle = '$user';";
$pword_q = "select pword from users where pword = '$pword;";
$auth_q = "select admin from users where admin = '1';";

mysql_query($handle_q) or auth_err();
mysql_query($pword_q) or auth_err();
mysql_query($auth_q) or auth_err();[\b]

------------------------------------------------
[\b][\color]

skottieb:)
 
How about trying something similar to:

$result = mysql_query ("SELECT handle, pword, admin
FROM users
where handle = '$handle'
and pword = '$pword'
and admin = '1'
");

if ($myrow = mysql_fetch_array($result)) {

do {
<do what ever>
} while ($myrow = mysql_fetch_array($result));

} else {
echo &quot;You are not authorized yadda yadda yadda&quot;;

}
 
What operating system are you working on? This error usually indicates that you forgot to load the MySQL module for PHP.

//Daniel
 
Im working on linux(i586)/debian woody. apache-MySQL-php4
installed via .deb binaries

Where in the documetation does it say howto load moduels ??

skottieb:)
 
Try running [tt]apt-get install php4-mysql[/tt]. I think it should modify the configuration for you.

//Daniel
 
thanx m8, the only thing I didnt do was search the debian site
for a package..

:):):)

skottieb:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top