connection problem SQL

connection problem SQL

am 26.01.2005 10:45:03 von whaletyr

I am trying to install PHP with Mysql on a Windows XP machine

but I keep getting the following error

Fatal error: Call to undefined function mysql_connect() in
c:\Inetpub\wwwroot\test site\info.php on line 2

Can anyone tell me what I do wrong?

Whaletyr

$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('my_database') or die('Could not select database');
?>

Re: connection problem SQL

am 26.01.2005 11:12:23 von Shion

whaletyr wrote:
> I am trying to install PHP with Mysql on a Windows XP machine
>
> but I keep getting the following error
>
> Fatal error: Call to undefined function mysql_connect() in
> c:\Inetpub\wwwroot\test site\info.php on line 2

The version of PHP that you use don't have the mysql support built in, as I
have understod you need some dll to fix this.


//Aho

Re: connection problem SQL

am 26.01.2005 11:40:52 von Steve

MySQL support is built-in to PHP 4 so there is no extension DLL any
more; BUT there is a MySQL DLL (libmySQL.dll) that should be part of
your MySQL installation.

Alternatively perhaps you are using PHP 5? If so, see the mysqli_*
functions instead.

---
Steve

Re: connection problem SQL

am 27.01.2005 00:17:52 von Jonathan Tremlett CIT2004

Hi,

I am having the same problem and I was wondering if someone would mind
explaining to me in basic steps how to fix this as unfortunately I am not a
pro at any of this.

I have Windows XP, MySQL 4.1 and PHP5.0. I have seen this error in so many
forums but just do not understand any solutions and any I do understand
don't work.

Here is a reminder of the problem:

Fatal error: Call to undefined function mysql_connect()

Any help would be greatly appreciated

Johnny


"Steve" wrote in message
news:1106736052.319228.245090@c13g2000cwb.googlegroups.com.. .
>
> MySQL support is built-in to PHP 4 so there is no extension DLL any
> more; BUT there is a MySQL DLL (libmySQL.dll) that should be part of
> your MySQL installation.
>
> Alternatively perhaps you are using PHP 5? If so, see the mysqli_*
> functions instead.
>
> ---
> Steve
>

Re: connection problem SQL

am 27.01.2005 00:54:10 von Jonathan Tremlett CIT2004

Let me add to this:

Alternatively if there is no clear solution could you possibly tell me which
is the best versions of PHP and MySQL to install that will work together
without such problems.


"Jonathan Tremlett CIT2004" wrote in message
news:41f824dd$1@nntphost.cis.strath.ac.uk...
> Hi,
>
> I am having the same problem and I was wondering if someone would mind
> explaining to me in basic steps how to fix this as unfortunately I am not
a
> pro at any of this.
>
> I have Windows XP, MySQL 4.1 and PHP5.0. I have seen this error in so
many
> forums but just do not understand any solutions and any I do understand
> don't work.
>
> Here is a reminder of the problem:
>
> Fatal error: Call to undefined function mysql_connect()
>
> Any help would be greatly appreciated
>
> Johnny
>
>
> "Steve" wrote in message
> news:1106736052.319228.245090@c13g2000cwb.googlegroups.com.. .
> >
> > MySQL support is built-in to PHP 4 so there is no extension DLL any
> > more; BUT there is a MySQL DLL (libmySQL.dll) that should be part of
> > your MySQL installation.
> >
> > Alternatively perhaps you are using PHP 5? If so, see the mysqli_*
> > functions instead.
> >
> > ---
> > Steve
> >
>
>

Re: connection problem SQL

am 27.01.2005 01:05:45 von Shion

Jonathan Tremlett CIT2004 wrote:
> Let me add to this:
>
> Alternatively if there is no clear solution could you possibly tell me which
> is the best versions of PHP and MySQL to install that will work together
> without such problems.

If you want to make this easy for you, download a linux distro (good place to
find populare such are att www.linuxiso.org), install the linux and select to
install apache, mysql and php and you only have to fix your apache settings a
little bit and see to that it's started as service at bootup and you are finished.


If you are paicent enough to read a howto, then visit
http://www.webmasterstop.com/tutorials/apache-php-mysql-inst allation.shtml

No clue if it's a good one or not, but that was the first one that came up for
a such easy query at google as "howto mysql php windows".


//Aho

Re: connection problem SQL

am 27.01.2005 01:42:06 von Jonathan Tremlett CIT2004

Hi,

Thanks for helping. I'm afraid I tried these following the changes I would
have to make and to no success :(

I was told to use the SQL_Query() rather than MySql_Connect() but then I
have no place to put in my username and password so I amunfortuntely back to
the drawing board.


"J.O. Aho" wrote in message
news:35qpg2F4ok5oqU1@individual.net...
> Jonathan Tremlett CIT2004 wrote:
> > Let me add to this:
> >
> > Alternatively if there is no clear solution could you possibly tell me
which
> > is the best versions of PHP and MySQL to install that will work together
> > without such problems.
>
> If you want to make this easy for you, download a linux distro (good place
to
> find populare such are att www.linuxiso.org), install the linux and select
to
> install apache, mysql and php and you only have to fix your apache
settings a
> little bit and see to that it's started as service at bootup and you are
finished.
>
>
> If you are paicent enough to read a howto, then visit
> http://www.webmasterstop.com/tutorials/apache-php-mysql-inst allation.shtml
>
> No clue if it's a good one or not, but that was the first one that came up
for
> a such easy query at google as "howto mysql php windows".
>
>
> //Aho

Re: connection problem SQL

am 27.01.2005 04:26:43 von Shion

Jonathan Tremlett CIT2004 wrote:

> I was told to use the SQL_Query() rather than MySql_Connect() but then I
> have no place to put in my username and password so I amunfortuntely back to
> the drawing board.

As far as the php online manual knows, there aren't a such php function,
http://www.php.net/manual-lookup.php?lang=en&function=sql_qu ery&x=0&y=0


//Aho

Re: connection problem SQL

am 27.01.2005 05:53:03 von News Me

whaletyr wrote:
> I am trying to install PHP with Mysql on a Windows XP machine
>
> but I keep getting the following error
>
> Fatal error: Call to undefined function mysql_connect() in
> c:\Inetpub\wwwroot\test site\info.php on line 2
>
> Can anyone tell me what I do wrong?
>
> Whaletyr
>
> > $link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
> or die('Could not connect: ' . mysql_error());
> echo 'Connected successfully';
> mysql_select_db('my_database') or die('Could not select database');
> ?>
>
>

I'm using Apache 2, PHP 5 and MySQL 4.1 in a WinXP Home system. I found
that following the instructions for installing PHP worked quite nicely.
What part of the instructions didn't you understand or fail to follow?

NM

--
convert uppercase WORDS to single keystrokes to reply

Re: connection problem SQL

am 27.01.2005 10:59:36 von Jonathan Tremlett CIT2004

The installation I understood as php5 works well on its own and MySQL4.1
works on its own.

However, when I try to create a database in php it states that the
MySQL_create_db() is undefined. As I have stated that I have read various
other newsgroups and there are workarounds that I do not understand. The
exact error message is below:

Fatal error: Call to undefined function msql_create_db() in D:\My
Documents\Sample Webpages\php\make_db.php on line 10


The code I use to generate this error is below::

mysql_create_db("mydatabase");



Hope this allows you to see exactly what I am talking about.

Thank you in advance

Johnny

"News Me" wrote in message
news:10vgstagrpstla8@corp.supernews.com...
> whaletyr wrote:
> > I am trying to install PHP with Mysql on a Windows XP machine
> >
> > but I keep getting the following error
> >
> > Fatal error: Call to undefined function mysql_connect() in
> > c:\Inetpub\wwwroot\test site\info.php on line 2
> >
> > Can anyone tell me what I do wrong?
> >
> > Whaletyr
> >
> > > > $link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
> > or die('Could not connect: ' . mysql_error());
> > echo 'Connected successfully';
> > mysql_select_db('my_database') or die('Could not select database');
> > ?>
> >
> >
>
> I'm using Apache 2, PHP 5 and MySQL 4.1 in a WinXP Home system. I found
> that following the instructions for installing PHP worked quite nicely.
> What part of the instructions didn't you understand or fail to follow?
>
> NM
>
> --
> convert uppercase WORDS to single keystrokes to reply

Re: connection problem SQL

am 27.01.2005 13:26:56 von Shion

Jonathan Tremlett CIT2004 wrote:
> The installation I understood as php5 works well on its own and MySQL4.1
> works on its own.
>
> However, when I try to create a database in php it states that the
> MySQL_create_db() is undefined. As I have stated that I have read various
> other newsgroups and there are workarounds that I do not understand. The
> exact error message is below:
>
> Fatal error: Call to undefined function msql_create_db() in D:\My
> Documents\Sample Webpages\php\make_db.php on line 10
>
>
> The code I use to generate this error is below::
>
> mysql_create_db("mydatabase");

Still as pointed out before, you need to load the mysql dll for php in your
php.ini, without that php will not be able to talk with mysql. This is stated
in the howto that I did earlier post here.

Re: connection problem SQL

am 27.01.2005 21:19:38 von News Me

Jonathan Tremlett CIT2004 wrote:
> The installation I understood as php5 works well on its own and MySQL4.1
> works on its own.
>
[snip]

But the installation instructions specifically recommend that you do not
rely on the installer and do a manual installation. Give it a try.
It's really easy.

As others have stated, your problem is most likely that you need to copy
the file "libmySQL.dll" from the MySQL/bin directory to the PHP install
directory. Had you followed the manual install instructions, you would
have already done this.

NM

--
convert uppercase WORDS to single keystrokes to reply

Re: connection problem SQL

am 28.01.2005 17:42:53 von Jonathan Tremlett CIT2004

Hi,

I have removed php and put the binary version on and have set it up manually
in (hopefully) a clear head. I just tried a simple query and am tryong to
get an output but it is blank.

$query = "SELECT firstname FROM people WHERE id=2"
or die("ERROR: " . mysql_error());
$result = mysql_query($query);

I try and output the $result and get blank. What am I doing wrong here?

Johnny



"News Me" wrote in message
news:10vij6kfu3b3ab2@corp.supernews.com...
> Jonathan Tremlett CIT2004 wrote:
> > The installation I understood as php5 works well on its own and MySQL4.1
> > works on its own.
> >
> [snip]
>
> But the installation instructions specifically recommend that you do not
> rely on the installer and do a manual installation. Give it a try.
> It's really easy.
>
> As others have stated, your problem is most likely that you need to copy
> the file "libmySQL.dll" from the MySQL/bin directory to the PHP install
> directory. Had you followed the manual install instructions, you would
> have already done this.
>
> NM
>
> --
> convert uppercase WORDS to single keystrokes to reply

Re: connection problem SQL

am 28.01.2005 20:43:04 von News Me

Jonathan Tremlett CIT2004 wrote:
> Hi,
>
> I have removed php and put the binary version on and have set it up manually
> in (hopefully) a clear head. I just tried a simple query and am tryong to
> get an output but it is blank.
>
> $query = "SELECT firstname FROM people WHERE id=2"
> or die("ERROR: " . mysql_error());
> $result = mysql_query($query);
>
> I try and output the $result and get blank. What am I doing wrong here?

You are not reading the fine manual. The PHP manual is your friend. It
tells you how the various MySQL (and other functions) work and what they
return. If you had read the fine manual, you would know that
mysql_query() returns an error code, not the result set of your query.
To get the query result set, you need to use mysql_fetch_array() or
mysql_fetch_assoc() or mysql_fetch_row(). RTFM!

BTW, if you're using PHP 5, you should be using the improved MySQL
module (mysqli_* functions), not the older MySQL module (mysql_* functions).

NM

Re: connection problem SQL

am 29.01.2005 20:01:23 von Jonathan Tremlett CIT2004

Must confess I'm one of these guys who think they can use things without the
manual. Just like to thank everyone who has helped me get php set up and I
wrote down everything I had to do so that if tragedy strikes the PC I can
reset it all (hopefully) without having to seek advice. Yes I have looked
at the mysqli functions and although they are good I am a student and the
university has an older copy of php so think it might be safer for anything
to do with uni to keep to the prehistoric way and anything for myself I'll
be more modern.

Cheers

Johnny


"News Me" wrote in message
news:10vl5e1kjat5v3a@corp.supernews.com...
> Jonathan Tremlett CIT2004 wrote:
> > Hi,
> >
> > I have removed php and put the binary version on and have set it up
manually
> > in (hopefully) a clear head. I just tried a simple query and am tryong
to
> > get an output but it is blank.
> >
> > $query = "SELECT firstname FROM people WHERE id=2"
> > or die("ERROR: " . mysql_error());
> > $result = mysql_query($query);
> >
> > I try and output the $result and get blank. What am I doing wrong here?
>
> You are not reading the fine manual. The PHP manual is your friend. It
> tells you how the various MySQL (and other functions) work and what they
> return. If you had read the fine manual, you would know that
> mysql_query() returns an error code, not the result set of your query.
> To get the query result set, you need to use mysql_fetch_array() or
> mysql_fetch_assoc() or mysql_fetch_row(). RTFM!
>
> BTW, if you're using PHP 5, you should be using the improved MySQL
> module (mysqli_* functions), not the older MySQL module (mysql_*
functions).
>
> NM

Re: connection problem SQL

am 30.01.2005 21:33:29 von Dennis Dalsten

whaletyr wrote:

> I am trying to install PHP with Mysql on a Windows XP machine
>
> but I keep getting the following error
>
> Fatal error: Call to undefined function mysql_connect() in
> c:\Inetpub\wwwroot\test site\info.php on line 2
>
> Can anyone tell me what I do wrong?
>
> Whaletyr
>
> > $link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
> or die('Could not connect: ' . mysql_error());
> echo 'Connected successfully';
> mysql_select_db('my_database') or die('Could not select database');
> ?>
>
>

Easy peace. Have you installed the php_mysql, or mysql_mod?
When it says "Call yo undefined function mysql_connect()" - then there
is no module to describe the function.

/dennis