Variabelen

Gestart doorMitchels20 reacties40 weergaven

21 berichten · pagina 1 van 2

Mitchels

Lid · Topicstarter

Berichten
2.396
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb een variabel $st
Die kan G, A of O zijn
Nu wil ik als hij G is dat er dan variabele $status = 1 is
Bij A $status = 2
En O $status = 0
Hoe doe ik dit?
Ik heb dit:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]_include.php[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$st[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]st[/COLOR][COLOR= #007700]]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Status: $st<br>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$st[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"G"[/COLOR][COLOR= #007700])
{[/COLOR]
[COLOR= #0000BB]$status[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$st[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]"A"[/COLOR][COLOR= #007700])
{[/COLOR]
[COLOR= #0000BB]$status[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$st[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]"O"[/COLOR][COLOR= #007700])
{[/COLOR]
[COLOR= #0000BB]$status[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$status[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #0000BB]1[/COLOR] AND [COLOR= #0000BB]$status[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #0000BB]0[/COLOR] [COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$status[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #0000BB]1[/COLOR] AND [COLOR= #0000BB]$status[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #0000BB]2[/COLOR] [COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$status[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #0000BB]0[/COLOR] AND [COLOR= #0000BB]$status[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #0000BB]2[/COLOR] [COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL]
[COLOR= #007700]}[/COLOR]
?>


Maar dat werkt nietyummie
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]//include_once _include.php;[/COLOR]
[COLOR= #0000BB]$st[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]st[/COLOR][COLOR= #007700]]);[/COLOR]

[COLOR= #0000BB]$array[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]O[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]G[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]A[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$status[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$array[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$st[/COLOR][COLOR= #007700]];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]status: [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$status[/COLOR][COLOR= #007700];[/COLOR]
0
Mitchels

Lid · Topicstarter

Berichten
2.396
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Danke biggrin
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Alsje. clown
0
Mitchels

Lid · Topicstarter

Berichten
2.396
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kan dit:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"DELETE FROM acties2 WHERE user = blaat AND ip = blaat AND cid = blaat"[/COLOR][COLOR= #007700]);[/COLOR]
?>
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Probeer het uit.. emo
Als t goed is werkt het (mits je die blaten ff veranderd).
0
Mitchels

Lid · Topicstarter

Berichten
2.396
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Het lukt niet emoHij delete hem niet.
Grrr.
Ben er nu al 3 dagen mee bezig
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Zoek dan eens uit wat je query volgens jou moet zijn, en wattie is als hij wordt uitgevoerd, dan weet je waar het fout gaat. emo
0
Mitchels

Lid · Topicstarter

Berichten
2.396
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat heb ik al gedaan emoMaar volgens mij doe ik alles goed.
Behalve dat deleten. (is volgens mij ook goed, maar werkt niet)
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Welke query wordt er dan uitgevoerd?
0
Mitchels

Lid · Topicstarter

Berichten
2.396
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
if ($status2 != 1 AND $status2 != 0 )
{
mysql_query("INSERT INTO `acties3` (cid,user,date,vergoeding,ip) VALUES (".$cid.",".$epi.",".date("d/m/Y H:i:s").",".$verdienste.",".$ip.")") OR DIE(mysql_error());
mysql_query("DELETE FROM acties2 WHERE user = ".$epi." AND ip = ".$ip." AND cid = ".$cid."");
}
elseif ($status2 != 1 AND $status2 != 2 )
{
mysql_query("INSERT INTO `acties2` (cid,user,date,vergoeding,ip) VALUES (".$cid.",".$epi.",".date("d/m/Y H:i:s").",".$verdienste.",".$ip.")") OR DIE(mysql_error());
}
elseif ($status2 != 0 AND $status2 != 2 )
{
mysql_query("UPDATE `users` SET `kliks`=`kliks`+".$verdienste." WHERE user=".$epi."") OR DIE(mysql_error());
mysql_query("INSERT INTO `acties` (cid,user,date,vergoeding,ip) VALUES (".$cid.",".$epi.",".date("d/m/Y H:i:s").",".$verdienste.",".$ip.")") OR DIE(mysql_error());
mysql_query("DELETE FROM acties2 WHERE user = ".$epi." AND ip = ".$ip." AND cid = ".$cid."");
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Ja, maar zo wordt hij niet uitgevoerd.
Je moet weten hoe die delete query eruit ziet als hij door MySQL wordt uitgevoerd, dus waar $epi en $ip en alles al is ingevuld.
0
Tim

Lid

Berichten
712
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Zet eens achter de niet functionerende querys "or die (mysql_error());" en voer het script dan eens uit?
0
Mitchels

Lid · Topicstarter

Berichten
2.396
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Tim worshippy
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Wat was de fout nou? emo
edit:
zeker die "" aan t eind? emo
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren