Jump to content

joel24

Members
  • Posts

    760
  • Joined

  • Last visited

Posts posted by joel24

  1. commented next to modifications. starts at line 181

      function array_search_recursive($needle, $haystack, $path=array()){
        if (is_array($haystack)) //check that $haystack is an array
        {
            foreach($haystack as $id => $val){
              $path2 = $path;
              $path2[] = $id;       
              if(eregi($needle, $val)){
           return $path2;
              } else if(is_array($val)){
           if($ret = $this->array_search_recursive($needle, $val, $path2)){
             return $ret;
           }
              }
              return false;
            }        
        }
        else //if $haystack was not an array, return false.
        {
            return false;
        }
      }
    

  2. seems your server's timezone is set to somewhere around the u.s.a.

     

    do this to check

    echo date('e');
    exit();
    

     

    to set your timezone, use date_default_timezone_set()

    a list of timezones are here

     

    i.e.

    //using server's timezone
        echo date('e g:ia d/m/y', 1288393200) . '<br/>';
    
    //change to london
    date_default_timezone_set('Europe/London');
    //same command using london timezone.
        echo date("e d/m/y g:ia", 1288393200);
    
    exit();
    

  3. but what does $row_events['event_date'] echo by itself?

     

    change the line

    <? echo ($row_events['event_date']==""?$row_events['event_name']:date ("D, j F y",  $row_events['event_date'])) ; ?>

     

    to

    exit("<p>Value: ".$row_events['event_date']).'</p>';

     

    and post whatever value it prints

  4. In the database the date is in putted as 2010-10-30.

    ...

    date ("D, j F y",  $row_events['event_date']))

    the date function takes unix timestamps as its second operator, not a formatted date.

     

    if date("c") is returning the wrong date, then it would seem your server is set in a different timezone?

    http://www.php.net/manual/en/function.date-default-timezone-set.php

    or

    //timezone php. change australia/sydney to your timezone as listed on the PHP.net site
    putenv('TZ=Australia/Sydney');
    

     

  5. for the query function in the class I would have the input to be

    function Query($query, $where, $extra)
    {
    //rarrararara
    $sql = "$query $where $extra";
    //execute and return results
    }
    

     

    then to call it

    $do->Query("SELECT * FROM users", "WHERE id=1", "LIMIT 1");

  6. I don't want the while loop to run if num_rows is greater than 0, but it does and I'm sure it shouldn't be.

    then what's the point of having a loop?

     

    you're missing the () after num_rows

          if ($result->num_rows() > 0){
    

  7. you already have an update query in the code...?

    	
    $sql = "UPDATE settings
    SET site_name='$site_name', description='$description', keywords='$keywords', email='$site_email', name='$your_name'
    WHERE id='$id'"; 

     

     

    have a look at some mysql/php tutorials. You'll need to do a select query and then echo the results.

    start here

  8. Is selecting an option relevant to the grow of the website or it is?

    Yes, if you suspect the website will grow large then you'll want the payments automated, it will be quite time consuming to send out payments manually... and also opens up the risk of human error. Paypal API allows you to make payments automatically with your script

    The other option is to automatically generate invoices and send these to companies, however then you'll need to either monitor the incoming payments or once again set up your payments applications API to monitor incoming transactions etc etc.

    Someone else might be able to offer some greater insight, I'm a novice when it comes to automated payments

  9. you're not closing the <span> tag which sets the text to #FF0000

    
        if(count($errors)>0)
        {
            $errorText .= "<span style=\"color:#ff0000;\">";
            $errorText .= "De volgende fout(en) zijn opgetreden:<ul>\n";
            foreach($errors as $errorMsg)
            {
                $errorText .= "<li>$errorMsg</li>";
            }
            $errorText .= "</ul></span>" //was span style=\"color:#ff0000;\";
        }
    

  10. 1. the table displays the entire contents of the db before it is filtered through the search, I think this has something to do with the $num=mysql_numrows($result); expression, but I'm not sure how to fix it

    % is a wildcard in mysql queries, i.e. WHERE surname LIKE '%a%' will search for anything with a in it. Whilst WHERE surname LIKE 'a%' (like in your code) will search for anything starting with the letter a. In your code you have where SURNAME like '$_POST['name']%'... searching for anything that starts with the form posted surname.

     

    Try put this bit of code underneath the $query= line and then you'll be able to see all the values posted from the form and the mysql search string you are generating and then diagnose the problem.

    print_r($_POST);
    
    echo $query;
    
    exit();
    

     

    2. I'd like the last column of the table to be about twice as wide as the others, as it contains a lot of free text, would I have to set the length of each column in order to do this or is there a shorthand way?

    set the width of the last column using CSS and the others will still have automatic widths set. Shorthand way, you only need to set the width of one cell in the column and all others will follow suit.

  11. for the redirecting, use php's header() function and then exit(); when you want to redirect the user... in your case after the email script

    header('Location: http://www.yourDomain.com');
    exit();
    

     

    if you want an error or success message, you can redirect to a success or error page or send the error/success in the url with $_GET ... or you could also send it via a session but I wouldn't for a public page.

    And as for the $_GET error/success

     

    And now for the form validation, you can use isset() to ensure that a variable is set

    if (isset($_POST['email'])) {
    echo "it is set";
    }
    
    // exclamation point reverses condition
    if (!isset($_POST['email']))
    {
    echo "email is not set. Error";
    }
    

     

    that should get you started...

  12. increment is done with ++

    in a loop, $count++; would increment $count + 1 for each loop.

     

    function wp_rss( $url, $num_items = -1 ) {
        if ( $rss = fetch_rss( $url ) ) {
            echo '<div id="charts">';
    
            if ( $num_items !== -1 ) {
                $rss->items = array_slice( $rss->items, 0, $num_items );
            }
    //start count
    $i = 1;
            foreach ( (array) $rss->items as $item ) {
                printf(
                    '<div id="chart_lt">'.$i.'</div><div id="chart_rt">%3$s</div>',
                    esc_url( $item['link'] ),
                    esc_attr( strip_tags( $item['description'] ) ),
                    htmlentities( $item['title'] )
                );
    //increment
    $i++;
            }
    
            echo '</div>';
        } else {
            _e( 'An error has occurred, which probably means the feed is down. Try again later.' );
        }
    }
    

  13. sorry, mixed up a with y.

     

    $data = mysql_query("SELECT y.*, (SELECT COUNT(posts) FROM YBK_Ads a WHERE a.UID = y.UID) AS postCount FROM YBK_Login y") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { Print "<tr>"; Print "<td>".$info['postCount'] . " </td>";Print "<td>".$info['UID'] . " </td>";Print "<td>"."#"."</td>";Print "<td>".$info['ID'] . "</td> "; Print "<td>".$info['Allowed'] . "</td> ";Print "<td>".$info['pass'] . " </td>";Print "<td>".$info['HR'] . " </td>"; } ?>

     

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