harristweed
Members-
Posts
346 -
Joined
-
Last visited
-
Days Won
1
Everything posted by harristweed
-
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
-
There is a strong possibility that 'like' is a reserved word in MYSQL try changing the field name.
-
Ok, Arrays are starting to make my head spin now...
harristweed replied to soma56's topic in PHP Coding Help
http://php.net/manual/en/control-structures.continue.php -
http://tinymce.moxiecode.com/download.php
-
keep only repeated items in an array
harristweed replied to gdfhghjdfghgfhf's topic in PHP Coding Help
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); ?> -
keep only repeated items in an array
harristweed replied to gdfhghjdfghgfhf's topic in PHP Coding Help
Wont work, I'll think about MKII -
keep only repeated items in an array
harristweed replied to gdfhghjdfghgfhf's topic in PHP Coding Help
<?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); ?> -
two submit buttons in one form help please
harristweed replied to super_sonic_ace's topic in PHP Coding Help
make the button a link and not a button! -
Been looking at this for far too long now...
harristweed replied to Kryptix's topic in PHP Coding Help
Sometimes the 'slanted apostrophe' will cause problems, try replacing with apostrophes from the keyboard -
where is the function GetSQLValueString defined?
-
does $_POST['navn' contain any apostrophes?
-
this could help http://phpexcel.codeplex.com/
-
i mean <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" accept-charset="utf-8"> Sorry, it's a bit early for me yet!
-
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"
-
I have found that omitting the closing php tag on the include file sometimes cures this problem
-
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.
-
I think you need to look at mysql for date if from database rather than php http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html
-
not receiving form values when submit it
harristweed replied to delickate's topic in PHP Coding Help
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 -
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''");
-
not receiving form values when submit it
harristweed replied to delickate's topic in PHP Coding Help
try this: foreach($_POST as $name => $value) { echo "$name = $value<br />\n"; } in the receiving page and see what is displayed (with method = "post" ) -
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);
-
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.....
-
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')";
-
How do you create a credit card processing system?
harristweed replied to TeddyKiller's topic in PHP Coding Help
I don't think this is limited to the US: https://developer.paypal.com/devscr?cmd=_signup-run -
possibly something like: php5 -f/home/sites/"your domain name"/public_html/_private/mining_reset.php are there any help pages on your hosting?