Jump to content

jaikar

Members
  • Posts

    136
  • Joined

  • Last visited

    Never

Posts posted by jaikar

  1. you may have to use javascript to make it easy

     

    <form action="somepage.html" name="form1">

    <select onchange="changeAction(this)">

    <option>test 1</option>

    <option>test2</option>

    </select>

    </form>

     

    <Script>

    function changeAction(obj) {

    if(obj.value == 'test1') {

    document.form1.action = "http://www.test1.com";

    } else if(obj.value == 'test2") {

    document.form1.action = "http://www.test2.com";

    }

    }

    </script>

     

     

    Second option is ..

    doing an auto submit, but even for that you will have to use javascript, compared to that, the above option is easy i guess

     

    or you may have to use CURL, but not sure if you want to go to that level.

  2. great man!.. i love the chunks idea! .. i think that will really help... really thanks for your time!..

     

    also, does explode function actually loops in the background or it does it in a different way ? which is better, looping through the words manually or just use the explode option? OR both are same?

     

  3. hi there,

     

    i have a project to submit in college, its like user uploads a sentence of letters in a text file, it can be 5000 words to one million, now the code need to process it and display how many unique words, how many times the word have repeated itself, and couple of more data.. i am confused which way i should do this, should i use an explode on so many words? or loop through each words and store them in an array, but the array may get too bulky? will it slow down the server? or terminate script etc?.. please show some light on this..

     

    thankyou very much in advance!

     

  4. thanks for the reply!

    well, error_reporting is default, i did not changed it. also it say its a fatal_error, which seems an important error?

     

    i did not passed any var as the second parameter, but i just tested by passing "stdClass" as a second param, but it still returns an error, if possible can you test on your machine and change the query according your database if its handy and let me know what happens, so i can know if any other problem on my server side?..

     

    thankyou!

  5. hi there,

     

    i am fairly new to OOPs in php, i get an error when i declare the argument type (as object) in a function and pass the same type (object).

     

     

    class eBlast {
           public static function getEmail(object $result) {
               return $result->email;
           }
    }
    
    $r = mysql_fetch_object($query);
    eBlast::getEmail($r);
    
    echo gettype($r); // outputs: object
    
    

     

    error is :

     

    Catchable fatal error: Argument 1 passed to eBlast::getEmail() must be an instance of object, instance of stdClass given, called in C:\wamp\www\integra\client\pl_eblast\admin\send_emails.php on line 145 and defined in C:\wamp\www\integra\client\pl_eblast\app\app.eBlast.php on line 8

     

    if i remove the type declaration in the function it works, but just would like to know why it shows error when pass the same type, also isnt mysql_fetch_object is the instance of stdclass?

     

    thanks in advance!

     

     

  6. hi there,

     

    this is a general question where i am confused over long time..

     

    what is the used of passing big encrypted strings in the url? most of the time i see in big sites like google / yahoo. and what are the uses of this in real time .. or they are just  made big to confuse hackers?. any explanation would be highly helpful!. example as below

     

    http://yahoo.com/_ylt=AsXHbMLeE2zV.1Tq082xTdiuitIF/SIG=11licq9d2/EXP=1283427670/**http%3A//mail.yahoo.com/%3F.intl=en
    
    http://click.email.microsoftemail.com?qs=06f2de8ca524e4650483090ed07957e8da3dbc0db662e7f97fa1b5d384b45a28800d5407dd3daa63

  7. Hello there,

     

    i am using smarty for my project, and i have a registration form that uses smarty, the entire form is generated from a php framework. initially there will not be errors, if there is error in input on submit, it will display the errors to the user..

     

    My question is, will smarty compile the file and create php files on submission each time ? what will happen if the file is accessed by many users and they submit ?

     

    to be more clear

     

    i was thinking, smarty will compile the tpl files and make it to .php and store in templates_c, so when anyone request the page, it will just display from templates_c... but since the page content changes on submitting will it compile the page again? and what if many users use the page, smarty will go one compile it??..

     

    i am too confused ... help is highly appreciated !!

    thankyou !!

     

     

  8.  

    Dan, YOU ARE THE MANNNNNNNNNNNN !!.. i almost thought there is no function for this task... just tested and works perfect !!! ... i am speechless now ... never thought array_intersect is used for this.. it just says "Computes the intersection of arrays". i was not able to understand that. i am really surpriced for your knowledge in php !! ...

     

    thankyou so much

  9. Crayon, ... Awesome !.. and a fantastic explanation .. .. respect !!.... thankyou very much !!. additinally, you also explained the value by referance concept, which would be next question for i did not know why & was used !... actualy, i studied this long back but forgot and never used this in anycodes. . thankyou !..

     

    Dan, !.. happy to see you again !! ... thankyou for the doc link .. it really expains a lot, i did not got this link in google, but after seing the link, i noticed how to pull up help for arguments and callbacks.. php doc is awesome as always!!

     

    i have one more clarification,  i have a situation where i have to compare values of 2 arrays.. like

     

    $arr1 = array('one', 'two');

     

    $arr2 = array('one', 'three', 'four');

     

    comparing like, if $arr2 have atlest one value in arr1, then some code will execute. question is .. is it possble to do this without using a loop ? is there a funciton for this in php ?

     

    thankyou !

     

     

  10. hi there,

     

    i am trying to use a method in array_walk.. something like this

     

    class test {

      function one() {

          $t = array('one', 'two');

          array_walk($t, '$this0>converttolower');

      }

     

      function convertolower($value, $key) {

          $t[$key] = strtolower($value);

      }

    }

     

    the above is not working, how to make something like this work.

     

    thankyou.

  11. thanks guys !!..

     

    thorpe is absolutly right... not only mixing presentation with logic, for me mixing is a lot of confusion because, when i use html in php code, i have to decide the css ID, class, etc.. so i jump into css, html... that totally destroy my mood for php coding. moreover.. also i totaly HATE seeing the html code mixed with php !!..

     

    dzelenika, you are right that development time is important, and that is my first concern for this question. but also, i am concerned that performance dont go too worse with double looping, i just wanted to know what is the extent of the loss ... whether it is minimal or more ... or do i need to think for any other way... but as you said, caching may help, but only if i use template scripts.. what if i do not use any third party scripts like smarty ?...

     

    patrickmvi, mostly it will be large sites like social networking, shopping carts, video sites like youtube.... so changing design may or may not happen, but the major concern is ... as i said before, on reducing the development time, reducing CONFUSIONS!, and also not reducing that much in performance ....

     

    Daniel, THANKS MAN !!.. this is something i never ever thought i will get to know !! ... i will look deep into this!! .... also the idea of dzelenika, using XSLT, i never knew XSLT is used for that specific purpose !!....

     

    SO... anyhow.. i wanted to KNOW ONE THING FINALLY... is that... IF I use DOUBLE LOOPING for sites like social networking.. where i need to pull lot data from database and with 1000 visits per day, do i need to worry on the performance ?... is the performance drop is worse compared to the performance in avoiding double loop... ?

     

  12. hello there,

     

    till now i was using only the classic way of coding. that is mixing the php code with html, now i am trying to separate the php code and html.

     

    in a situation, i wanted to pull records from database, and i usually use while($result = mysql_fetch_assoc) then proceed with html. if i separate the php code, and put the "while" in a function that loops the values of the database and returns the array of database values to the html, and i again need to make a second loop using foreach to place the values in the html.

     

    so in the later method i am looping twice. is this way recommended ? how far this double looping affect the performance ? which method is the smartest one and the best method ?

     

    thankyou!!

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.