Jump to content

dcro2

Members
  • Posts

    489
  • Joined

  • Last visited

    Never

Posts posted by dcro2

  1. There's probably a more intuitive way but whatever.

    foreach($test as $name => $arr) {
    $tmp = array_shift($arr); //get first element of $test[$name], which is always $test[$name]['0'] in your example
    sort($tmp);
    $result[$name] = $tmp[0];
    }
    
    print_r($result);

    Array
    (
        [abcd] => 10
        [efgh] => 3
    )
    

  2. Have you tried running the query directly on the server, with phpmyadmin for example?

    SELECT * FROM usr_test WHERE usr = 'username' AND pass = MD5('password')

     

    Have you done any debugging to find out if the username and password are what you expect at the end?

     

    Have you checked for any mysql_errors if the query fails in your PHP script?

  3. I just realized what's going on with the two selects on that page haha. Let's say we were going to insert these values into the database. You would store all the values in variables and then insert it into the query which inserts a row in the database. The fields in your first code don't match up here so I'm making this up.

     

    This goes in submit_add_tenant.php:

    $forename = mysql_real_escape_string($_POST['tenForename']);
    $surname = mysql_real_escape_string($_POST['tenSurname']);
    $tenSuitablePostcodes = mysql_real_escape_string(implode(',', $_POST['tenSuitablePostcodes']));
    
    $sql = "INSERT INTO table (`tenForename`, `tenSurname`, `tenSuitablePostcodes`) VALUES ('$forename', '$surname', '$tenSuitablePostcodes')";
    $res = mysql_query($sql);

    Your second select would need to be renamed into

    <select id="box2View" multiple="multiple" size="3" name="tenSuitablePostcodes[]">

  4. If you name your checkboxes "tenCode[]" like an array, then $_POST['tenCode'] will also be an array containing the values of the checkboxes that were selected.

    For example,

    <input type="checkbox" name="tenCode[]" value="pare1">
    <input type="checkbox" name="tenCode[]" value="pare2">
    <input type="checkbox" name="tenCode[]" value="pare3">
    <input type="checkbox" name="tenCode[]" value="pare4">
    <input type="checkbox" name="tenCode[]" value="pare5">

    results in

    $_POST = Array
    (
        [tenCode] => Array
            (
                [0] => pare1
                [1] => pare3
            )
    )

     

    How you choose to store that is up to you. You could for example store them separated by a comma or semicolon using implode.

    $tenCode = implode(';', $_POST['tenCode']);

  5. Works for me.

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; InfoPath.3; .NET4.0E; .NET CLR 1.1.4322)");
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_PROXY, "202.182.124.12:3128");
    // curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
    curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txtt");
    
    curl_setopt($ch, CURLOPT_URL, "https://www.google.com");  
    $page = curl_exec($ch);
    echo $page;
    echo curl_error($ch);

    What error do you get now?

  6. Andy-H, go make an account at powrhost.com and see for yourself. They have port 993 blocked. I ran this and got a timeout:

    <?php
    
    error_reporting(-1);
    fsockopen("imap.gmail.com", 993, $errorno, $errstr);
    echo "$errorno $errstr";
    
    ?>

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