Dismiss Notice
You are browsing this site as a guest. It takes 2 minutes to CREATE AN ACCOUNT and less than 1 minute to LOGIN

PHP: Wataalam Nahitaji Maelezo

Discussion in 'Tech, Gadgets & Science Forum' started by Given Edward, Nov 18, 2011.

  1. Given Edward

    Given Edward Verified User

    #1
    Nov 18, 2011
    Joined: Jan 11, 2011
    Messages: 852
    Likes Received: 2
    Trophy Points: 35
    Naomba maelezo kuhusu isset() na functions in general. Sitaki copy and paste nimesearch sana tu lakini they ain't speaking my language. Ni kwa jinsi unavyoelewa wewe.
    Ahsanteni
     
  2. Given Edward

    Given Edward Verified User

    #2
    Nov 18, 2011
    Joined: Jan 11, 2011
    Messages: 852
    Likes Received: 2
    Trophy Points: 35
    Anybody?
     
  3. Bujibuji

    Bujibuji JF-Expert Member

    #3
    Nov 18, 2011
    Joined: Feb 4, 2009
    Messages: 27,178
    Likes Received: 5,422
    Trophy Points: 280
    Beh, sisi wa lringa PHP ina maanisha "Penyewe Hapo Poa" utajiju penyewe hapo ni poa kwa kujinyonga, niangusage aun kuchinjia mbwa
     
  4. e2themiza

    e2themiza JF-Expert Member

    #4
    Nov 18, 2011
    Joined: Mar 29, 2011
    Messages: 960
    Likes Received: 23
    Trophy Points: 35
    Vumili mkuu watalamu watakuja saidia. Binafsi nafaham php kidogo tu na nimeitumia hyo function but cna maelezo ya kina lakini mie niltumia pamoja na if statement ambapo nilideclare kwa mfano unategeneza login panel sasa hii function una declare if isset.. Apo maana kwamba akiclick login button kitu flan kitokee dependening umedeclare nini au ukiweka if !Isset (not isset) kwa mfano wangu yani asipoclick iyo login button. Kitu flani kitokee... Ayo ni machache ninayofahamu and I stand corrected, tungojee watalamu watujuze zaidi.
     
  5. Einstein

    Einstein Senior Member

    #5
    Nov 18, 2011
    Joined: Dec 5, 2009
    Messages: 122
    Likes Received: 1
    Trophy Points: 0

    isset() function hutumika kucheck kama variable flani iko set na value.. Let us say una variable inaitwa $uname .. kama haiko assigned ili kucheck kama iko assigned na value yoyote unatumia isset function.. Mfano check hii code

    if(isset($uname))
    {
    this will be executed...
    }

    else
    {
    this
    }



    .. Maanake ni kwamba, isset function returns true if the variable is set with some value, else it returns false.. Na hii hutumika sana kwenye global variables kama zile $_POST variable..

    mfano waweza check,

    if( isset($_POST['formparameter']) )
    {
    //this is executed
    }
    else
    {
    this
    }
     
  6. chengachenga

    chengachenga Member

    #6
    Nov 18, 2011
    Joined: Oct 26, 2011
    Messages: 17
    Likes Received: 0
    Trophy Points: 0
    chines au?
     
  7. Given Edward

    Given Edward Verified User

    #7
    Nov 18, 2011
    Joined: Jan 11, 2011
    Messages: 852
    Likes Received: 2
    Trophy Points: 35
    meaning?
     
  8. nachid

    nachid JF-Expert Member

    #8
    Nov 18, 2011
    Joined: Apr 14, 2011
    Messages: 852
    Likes Received: 19
    Trophy Points: 35
    Jf kuna vichwa we acha tu
     
  9. HT

    HT JF-Expert Member

    #9
    Nov 18, 2011
    Joined: Jul 29, 2011
    Messages: 1,899
    Likes Received: 3
    Trophy Points: 0
    PHP ni interpreted language amabayo ina maan kuwa variable type inakuwa determined during runtime. Kwa hiyo unapo define variable inaingia ktk kitu kama table ya variables (just for illustration) na kama haipo defined ina maana haitakuwapo ktk variable 'table'. Isset huwa inaangalia kama variable imekuwa defined tayari sehemu na inarudisha kweli kama imekuwa defined na sikweli kama haikuwa defined mahali.

    Matumizi ya isset kama unavyoona, ni kuepuka kutumia variable ambayo haijawa defined ktk script.
    Hope umepata mwanga!
     
  10. Mtazamaji

    Mtazamaji JF-Expert Member

    #10
    Nov 18, 2011
    Joined: Feb 29, 2008
    Messages: 5,972
    Likes Received: 27
    Trophy Points: 0
    Mimi nitajaribu kuelezea function

    Function kwenye programming ni mstari au mistari ya codes inayofanya kazi fuani. kazi hii inaweza kuwa
    • sipme task kama kudisplay au kuprint kitu kwenye screen
    • kuita function nyingine
    • Kufanya task fulani. complex yenye fucnti nyingine ndani yake.
    Pia kwenye programing Kuna aina mbali mbali za functions. Zipo system/ Inbulit functions mfano kwenye C main() ni root function ya fucntion zote . Kwenye PHP kuna system functtion nyingi tu kama echo() , date (), isset(), etc Unaweza kuona list ya inbuilt funtions za php hapa

    zadi ya inbulit function prgrammer anaweza kutengeza function zake. ukiangali CMS application nyingi zinatumia pia user defined function atika mambo ya tovuti.

    Mfano
    Badala ya kurdia Header na footer za ukurasa wa tovuti prohgramer atatengeneza functionya foooter ya header. Kwa hiyo ataandika coes za header au footer mara moja tu. ni kila mara atakapotaka itokee footer au header atakachfanya ni kuita( Calling) ile function.

    faida
    • faida moja wapo ya function ni kuwezesha ku re use code sehemu tofauti tofauti by just caling the spefic function.Kwa hiyo bila fuction prgram iiyonadikwa kwa mistari eg 300kwa kutumi functions basi inaweza kukamilika kwa mistari 1000 function zisipotumika.
    Nawasilisha
     
  11. Given Edward

    Given Edward Verified User

    #11
    Nov 18, 2011
    Joined: Jan 11, 2011
    Messages: 852
    Likes Received: 2
    Trophy Points: 35
    thanks sana Mtazamaji! Nadhani formula ya function ni:
     
  12. Given Edward

    Given Edward Verified User

    #12
    Nov 18, 2011
    Joined: Jan 11, 2011
    Messages: 852
    Likes Received: 2
    Trophy Points: 35
    thanks sana Mtazamaji! Nadhani formula ya function ni:
    sasa kama unataka kuiita, unaiitaje? Kwa mfano hapa
    PHP:
    <?php
    function empty_box(){
    echo 
    "Please fill all fields"
    }
    ?>
    nataka kila kwenye empty textbox niite hii function. How?
     
  13. Mtazamaji

    Mtazamaji JF-Expert Member

    #13
    Nov 18, 2011
    Joined: Feb 29, 2008
    Messages: 5,972
    Likes Received: 27
    Trophy Points: 0
    Sijui kama nimekupata . simpply unaita functiona kwa name .
    - Nadhanii hii itatoa ouput iliyoelekezwa kwenye function halisi. kama ni kupirnt jina itaprint jina. kwa mfano wako basi ujumbe utakaotokea ni echo "Please fill all fields"
     
  14. Cyclone

    Cyclone Member

    #14
    Nov 20, 2011
    Joined: Nov 19, 2011
    Messages: 71
    Likes Received: 0
    Trophy Points: 0
    Isset() checks if a variable has a value including ( Flase , 0 , or Empty string) , But not NULL.
    Returns TRUE if var exists; FALSE otherwise.
     
  15. Given Edward

    Given Edward Verified User

    #15
    Nov 20, 2011
    Joined: Jan 11, 2011
    Messages: 852
    Likes Received: 2
    Trophy Points: 35
    thanks.
     
  16. Given Edward

    Given Edward Verified User

    #16
    Nov 20, 2011
    Joined: Jan 11, 2011
    Messages: 852
    Likes Received: 2
    Trophy Points: 35
    Wakuu naomba mnisaidie:
    Natengeneza website ya PHP. Sasa, nataka kila nikirefresh sign up page, values nilizokuwa nimeingiza kabla ya ku refresh zifutike as soon as nikirefresh au reload the page. SIWEZI! Kila nikirefresh page inarudi na values nilizo input awali. Nisaidieni.......PHP is so killing me. Saa nyngine mpaka nachoka nakaa chini naanza kulia tu.
     
  17. HT

    HT JF-Expert Member

    #17
    Nov 20, 2011
    Joined: Jul 29, 2011
    Messages: 1,899
    Likes Received: 3
    Trophy Points: 0
    una refresh vipi? Unaweza kudefine variable isRefreshed na ukainitialize ktk session ikiwa false, uki refresh page unaiset kuwa true. Hizo content zinakuwa ndani ya if block,
    Code:
    if(!$_SESSION['isRefreshed']){
    //display the contents
    }
    ktk ku refresh unaiset true
    ukiweka code zako itakuwa rahisi kushauri
     
  18. Given Edward

    Given Edward Verified User

    #18
    Nov 20, 2011
    Joined: Jan 11, 2011
    Messages: 852
    Likes Received: 2
    Trophy Points: 35
    Thanks! BTW, unaweza ukanielezea how to set up sessions to user? The log in and out thing?
     
  19. Cyclone

    Cyclone Member

    #19
    Nov 20, 2011
    Joined: Nov 19, 2011
    Messages: 71
    Likes Received: 0
    Trophy Points: 0
    Anzisha Threads nyingine sikunzingine, pia swali hilijakaa vizuri, yaani unaamua tu kurefresh?? au baada ya submitbutton ukirudi kwenye hiyo page value zinabakia? au hauna uhakika kuwa unataka kufanya nini kwani siyo kila website ya PHP lazima iwe na hyo feature unayo itaka wewe elaborate nitakusaidia ndugu
     
  20. Given Edward

    Given Edward Verified User

    #20
    Nov 20, 2011
    Joined: Jan 11, 2011
    Messages: 852
    Likes Received: 2
    Trophy Points: 35
    ni kweli hata baada ya submit button values hazibadiliki(haziwi empty) na hata nikireload page baada ya kujaza textbox(bila ku submit) values hazibadiliki kuwa empty!
     
Loading...