You are not logged in.

  • Login
Bitte besucht unser neues Forum unter https://forum.nitrado.net | Please visit our new Forum at https://forum.nitrado.net

Dear visitor, welcome to Nitrado.net Prepaid Gameserver Community-Support - Archiv. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

YourSky

User / Kunde

  • "YourSky" started this thread

Posts: 1,430

Occupation: HTML3 Hacker

Thanks: 5

  • Send private message

1

Thursday, June 7th 2012, 11:42pm

PHP Problem

Hi,
Ich habe hier ein Script:



<?php
$db = mysql_connect("localhost", "username", "passwort");
$sel = "SELECT * FROM user";
$qu = mysql_query($sel, $db);
while($check = mysql_fetch_assoc($qu)){
if($check['pin_id'] == $_GET['id_acc']){
$up_sel = "UPDATE r12_kd17548_soc.user SET active = '1' WHERE pin_id = '".$_GET['id_acc']."'";
$query = mysql_query($up_sel);
}
}
?>
Es stimmt eigentlich alles aber er will es einfach nicht updaten :rofl:

mfg Jan
Mit freundlichen Grüßen,
Yonas

This post has been edited 1 times, last edit by "prog266" (Jun 8th 2012, 9:55am)


CybroX

User / Kunde

  • "CybroX" is male

Posts: 6,249

Occupation: Gott

Thanks: 737

  • Send private message

2

Friday, June 8th 2012, 10:16am

Klar, weil du keine Datenbank auswählst :)
Ausserdem gibst du die Verbindung in einem Query wieder .. ?

PHP Source code

1
2
3
4
5
6
7
8
9
10
11
12
<?php
mysql_connect("localhost""username""passwort");
mysql_select_db("Datenbanknname");
$sel "SELECT * FROM user";
$qu mysql_query($sel);
while($check mysql_fetch_assoc($qu)){
if($check['pin_id'] == $_GET['id_acc']){
$up_sel "UPDATE r12_kd17548_soc.user SET active = '1' WHERE pin_id = '".$_GET['id_acc']."'";
$query mysql_query($up_sel);
}
}
?>


genausogut kann man das query direkt schreiben

PHP Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
mysql_connect("localhost""username""passwort");
mysql_select_db("Datenbanknname");
$query mysql_query("SELECT * FROM user");

while($check mysql_fetch_assoc($query ))
{
   if($check['pin_id'] == $_GET['id_acc']){
   $up_sel "UPDATE r12_kd17548_soc.user SET active = '1' WHERE pin_id = '".$_GET['id_acc']."'";
   $queryresult mysql_query($up_sel);
}
}
?>
You depend on our protection, yet you feed us lies from the tablecloth.

YourSky

User / Kunde

  • "YourSky" started this thread

Posts: 1,430

Occupation: HTML3 Hacker

Thanks: 5

  • Send private message

3

Friday, June 8th 2012, 12:28pm

Sobald ich ihn der "while" schleife bin gibt er mir gar nichts mehr aus. Keine "if()" Abfragen keine "echo"`s
Mit freundlichen Grüßen,
Yonas


CybroX

User / Kunde

  • "CybroX" is male

Posts: 6,249

Occupation: Gott

Thanks: 737

  • Send private message

4

Friday, June 8th 2012, 12:31pm

PHP Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
mysql_connect("localhost""username""passwort");
mysql_select_db("Datenbanknname");
$sel "SELECT * FROM user";
$qu mysql_query($sel);

$erg = array();

while ($row mysql_fetch_assoc($query))
        {
            $erg[] = $row;
        }

foreach ($erg as $check)
{
if($check['pin_id'] == $_GET['id_acc']){
$up_sel "UPDATE r12_kd17548_soc.user SET active = '1' WHERE pin_id = '".$_GET['id_acc']."'";
$query mysql_query($up_sel);
}
}
?>


grob gebastelt, weiss nicht obs stimmt :)
You depend on our protection, yet you feed us lies from the tablecloth.

Bitte besucht unser neues Forum unter https://forum.nitrado.net| Please visit our new Forum at https://forum.nitrado.net