Jump to content

harristweed

Members
  • Posts

    346
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by harristweed

  1. This is a function I use for adding watermarks

    function cr_jpg ($image_name){
        ini_set("memory_limit","512M");
        // ceate thumbnail with copyright
    global $destination_path, $width, $where_temp, $where_temp2,$new_name; 
    $dest_image="$new_name";
    $image = imagecreatefromjpeg($where_temp2.$image_name);
    $icon = ImageCreateFromPNG("watermark.png");
    $width = ImageSX($icon);
    $height = ImageSY($icon);
    ImageCopyResized($image,$icon,0,0,0,0,$width,$height,$width,$height);
    imagejpeg($image,$destination_path.$dest_image); 
    ini_restore("memory_limit"); 
    }

     

    As you see some parameters are held in variables that are set outside of the function

     

    Hope this helps

  2. best I can do:

    <?php
    $array=array(
    "one item",
    "two items",
    "two items",
    "three items",
    "three items",
    "three items",
    "end"
    );
    $newarray=(array_count_values($array));
    foreach ($newarray as $key => $value) {
    if($value<3)unset($newarray[$key]);
    }
    print_r ($newarray);
    
    // just reread your post
    $try_again=array();
    foreach ($newarray as $key => $value) {
        for($i=0;$i<$value;$i++){
            $try_again[]=$key;
        }
    }
        print_r ($try_again);
    ?>
    

  3. <?php
    $array=array(
    "one item",
    "two items",
    "two items",
    "three items",
    "three items",
    "three items",
    "end"
    );
    $newarray=(array_count_values($array));
    foreach ($newarray as $key => $value) {
    if($value<3)unset($newarray[$key]);
    }
    print_r ($newarray);
    $flip=array_flip($newarray);
    print_r ($flip);
    ?>

  4. without seeing the errors...

    change:

     

    <form action="<?=$_SERVER['PHP_SELF']; ?>" method="post" accept-charset="utf-8">

    to

    <form action="<?php=$_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" accept-charset="utf-8">

     

    and change the other short PHP tags to full tags "<?" to "<?php"

  5. Hi Cags

     

    I know that it is not strictly required to pass an identifier but I have had problems with it in the past when not passing one and now always include it. Habit I guess. I think you could be right about the quotes.

  6. change form to method = "get"

    Change

    foreach($_POST as $name => $value)
       {
           echo "$name = $value<br />\n";
    
       }

    to

    foreach($_GET as $name => $value)
       {
           echo "$name = $value<br />\n";
    
       }

    If that displays the values the problem could well be with your host not posting correctly

  7. Something like this?

    date_default_timezone_set('America/Los_Angeles');// or where you are
    
    function date_diff($start, $end)
    {
            $sdate = strtotime($start);
            $edate = strtotime($end);
            $time = $edate - $sdate;
            if($time>=86400) {
                    $days = ($edate - $sdate) / 86400;
            }
            return $days;
    }
    // example dates
      $sd="2010/3/2";
      $ed="2010/3/9";
      
      $diff= date_diff($sd, $ed);
      // this is the total days therefore total pages
      echo"days=$diff";
      // create the pages as you would with normal pagination
      
      // get the date for the page/day
      // e.g. page 3
      $page_number=3;
    $starting_day=strtotime($sd);
    $calculated_day = $starting_day+(60*60*24*$page_number);
    $date_for_this_day=date("Y-m-d",$calculated_day);
    // the mysql_query would be something like
    $result = mysql_query("SELECT * FROM meals WHERE menudate = '$date_for_this_day''");
    

  8. mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
    mysql_select_db($dbname) or die(mysql_error());

    should be

        $link_id = mysql_connect("$dbhost","$dbuser","$dbpass")or die("Could not connect: ".mysql_error());
         mysql_select_db("$dbname", $link_id) or die(mysql_error());

    then:

     $sql=“SELECT * FROM user WHERE username=’$username’ and password=’$password’ ”;
    $result=mysql_query($sql, $link_id);
    

  9. I think the way you are attempting to solve this is wrong. Each page needs to display a menu for a specific day, therefore have a mysql query for each day that finds the menu for that specific day.

     

    I don't know where you are getting the start day and end day from but it would not be difficult to count the days between these two dates and put the dates in to an array.

     

    The number of days will equal the number of pages, so a page for each day with the relevant query.....

  10. change:

    $result1 = mysql_query("SELECT name, birthday FROM address WHERE MONTH(birthday) = MOD(MONTH(CURDATE()), 12)");  

    to:

    $result1 = mysql_query("SELECT name, DATE_FORMAT(birthday, '%d-%m') as birthday FROM address WHERE MONTH(birthday) = MOD(MONTH(CURDATE()), 12)");  

    delete:

    $sql = "SELECT *, DATE_FORMAT(birthday, '%d/%m/%Y')"; 

  11. possibly something like:

     

    php5 -f/home/sites/"your domain name"/public_html/_private/mining_reset.php

     

    are there any help pages on your hosting?

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