Thursday, July 29th 2010, 1:31pm UTC+2

You are not logged in.

  • Login
  • Register

christoph

Trainee

Posts: 78

Location: Germany

1

Monday, March 3rd 2008, 6:48pm

MYSQL Datenbank Counter Problem!

Ich such den Fehler schon seit gut einer Woche, aber ich find in einfach nicht!
Der Counter liest nichts aus und schreibt nichts in die Datenbank!
Ich bin ratlos!


DB Counter Code:

PHP Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
$db=mysql_connect ("-","-","-");
mysql_select_db ("DB367732"$db);

$resultmysql_fetch_objectmysql_query("select * from counter where id='1'",$db));

if($result->ip != $REMOTE_ADDR)
{
$newcounter= ++$result->counter;
mysql_query("UPDATE counter SET counter='$newcounter', ip='$REMOTE_ADDR' WHERE id='1'",$db);
}
echo "Sie sind der $result->counter. Besucher";
?>
?( 8)
  • Go to the top of the page

2

Tuesday, March 4th 2008, 11:07pm

Hallo,

verwende mal mysql_error und poste bitte mal die Fehlermeldung.
Ansonsten ersetze mal mysql_fetch_object durch mysql_result und gugg dir mal das Thema Datentypen an... id=1 <-- OK id='1' <-- FALSCH sofern du der Spalte id nicht den Datentyp "Zeichen(kette)" gegeben hast.
Greetz Andi

Mod Dewey

CREAKTIF - Comes soon

Google ist dein Freund :D
  • Go to the top of the page

christoph

Trainee

Posts: 78

Location: Germany

3

Wednesday, March 5th 2008, 7:55am

mit mysql_result kommt enie Fehlermeldung:

Warning: Wrong parameter count for mysql_result() in /xxx/xxxx/xxx/xx/xxxx/htdocs/counter.php on line 5
Sie sind der . Besucher

Ich bin schon am verzweifeln!
mein jetziger Code:

PHP Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
$db mysql_connect ("xxx","xxx","xxx");
mysql_select_db ("xxx"$db);

$resultmysql_result mysql_query("select * from counter where id=1",$db));

if($result->ip != $REMOTE_ADDR)
{
$newcounter = ++$result->counter;
mysql_query("UPDATE counter SET counter='$newcounter', ip='$REMOTE_ADDR' WHERE id=1",$db);
}
echo "Sie sind der $result->counter. Besucher";
?>

?(
  • Go to the top of the page

undefined

Super Moderator

Posts: 4,248

Location: Germany

4

Wednesday, March 5th 2008, 9:17am

Solch eklatante Fehler im Script weisen klar darauf hin das jemand anscheinend zu faul ist die Manual zu lesen.
http://de.php.net/manual/de/function.mysql-connect.php
http://de.php.net/manual/de/function.mysql-query.php
http://de.php.net/manual/de/function.mysql-result.php
CLOSED
Undefined Behavior (undefiniertes Verhalten) bedeutet meistens etwas ungültiges.
PHP Katepart - Speichenrechner - .htpasswd - RPM XDG Tool - Kcmnvview - QTidy
  • Go to the top of the page