For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > April 2005 > newbie PHP/SQL problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author newbie PHP/SQL problem
Dave Moore

2005-04-17, 8:55 pm

Hi All,
I've install a supposedly compatible combination of PHP, SQL with an
Apache server. Generally all individual components seem to operate fine. I
can create tables in the database using mysql and I can run basic PHP code
in my browser using the apache server. Everything's running on my desktop
PC.

However, whenever I use the mySQL related functions in my PHP, the php
script just stops. No error messages. Just nothing. For example, using
something like:

$conn = mysql_connect("localhost", "root", "") or die(mysql_error());

in my php just stops the script dead. Everything up to this line executes
but nothing after it. This appears to be the same behaviour as if I put in a
non-existant function call. So my question is, how does the php know where
to find the SQL functions?. Is there any configuration required?. All of my
components came out of a book (with CD) and have been configured as
suggested.

Any ideas?.

Ta,
Dave


Kimmo Laine

2005-04-17, 8:55 pm

"Dave Moore" <dave_m_moore@post2me.freeserve.co.uk> kirjoitti
viestissä:d3ufje$elj$1@newsg3.svr.pol.co.uk...
> Hi All,
> I've install a supposedly compatible combination of PHP, SQL with an
> apache server. Generally all individual components seem to operate fine. I
> can create tables in the database using mysql and I can run basic PHP code
> in my browser using the apache server. Everything's running on my desktop
> PC.
>
> However, whenever I use the mySQL related functions in my PHP, the php
> script just stops. No error messages. Just nothing. For example, using
> something like:
>
> $conn = mysql_connect("localhost", "root", "") or die(mysql_error());
>
> in my php just stops the script dead. Everything up to this line executes
> but nothing after it. This appears to be the same behaviour as if I put in
> a
> non-existant function call. So my question is, how does the php know where
> to find the SQL functions?. Is there any configuration required?. All of
> my
> components came out of a book (with CD) and have been configured as
> suggested.
>
> Any ideas?.
>


Would you normally get errormessages for any other kind of errors. Also:
there's a function function_exists, which tests if a function exsists. Try
something like
if(function_exists("mysql_connect")) echo "It's alive! Aliiiive!";
And then see what phpinfo(); prints about mysql. That might give you some
answers what's going on in there.

--
"I am pro death penalty. That way people learn
their lesson for the next time." -- Britney Spears

eternal.erectionN0@5P4Mgmail.com


Michael Bradley-Robbins

2005-04-18, 3:56 am

if it's a non-existant function call, add C:\PHP to your PATH, or put
libmysql.dll (mysql < 4.1) or libmysqli.dll (mysql >= 4.1) into
c:\windows\system32 (if you're on windows. if you're on linux, that's not my
area.)

"Dave Moore" <dave_m_moore@post2me.freeserve.co.uk> wrote in message
news:d3ufje$elj$1@newsg3.svr.pol.co.uk...
> Hi All,
> I've install a supposedly compatible combination of PHP, SQL with an
> apache server. Generally all individual components seem to operate fine. I
> can create tables in the database using mysql and I can run basic PHP code
> in my browser using the apache server. Everything's running on my desktop
> PC.
>
> However, whenever I use the mySQL related functions in my PHP, the php
> script just stops. No error messages. Just nothing. For example, using
> something like:
>
> $conn = mysql_connect("localhost", "root", "") or die(mysql_error());
>
> in my php just stops the script dead. Everything up to this line executes
> but nothing after it. This appears to be the same behaviour as if I put in
> a
> non-existant function call. So my question is, how does the php know where
> to find the SQL functions?. Is there any configuration required?. All of
> my
> components came out of a book (with CD) and have been configured as
> suggested.
>
> Any ideas?.
>
> Ta,
> Dave
>
>



Scriptdude

2005-04-18, 8:55 am

Dave Moore wrote:
> Hi All,
> I've install a supposedly compatible combination of PHP, SQL with an
> apache server.


Which one?

I would suggest downloading XAMPP. Pretty much the best PHP/MySQL
package available. Includes PHP switcher, to switch from PHP 4.x to 5.x
on-the-fly.

http://www.apachefriends.org/en/xampp.html

> However, whenever I use the mySQL related functions in my PHP, the php
> script just stops. No error messages. Just nothing. For example, using
> something like:
>
> $conn = mysql_connect("localhost", "root", "") or die(mysql_error());
>
> in my php just stops the script dead.


Open your PHP.INI and check if error_reporting is set correctly.

error_reporting = E_ALL & ~E_NOTICE

Set it like that and the die() command will spit out encountered errors,
which seems to be what you're looking for?

--
___| ___| _ \ _ _| _ \__ __| __ \ | | __ \ ____|
\___ \ | | | | | | | | | | | | | __|
| | __ < | ___/ | | | | | | | |
_____/ \____|_| \_\___|_| _| ____/ \___/ ____/ _____|
Computers will never take the place of books. You can't stand on a
floppy disk to reach a high shelf.
I thought 'Deep Throat' was a movie about a giraffe :/


Dave Moore

2005-04-18, 8:56 pm

No, that doesn't work either.

I've run up the database using winmysqladmin.exe, run up the server. I've
copied my libmysql.dll into windows and windows/system directories.

if(function_exists("mysql_connect"))
echo "It's alive! Aliiiive!";
else
echo "Can't find it";

fails. There's no mention of mysql in the phpinfo() output. It mentions
SQLite but nothing about MySQL. I assume it should?.

Any more ideas?.

Ta,
Dave


"Michael Bradley-Robbins" <michael@bradley-robbins.net> wrote in message
news:1165u8e3atdb174@corp.supernews.com...
> if it's a non-existant function call, add C:\PHP to your PATH, or put
> libmysql.dll (mysql < 4.1) or libmysqli.dll (mysql >= 4.1) into
> c:\windows\system32 (if you're on windows. if you're on linux, that's not

my
> area.)
>
> "Dave Moore" <dave_m_moore@post2me.freeserve.co.uk> wrote in message
> news:d3ufje$elj$1@newsg3.svr.pol.co.uk...
I[color=darkred]
code[color=darkred]
desktop[color=darkred]
executes[color=darkred]
in[color=darkred]
where[color=darkred]
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com