Kleine Vragen Topic #1

Gestart doorLennard4.284 reacties15.585 weergaven

4.285 berichten · pagina 212 van 286

Berichten
6.037
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Gamedealer schreef:
Dan voeg je een rij toe in een tabel en dan kijk je of de rij bestaat en het lid de advertentie gedaan heeft..?
Kan ik doen, bedankt yummie
0
Jvdw

Lid

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
weet iemand hoe je heel gemakkelijk met onclick een cookie maakt?
0
Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
onClick="javascriptcookieaanmaakfunctie();"

function javascriptcookieaanmaakfunctie() {
    set_cookie(); oid ik weet die code neit :)
}
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Gewoon even op google kijken "set cookie with javascript"?
0
Berichten
6.037
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Waarom zet hij niet "adnaam" en "credits" in de database? De rest staat er wel in maar die twee komen er niet in te staan? confused
Code:
Spoiler tonen
[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]$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM link ORDER BY id DESC"[/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]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]])) || ([/COLOR][COLOR= #0000BB]$gegevens[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]rank[/COLOR][COLOR= #007700]] !=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je kan alleen punten verdienen als je ingelogt bent!"[/COLOR][COLOR= #007700];
    
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]


[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO keuring (adnaam,link,credits,gebruikersnaam,IP) VALUES ("[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]adnaam[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]","[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]link[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]","[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]credits[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]", "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gegevens[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]" , "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/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]"Oke! Een admin controleert of dit goed is gedaan, binnen het uur krijg je je punten!"[/COLOR][COLOR= #007700];
}[/COLOR]



[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]))
  {[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<form action="" method="POST">[/COLOR][COLOR= #007700];[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="text" name="adnaam" size="50" value="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" disabled />[/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 type="text" name="beschrijving" size="150" value="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]beschrijving[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" disabled />[/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]<a href="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]link[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"><img src="http://cdn1.iconfinder.com/data/icons/humano2/32x32/actions/old-go-next.png" /></a><input type="hidden" name="link" value="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]link[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" /><br />[/COLOR][COLOR= #007700];[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<img src="http://cdn1.iconfinder.com/data/icons/finance_icons/PNG/png16/coins.png" /> [/COLOR][COLOR= #007700];[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type:"text" name="credits" value="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]credit[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" size="3" disabled />[/COLOR][COLOR= #007700];[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<br /><br />"[/COLOR][COLOR= #007700];[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="submit" value="Ik heb deze ingevuld." name="next" />[/COLOR][COLOR= #007700];[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<br /><br /><hr>"[/COLOR][COLOR= #007700];[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<form>[/COLOR][COLOR= #007700];
  }
}[/COLOR]

?>
toevoeging op 26 december 2012, 17:26:19:
laat maar, heel dat ding werkt niet sadleyHij neemt alleen de onderste eruit dan.. sadley Even opnieuw maken.
0
Jvdw

Lid

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
wat is er mis met dit? :

function cookie() {
    set_cookie("naam", "bekenen", time()+259200);
    
}
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Jvdw schreef:
wat is er mis met dit? :

function cookie() {
    set_cookie("naam", "bekenen", time()+259200);
    
}
Hij vroeg in javascript
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
document.cookie()
0
Berichten
6.037
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hey,

Ik heb weeral hulp nodig, maar deze keer met een vraag hoe ik iets moet doen. emoDit is het probleem:
Ik wil dat als je naar "domein.nl/ads.php?id=1" gaat dat hij dan de informatie die bij dat id staat weergeeft. Hoe doe ik dat? Het zal toch niet zo moeilijk zijn?

Dit is wat ik tot nu toe heb:
Spoiler tonen
[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]$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM link ORDER BY id DESC"[/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]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]))) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je kan alleen punten verdienen als je ingelogt bent!"[/COLOR][COLOR= #007700];
    
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    
    [COLOR= #0000BB]$GetQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT id FROM link"[/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][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]) ==[/COLOR] [COLOR= #0000BB]$GetQuery[/COLOR][COLOR= #007700]){[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"het werkt!"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]//hier moet dan die informatie komen te staan.[/COLOR]
    [COLOR= #007700]}[/COLOR]
    
    
    
    [COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM link ORDER BY id DESC"[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]))
    {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="text" name="adnaam" value="[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]] .[/COLOR][COLOR= #DD0000]" size="50" disabled/><br />[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="text" name="credits" value="[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]credit[/COLOR][COLOR= #007700]] .[/COLOR][COLOR= #DD0000] credits" size="10" disabled/> <input type="text" name="go" value="localhost/ads.php?ad=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" size="34" disabled/> <br /><br />[/COLOR][COLOR= #007700];
        
        }
    
    
}[/COLOR]

?>
toevoeging op 26 december 2012, 20:57:28:
Alvast bedankt!
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Dan maak je een where clause in een query, haal je het id op met $_GET[id], escapen met mysql_real_escape() en in de where clause plaatsen.
0
Berichten
6.037
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Sevvlor schreef:
Dan maak je een where clause in een query, haal je het id op met $_GET[id], escapen met mysql_real_escape() en in de where clause plaatsen.
Bedankt, ik zal eens gaan googleen. biggrin
toevoeging op 26 december 2012, 211223:

[COLOR= #0000BB]<?php

$GetQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM link WHERE id="[/COLOR][COLOR= #007700].([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/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][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]) ==[/COLOR] [COLOR= #0000BB]$GetQuery[/COLOR][COLOR= #007700]){[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"het werkt!"[/COLOR][COLOR= #007700];
    }[/COLOR]

?>


Dit heb ik nu, wat moet erna komen?
0
Berichten
1.871
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Weet iemand hoe ik dit kan gebruiken zonder "map"?

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.domein.nl$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([^.]+).domein.nl$ [NC]
RewriteCond %{REQUEST_URI} !map/
RewriteRule ^(.*)$ /map/$1?titel=%2


Naar deze tut van Milan
0
Berichten
13.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Zonder map.. Wat wil je dan precies?
0
Berichten
1.871
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
De locatie is nu bij hoi.domein.nl /map/hoi/ dat wil ik dus veranderen in /hoi/
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Jordyvc schreef:
Eerdere citaten tonen
Sevvlor schreef:
Dan maak je een where clause in een query, haal je het id op met $_GET[id], escapen met mysql_real_escape() en in de where clause plaatsen.
Bedankt, ik zal eens gaan googleen. biggrin
toevoeging op 26 december 2012, 211223:

[COLOR= #0000BB]<?php

$GetQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM link WHERE id="[/COLOR][COLOR= #007700].([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/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][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]) ==[/COLOR] [COLOR= #0000BB]$GetQuery[/COLOR][COLOR= #007700]){[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"het werkt!"[/COLOR][COLOR= #007700];
    }[/COLOR]

?>


Dit heb ik nu, wat moet erna komen?
Die if-statement is onnodig. Gewoon met mysql_fetch_assoc de boel ophalen
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