Jump to content

gristoi

Members
  • Posts

    840
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by gristoi

  1. Could be a memory leak, basically a query, or piece of code logic,  you wrote could be causing an issue.  For example you caould have a query that incorectly joins two tables and instead of searching 100 records it search 1,000,000 records. The best way to get started at tracking the issue down is to look at using your slow query log ( google it). Secondly look at how to use the mysql EXPLAIN function. this will tell you exactly how many rows of data you query is traversing to get your results.

     

    Also look into indexing your tables.

  2. change to:

    <?php
    $query_user="SELECT username FROM $tbl_name WHERE mail='$email'";
    $query=mysql_query($query_user);
    $row = mysql_fetch_array($query);
    $user = $row['username'];
    ?>
    

    and:

    $header="From: <your email address here>\r\n";
    

  3. 1. The '->' symbol is one of the two object operators. It is used for accessing methods and variables from within the object.

     

    2. Frameworks allow you to code within a structured manner. Allowing best practices to be shared between developers. basically If i came into your office and picked up a piece of your work i would have to pick it apart to figure out what you were trying to acomplice. But if you were using a framework ( cake, zend etc) then i would know how the code was structured etc.

  4. I would say this is the worst way you could possibly do this. Allowing users to add an execute a string is the equivelent of handing them the key to the server. You would have to ensure all privelages for the connection were correct to start. What would stop them from saving a query string such as

    DROP DATABASE .......

    or

    GRANT PRIVILAGES .........

    You would be leaving your server wide open to attack. if you want to give them the ability to run queries then you need to take the control of building the quires out of their hands. One way of doing this is to build a query constructor that gives them that names of the fields they can search and the ability to add parameters that you control. Just an idea

  5. Whay have you got your output above and outside of your query result??????????????????

    it should look like this:

     

    $status_result2 = array('PENDING','ACCEPTED','DECLINED');
             
             
          while($row = mysql_fetch_assoc($query))
          {
    $status_result = $row['status'];
    echo $status_result2[$status_result];
             
                     }
    

  6. ok, this is going to be a bit difficult without knowing what the ajax is doing: put your code back as it was. Which browser are you using? If its firefox or chrome then install firebug as a plugin and google "debugging ajax with firebug". this basically lets you see the ajax request being sent and what response you actually recieve. Along with any javascript errors that you may recieve

  7. try changing your javascript to

    
    $(document).ready(function(){
        $(".error").hide();
        $(".send").click(function(){
            var name = $("input#name").val();
            if(name == ""){
                $("label#name_error").show();
                $("input#name").focus();
            }
            var email = $("input#email").val();
            if(email == ""){
                $("label#email_error").show();
                $("input#email").focus();
            }
            var subject = $("input#subject").val();
            if(subject == ""){
                $("label#subject_error").show();
                $("input#subject").focus();
            }
            var textarea = $("textarea#textarea").val();
            if(textarea == ""){
                $("label#textarea_error").show();
                $("input#textarea").focus();
            }
            
            var dataString = name + email + subject + textarea;
        
            $.ajax({
                type: "POST",
                data: dataString,
                url: "./include/process_contact.php",
                success: function(response){
                    alert(response);
                }else{
                    alert("there was an issue with the ajax request")
                }
            });
        });
    });

     

    and tell me what happens

  8. im sorry, but you will be very hard pushed to get someone to go through over 500 lines of code and fix your errors. I advise you hit google and look at how headers actually work. As i advised, you need to ensure that if you are using a header and calling headers that the two fundemantal rules are - No Whitespace before or after the php tags and nothing can echo out above the header request.

     

    good luck

  9. there are a few ways to acomplish this. first is use an array:

    $status = array('PENDING','ACCEPTED','DECLINED');
    
    echo  '<p>'.$status[$status_result].'</p>;
    

     

    another ( and only if you know the output is a limited amount ) is a switch:

    $status = array('PENDING','ACCEPTED','DECLINED');
    switch($status_result)
    {
    case 0: $result = 'PENDING';
                 break;
    case 1:  $result ='ACCEPTED';
                 break;
    case 2: $result = 'DECLINED';
                 break;
    }
    echo  '<p>'.$result .'</p>;
    

    personally I would use an array to acomplish this, as you may in the future need to do more dynamic actions with your arrays.

×
×
  • 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.