Page 1 of 1

atal error call to undefined function mysql_connect'

PostPosted: 01. June 2010 17:43
by littleimps
Hi,

I cant insert record into mysql.It has an error of 'fatal error call to undefined function mysql_connect'(in connectWrite.php). Anyone know how to solve this issue?


//mysqlWrite.php
Code: Select all
<?php

require ("connectWrite.php");

$insertRec = mysql_query ("INSERT INTO memeber VALUES ('007','Linc','Apple','apple@com','password','12345678','M')") or die (mysql_error());

echo '1 record inserted';

?>




//connectWrite.php
Code: Select all
<?php

$connect = mysql_connect("localhost") or die (mysql_error()); // error over here

mysql_select_db("bookdatabase") or die (mysql_error());

echo "connectedWrite";

?>

Re: atal error call to undefined function mysql_connect'

PostPosted: 02. June 2010 05:23
by MC10
I'm pretty certain you have to state what user/password and database you're using. Also, are the MySQL functions on (in php.ini)?

Re: atal error call to undefined function mysql_connect'

PostPosted: 02. June 2010 11:37
by peterwt
As MC10 said your mysql_connect is not complete.
The general form for mysql_connect is

Code: Select all
$connect = mysql_connect('localhost', 'mysql_user', 'mysql_password')


where mysql_user is a valid database user name
and mysql_password is a valid password for mysql_user

Peter

Re: atal error call to undefined function mysql_connect'

PostPosted: 22. June 2010 11:46
by littleimps
TKS alot. Problem Solved. =)