You are here: Re: Query Question2 « PHP Programming Language « IT news, forums, messages
Re: Query Question2

Posted by Dave on 07/23/05 15:27

Chris (Chris <coverland914 @ yahoo.com>) decided we needed to hear...
> Built on machine and works fine:
> PHP 5.0.4
> Apache 2.0.53
> MySQL Client API version 4.1.7
>
> Running on a server with the code below hanging up unless it's
> 'remmed' out...:
> PHP 4.1.1
> Apache 1.3.23
> MySQL Client API version 3.23.39
>
> mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to
> database"); // make connection to database
> mysql_select_db($DBName) or die("Unable to select database $DBName");

You don't need the code below in any case, since you have already
tested if your connection and database selection worked or not in
the lines above. However, you might wish to add the return value from
mysql_error() to the strings you output from die - that will
report the cause of any error more effectively.

> // select database
> // if (mysqli_connect_errno())
> // {
> // echo 'Error: Could not connect to database. Please report this
> problem.';
> // exit;
> // }
>
>
> Everything on my form worked fine on my development machine with the
> newer versions of PHP, MySQL, and Apache. When I ran it on the server
> with older versions, my query hung up.
>
> QUESTION: The part that specifically hangs is "if
> (mysqli_connect_errno())" of which I have to think something is there
> that wasn't in the older versions so... Does anyone know an
> equivalent line that will work on the older PHP ??? TIA

The mysqli library is seperate from the mysql library and provides
different (improved) functions - so you probably shouldn't be mixing
up using both sets of functions anyway - use one or the other, but
not both together. The reason the call doesn't work in the older
version of PHP is probably that its not compiled in or enabled.

--
Dave <dave@REMOVEbundook.com>
(Remove REMOVE for email address)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация