Kleine Vragen Topic #1

Gestart doorLennard4.284 reacties15.585 weergaven

4.285 berichten · pagina 235 van 286

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
hmm oke ;p hoe los ik dit op want als ik een include maak naar config geeft hij een vage error
0
Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat is onzin, het betekent dat wat je in de functie geen geldig resultaat van mysql_query is.

of wel waarschijnlijk heb je een fout in je query.
0
Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
hoe kan ik dat oplossn?
zal ik de lijn posten?
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Daar kan je mee beginnen
0
Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jespar schreef:
hoe kan ik dat oplossn?
zal ik de lijn posten?

hier is de lijn

[COLOR= #0000BB]<?php[/COLOR]

        [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$news[/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] MYSQL_ASSOC[COLOR= #007700]))[/COLOR]

?>
Waarom doe je niet gewoon gelijk:

mysqh_fetch_assoc(); ??
0
Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
hier is de lijn

[COLOR= #0000BB]<?php[/COLOR]

        [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$news[/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] MYSQL_ASSOC[COLOR= #007700]))[/COLOR]

?>
Freestyle schreef:
Eerdere citaten tonen
Jespar schreef:
hoe kan ik dat oplossn?
zal ik de lijn posten?

hier is de lijn

[COLOR= #0000BB]<?php[/COLOR]

        [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$news[/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] MYSQL_ASSOC[COLOR= #007700]))[/COLOR]

?>

Waarom doe je niet gewoon gelijk:

mysqh_fetch_assoc(); ??

werkt ook niet
0
Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Freestyle schreef:
Eerdere citaten tonen
Jespar schreef:
hoe kan ik dat oplossn?
zal ik de lijn posten?

hier is de lijn

[COLOR= #0000BB]<?php[/COLOR]

        [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$news[/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] MYSQL_ASSOC[COLOR= #007700]))[/COLOR]

?>

Waarom doe je niet gewoon gelijk:

mysqh_fetch_assoc(); ??

Wat is dit voor domme opmerking? Het resultaat komt er hetzelfde uit en array is in 9/10 gevallen sneller. Ik gebruik nog steeds het liefst een db class maar de manier van fetchen boeit echt geen fuck.

We hebben de lijn die $data maakt wink
0
Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?PHP
        $data[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT title, id, published, shortstory, image FROM cms_news ORDER BY id DESC LIMIT 5"[/COLOR][COLOR= #007700]);[/COLOR]
                
        [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$news[/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] MYSQL_ASSOC[COLOR= #007700]))[/COLOR]
?>


zo de data code zit er bij

toevoeging op 24 januari 2013, 161852:
omg ik heb het al opgelost er moest nog iets in namelijk published in de cms
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
En met goede foutafhandeling (en het gebruik van mysql_error() ) op je $data zag je direct al de fout.
0
Berichten
1.644
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik bied me aan om gratis een layout te basen om ervaring op te doen stuur een foto in pm en ik zeg of ik hem voor u kan basen.
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wie weet een PHP waarmee ik images een cirkel van kan maken en croppen?
0
Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kan dat niet gewoon met HTML5 ???
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Lang leve canvas....
0
Berichten
5.952
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
voor de PHP geleerde is dit waarschijnlijk een hele domme vraag, maar ook domme vragen moeten gesteld worden.
Ik heb dit script.

[COLOR= #0000BB]<?php[/COLOR]

[COLOR= #007700]function[/COLOR] curl_get[COLOR= #007700]([/COLOR][COLOR= #0000BB]$url[/COLOR][COLOR= #007700],[/COLOR] [URL="http://www.php.net/array"]array[/URL] [COLOR= #0000BB]$get[/COLOR] [COLOR= #007700]=[/COLOR] NULL[COLOR= #007700],[/COLOR] [URL="http://www.php.net/array"]array[/URL] [COLOR= #0000BB]$options[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]()) {[/COLOR]   
    [COLOR= #0000BB]$defaults[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR]
        CURLOPT_URL [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$url[/COLOR][COLOR= #007700]. ([/COLOR][URL="http://www.php.net/strpos"]strpos[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$url[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]?[/COLOR][COLOR= #007700]) ===[/COLOR] FALSE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]?[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]).[/COLOR] http_build_query[COLOR= #007700]([/COLOR][COLOR= #0000BB]$get[/COLOR][COLOR= #007700]),[/COLOR]
        CURLOPT_HEADER [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR]
        CURLOPT_RETURNTRANSFER [COLOR= #007700]=>[/COLOR] TRUE[COLOR= #007700],[/COLOR]
        CURLOPT_TIMEOUT [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]4[/COLOR]
    [COLOR= #007700]);[/COLOR]
   
    [COLOR= #0000BB]$ch[/COLOR] [COLOR= #007700]=[/COLOR] curl_init[COLOR= #007700]();[/COLOR]
    curl_setopt_array[COLOR= #007700]([/COLOR][COLOR= #0000BB]$ch[/COLOR][COLOR= #007700], ([/COLOR][COLOR= #0000BB]$options[/COLOR] [COLOR= #007700]+[/COLOR] [COLOR= #0000BB]$defaults[/COLOR][COLOR= #007700]));[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]( ![/COLOR] [COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] curl_exec[COLOR= #007700]([/COLOR][COLOR= #0000BB]$ch[/COLOR][COLOR= #007700]))
    {[/COLOR]
        [URL="http://www.php.net/trigger_error"]trigger_error[/URL][COLOR= #007700]([/COLOR]curl_error[COLOR= #007700]([/COLOR][COLOR= #0000BB]$ch[/COLOR][COLOR= #007700]));
    }[/COLOR]
    curl_close[COLOR= #007700]([/COLOR][COLOR= #0000BB]$ch[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$result[/COLOR][COLOR= #007700];
}[/COLOR]

[COLOR= #0000BB]$url[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"http://api.twitter.com/1/statuses/user_timeline.json"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]screen_name[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #DD0000]ralphjxs[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]count[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]trim_user[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$tweet[/COLOR] [COLOR= #007700]=[/COLOR] json_decode[COLOR= #007700]([/COLOR]curl_get[COLOR= #007700]([/COLOR][COLOR= #0000BB]$url[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$query[/COLOR][COLOR= #007700]),[/COLOR] true[COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]text[/COLOR][COLOR= #007700]];
?[/COLOR]


Hoe kan ik er nu voor zorgen dat dit script meer dan 1 tweet ophaalt?
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
" count => 1, "

Dat misschien? 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