Jump to content

Pioden

Members
  • Posts

    72
  • Joined

  • Last visited

    Never

Everything posted by Pioden

  1. Something like this? $sql = "SELECT email_addr FROM merc_users WHERE client = $client"; $res = @mysql_query($sql, $connection) or die("Couldn't get addresses." . $php_errormsg . mysql_error()); $headers = "From: $newsletter_heading.$newsletter_email\n"; while ($row = mysql_fetch_array($res)) { $email_addr = $row['email_addr']; @mail("$email_addr", $subject, stripslashes($newsletter), $headers); echo "<b>".do_lang("sent_to").": </b> $email_addr<br>"; } Sends one copy of the newsletter to everyone on the list. Simple enough. Limiting the usage is another matter really. I can't see anyone wanting to send a newsletter to only a proportion of their users so the game will be limiting them to, say, one newsletter a week. Is that what you had in mind or did I misunderstand?
  2. Seems to me you could code in some CSS to keep everything limited to a certain size. Try something like this: Add a class to your div containing the content <div align="center" class="content"> Welcome <br> Welcome to Southern Heaven Florida! ... and add something like this in the head tags of your HTML <style type="text/css"> <!-- .content { margin:auto; font-family: Verdana, Arial, Helvetica, sans-serif; font-size:12px; width:500px; text-align:justify; } --> </style> BTW your source code has this at the top - you should delete it. <html> <head> <link href="../style.css" rel="stylesheet" /> </head> <body> </body> </html>
  3. Are the addresses held in a database? I wrote something like this a few years ago - I still have the code around here somewhere!! Huw
  4. Kev. Could you tell us more about what your doing? It sounds awfully like a spam distributor ...
  5. Hi Kev I think we need more detail. What do you mean 'value of a count'? Can you give us an example? Cheers Huw
  6. Hi all, I'm trying to mod imagemagick_class so that it automatically generates a thumbnail of any image I upload to the server. I've hacked around some of the code from the class but without success. I wonder if anyone has time to help me with this as I'm sure this feature would be helpful for a lot of people. These are the mods I've made so far ... I added $tndir for the thumbnail directory class ImageMagick { var $targetdir = '$img_path'; var $tndir = '$img_path.tn/'; var $imagemagickdir = '$pathtomagick'; var $temp_dir = '/tmp'; // httpd must be able to write there var $file_history = array(); var $temp_file = ''; var $jpg_quality = '55'; var $count = 0; var $image_data = array(); var $error = ''; var $verbose = FALSE; and I 'created' this function function ResizeTN(120, 90, $how='fit') { $method = $how=='keep_aspect'?'>'$how=='fit'?'!':''); $command = "{$this->imagemagickdir}/convert -geometry '{$x_size}x{$y_size}{$method}' '{$this->temp_dir}/tmp{$this->count}_{$this->temp_file}' '{$this->temp_dir}/tmp".++$this->count."_{$this->temp_file}'"; exec($command, $returnarray, $returnvalue); } else { $this->file_history[] = $this->temp_dir.'/tmp'.$this->count.'_'.$this->temp_file; } } $prefix='tn'; if(!@copy($this->temp_dir.'/tmp'.$this->count.'_'.$this->temp_file, $this->tndir.'/'.$prefix.$this->temp_file)) { $this->error .= "ImageMagick: Couldn't save to {$this->targetdir}/'{$prefix}{$this->temp_file}\n"; } else { } return $prefix.$this->temp_file; } Any help getting this to work would be great. I've attached a copy of the full class. TIA Huw [attachment deleted by admin]
  7. Yuws. My suggestion will make it go horizontal - and in groups of three.
  8. Ach. Of course. That's why it tested fine but balked during then next stage. Thanks a million.
  9. Nope. I just rechecked the script and no variables are declared twice. The important one here is $sub_page_uid and that only occurs in the code I posted. Strange.
  10. Sorry to ask such a vague question but this has me stumped and I don't see where its going wrong! I tested sub-versions of this code and everything worked fine BUT once I but it into the main code file where it lives it doesn't work quite right. The bit which doesn't work is commented "Check for and remove any subsubpages" - it simply doesn't do anything. In theory it should loop through the $sub_page_uid results and set some db entries to NULL . I can't see any typo's and the code executes but it simply doesn't do anything! Waaaaaaah. Where did I do wrong? TIA // Change order for Principal page if ($principal == "y") { // Find page UID's for sub pages so we can remove subsubpages $sql = "SELECT page_uid FROM navigation WHERE subpageof = '$sent_page_uid'"; $result = @mysql_query($sql,$connection) or die("Couldn't execute first query.". $php_errormsg . mysql_error()); while ($row = mysql_fetch_array($result)) { $sub_page_uid = $row['page_uid']; if (!empty($sub_page_uid)) { // Check for and remove any subsubpages $sql = "UPDATE navigation SET principal=NULL,pageorder=NULL,subpageof=NULL,subsubpageof=NULL WHERE subsubpageof = '$sub_page_uid'"; $result = @mysql_query($sql,$connection) or die("Couldn't execute third query.". $php_errormsg . mysql_error()); } } // Remove subpages $sql = "UPDATE navigation SET principal=NULL,pageorder=NULL,subpageof=NULL,subsubpageof=NULL WHERE subpageof = '$sent_page_uid'"; $result = @mysql_query($sql,$connection) or die("Couldn't execute third query.". $php_errormsg . mysql_error()); } // End of principal page change
  11. Hi, So you want a table with three columns? OK if I understood properly it works like this. You need to code a little counter for your output. When $count > 3 it resets and starts a new row. <table > <tr> <td>1</td> <td>2</td> <td>3</td> </tr> </table> Start you loop with <tr> Put the results in <td>'s When the result counter gets to 4 it echo's </tr> and starts the process again. That's the way it works anyway. I coded this once but I don't remember in which file the code lives! The only 'hard' bit if adding the extra empty <td>'s if you have an inconvenient number of results e.g. if you have 10 results you'll need to add two <td> sets to finish the table in a tidy way. HTH Huw
  12. Thanks PFMaBiSmAd (can I call you PFMaBiSmAd?) - that sounds like what's going wrong. I've never used place holder tags - can you give me an example of usage?
  13. I'm really not sure how to describe this problem - hence the rather unhelpful title! OK in order to make life easier for designers etc. I wanted all my HTML etc. available in one file - which includes some embedded PHP. In the presentation file i have the line $main_link_display = "<a href=\"index.php?p=$page_uid\">$title</a><br />$subgroup"; in the other file (linked by an 'include') where the code is required I have $navigation .= $main_link_display; As you might guess I doesn't work. Instead of the expected HTML and PHP output I get <a href="index.php?p="></a><br /> What am I doing wrong? I have my head on the wrong way round today :-(
  14. Sorry about the mistake in the code - I'd just got out of bed !! I've tried - and I really don't get on with it. I taught myself to code from books and the 'longhand' way appealed to me more. I also like the way it keeps the PHP and XHTML seperate - PHP at the top and display code after. Horses for courses I guess. BTW is it working now?
  15. Something like this? $sql = "SELECT `name`,'url' FROM `videos` WHERE `catagory` = CONVERT(_utf8 'Overview' USING latin1) COLLATE latin1_swedish_ci ORDER BY `order` ASC"; $result = @mysql_query($sql,$connection) or die("Couldn't execute query.". $php_errormsg . mysql_error()); while ($row = mysql_fetch_array($result)) { $name = $row['name']; $url = $row['url']; $display .= "<a href=\"$url\">$name</a><br />"; echo "$display"; } As you can see I write my code in a more 'longhand' way than most - I find it helps code maintenance. HTH Huw
  16. Got the answer from a friend. $sql = "UPDATE navigation SET pageorder = pageorder +1 WHERE pageorder >='$newpageorder' AND page_uid !='$sent_page_uid' "; Works nice now.
  17. First off you need to change the name of 'order'. Its a reserved word for MySQL and can lead to all sorts of chaos!!! H
  18. I don't think you can have a query within the result of another query ... Not to the best of my knowledge anyway. If someone says different I'll be very interested!! Huw
  19. Thanks for that. Not quite getting it though :-( I wrote this - which looks right to me but throws a syntax error $sql = "UPDATE navigation SET (pageorder +1) WHERE pageorder >='$newpageorder' AND page_uid !='$sent_page_uid' "; Any ideas where I went wrong? It looks right to me!! ???
  20. I want to increment some values in a MySQL (5) db. The basic idea is where values in column X are greater than $somenumber the values in column X will be incremented by 1 ... For example if $somenumber = 5 all the values in column X which are greater than 5 have one added to them. I'm pretty certain I can do this with a series of queries and PHP processing but that feels like a horribly clunky way of doing it. Is there an SQL query/command which will help? I was thinking along the lines of: SQL = "UPDATE table SET column_x +1 WHERE column_x >5" ; Is this possible? My MySQL bible doesn't say much about this (or I'm looking in the wrong place!). TIA Huw
  21. Ach. So simple in the end. Many thanks metrostars
  22. Hi, I can't get my brain around renaming files in a file upload situation ??? My upload code is working nicely but I need to add some random numbers to the uploaded file name in order to stop over writing. I've tried a bunch of things but without success. Can someone point me in the right direction? TIA $uploadfile = $file_path . basename($_FILES['file_field']['name']); if (move_uploaded_file($_FILES['file_field']['tmp_name'], $uploadfile)) { echo "Success!.\n"; } else { echo "I'm sorry but the file was not uploaded.!\n". $php_errormsg; }
×
×
  • 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.