Corne`s Php/Sql vragen *Nieuw*

Gestart doorWereldhotel22 reacties70 weergaven

23 berichten · pagina 1 van 2

Wereldhotel

Lid · Topicstarter

Berichten
542
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik word er een beetje lui van steeds nieuwe topics te maken yummieDus stel ik hier me vraagjes

Code:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"config.php"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$count[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT count(downid) AS items FROM dls"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$count2[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$count[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$count2[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$count2[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]items[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$data[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM dls"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
[COLOR= #0000BB]$info[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR] [COLOR= #0000BB]$data[/COLOR] [COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/Print"]Print[/URL] [COLOR= #DD0000]"<b>ID:</b> "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$info[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]downid[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]" <br>"[/COLOR][COLOR= #007700];[/COLOR] 
[URL="http://www.php.net/Print"]Print[/URL] [COLOR= #DD0000]"<b>Price:</b> "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$info[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]price[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]" <br>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/Print"]Print[/URL] [COLOR= #DD0000]"<a href="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$info[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]downurl[/COLOR][COLOR= #007700]] .[/COLOR][COLOR= #DD0000]">Koop nu!</a>"[/COLOR][COLOR= #007700];[/COLOR]
?>


Ghehe ik blijf maar doorgaan. Maar omdat dit probleempje net iets anders is dan anderen (en moeilijker te maken denk k) geef ik een beloning voor de pers doe het doet zoals ik het wil van 0.20 punten.

En wat wil ik?
Ik wil dat alle producten die in de tabel staan op de pagina komen (Automatisch) Misschien heb je als hulpmiddel $count en $count2 (kweetniet of je daar wat aan hebt) && Ik wil dat als de pers bij een product op koop nu! klikt de prijs van het saldo van de persoon eraf gaat. (Punten heet in mijn mysql db: saldo) en dat als het geld eraf is dit
Header("Location:".$info[downurl] .);


op het id van de product die het persoon koopt word uitgevoerd (Miss is de code fout moet je ff kijke)

Als je niks aan $count en $count2 hebt haal het er dan maar uit ;p
0
Berichten
237
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Weet het niet zeker maar in een echo gebruik je " en moet zijn.
0
Wereldhotel

Lid · Topicstarter

Berichten
542
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat maakt niet uit hoor?
0
Berichten
545
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
* AS saldo

Hoe the **** wil je dat doen? alle columns in die table row naar saldo omzetten?
Ok..

[COLOR= #0000BB]<?php
$sql_aantal_saldo[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT `columnsaldo` AS saldo FROM `users` WHERE `id`={$_SESSION[uid]}"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$aantal_saldo[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql_aantal_saldo[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$aantal_saldo[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$aantal_saldo[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]saldo[/COLOR][COLOR= #007700]];[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"- U heeft "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$aantal_saldo[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" saldo verdient."[/COLOR][COLOR= #007700];[/COLOR]
?>
0
Wereldhotel

Lid · Topicstarter

Berichten
542
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
EDIT: Al fixed
0
Berichten
545
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nee..

Omdat je saldocolumn moet veranderen naar bijv: saldo of wat je dan ook qua waarde in je database hebt van saldo..

Edit:

Ok mooi smile
0
Wereldhotel

Lid · Topicstarter

Berichten
542
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nieuwe vraag.
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je kunt dan geen bestanden vanaf een andere server includen emo
0
Berichten
545
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"config.php"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$saldo[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT `saldo` FROM `users` WHERE `id`={$_SESSION[uid]}"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$usrData[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$saldo[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$buy[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$usrData[/COLOR][COLOR= #007700][[/COLOR]saldo[COLOR= #007700]];[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$buy[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]0.10[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT `saldo` FROM `users`  SET `saldo`-0,10  WHERE `id`={$_SESSION[uid]}"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/Header"]Header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Location: http://icorne.zxq.net/72tqgst7245twrsgr62dowbloASDS/2-726186.rar"[/COLOR][COLOR= #007700]);
}[/COLOR]
?>
0
Wereldhotel

Lid · Topicstarter

Berichten
542
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Alles werkt nu goed behalve er gaan geen punten (Saldo) af.
0
Berichten
545
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT `saldo` FROM `users`  SET `saldo`-0,10  WHERE `id`={$_SESSION[uid]}"[/COLOR][COLOR= #007700]);[/COLOR]
?>


vervangen door:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE `users`  SET `saldo`=`saldo`-0.10  WHERE `id`={$_SESSION[uid]}"[/COLOR][COLOR= #007700]);[/COLOR]
?>
0
Wereldhotel

Lid · Topicstarter

Berichten
542
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Alweer een nieuw foutje. Ik kan 80% scripten maar ik kan nog sommige dingen niet.
0
Berichten
545
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Omdat je focust op de $_POST var x, terwijl bij geen enkele input deze var bestaat..
de $_POST var x verander je in Button1 dan werkt hij waarschijnlijk.

EDIT: trouwens als ik me aanmelden wil op de site krijg ik dit: Unknown column rang in field list
0
Wereldhotel

Lid · Topicstarter

Berichten
542
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Fixed.

EDIT: Ik heb var verandert, maar werkt nog niet? ;p
0
Berichten
6.356
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"config.php"[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Button1[/COLOR][COLOR= #007700]])) {[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]downurl[/COLOR][COLOR= #007700]]) ||[/COLOR] [URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]price[/COLOR][COLOR= #007700]])) {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]U heeft niet alle velden ingevuld![/COLOR][COLOR= #007700];
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
        [COLOR= #0000BB]$Url[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM dls WHERE downurl = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]downurl[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$Url[/COLOR][COLOR= #007700]) ===[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
            [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO dls (downurl,price) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]downurl[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]", "[/COLOR][COLOR= #007700].([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]price[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De Download is Succesvol toegevoegd.[/COLOR][COLOR= #007700];
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Download Url is al in gebruik.[/COLOR][COLOR= #007700];
        }
    }
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<form method="post" style="width: 817px">[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Download Url:<br />[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input name="downurl" type="text" /><br />[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Prijs:<br />[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input name="price" type="text" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input name="Button1" type="button" value="Voeg Toe aan Shop!" style="height: 42px; width: 136px" /></form>[/COLOR][COLOR= #007700];
}[/COLOR]    
?>
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