You are here: Re: mySQL works on one server but not another « PHP Programming Language « IT news, forums, messages
Re: mySQL works on one server but not another

Posted by |-|erc on 11/02/05 11:32

"Kim Andrι Akerψ" <kimandre@NOSPAMbetadome.com> wrote in
: |-|erc wrote:
:
: > Here's a test program that should output Members:0
: > but instead I get "I cannot get data from the database!".
: > Its as if the tables are not there but I have created them, does
: > anyone know why this would work on one server but not another?
: >
: > <?php
: > function sql_get_result($sql) {
: > global $link, $result;
: > if ( !($result = mysql_query($sql, $link))) { exit ("I cannot get
: > data from database!<br>"); } return $result;
: > }
: >
: > include('config.php');
: > $link = @mysql_connect ($DB_HOST, $DB_USER, $DB_PASS) or die ('SQL
: > Connection troubles'); mysql_select_db ($DB_DB);
: >
: >
: > $sql = "SELECT count(*) from `members` WHERE 1";
: > $result = sql_get_result($sql);
: > $counter = mysql_fetch_row($result);
: > echo "<br><b>Members: ". $counter[0];
: > ?>
:
: Does the table exist with the same columns in the database on both
: servers?
:
: Also, if you add the following line in the above function, what comes
: up?
: echo mysql_error();

No database selected.

in config I have $DB_DB = 'u4f';
and the database name is u4f
I also tried setting $DB_DB to upload4free_u4f
that's the account name.

its a custom control panel with Globat but it looks like I set the database up correctly, it logs in the user ok.

Herc

 

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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация