Jump to content

benhodgson

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

About benhodgson

  • Birthday 02/09/1987

Contact Methods

  • Website URL
    http://ben.someaddress.net

Profile Information

  • Gender
    Not Telling
  • Location
    Leicester, UK

benhodgson's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Brilliant, works perfectly. Really appreciated. Cheers for all your help.
  2. Almost there, only problem now is that I'm getting two backslashes every time instead of one.
  3. Doesn't seem to work, I just get linebreaks with that. The problem is that using a str_replace with "\\" as the replacement just always seems to create a backslash and then inserts a linebreak. [quote]\ [/quote] As I say, stories just need to read like: [quote] TITLE=This CONTENT=And if ever there is a linebreak\Just like that one\\And that one. A backslash will magically appear instead of an actual linebreak. [/quote]
  4. The information comes in through a form on another page using POST. All I really need now is some way of detecting a linebreak in the content input from the form and inserting a backslash. So that: [quote]Hello Everybody My name is Ben[/quote] ...becomes... [quote]Hello\Everybody\\My name is Ben[/quote] The script to transfer the formatted script into a .spt file is... [code]$filename = 'script.spt'; $somecontent = $script; if (is_writable($filename)) { if (!$handle = fopen ($filename, 'w')) { echo "The system cannot open the required file ($filename)"; exit; } if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; }   echo "Update successful! News story submitted.";   fclose($handle); } else { echo "Error! the file ($filename) is not writable"; }[/code]
  5. I'm trying to write a PHP script that will generate an ASCII file readable by a piece of software designed to display scripts for radio newsreading. The script file should look like this: http://www.demonfm.co.uk/news/good.spt Unfortunately the best I can get is this: http://www.demonfm.co.uk/news/script.spt I need it so that there is just a slash, not a slash and then a new line, as the software doesn't understand the new line and so anything after a slash at the moment doesn't show up. Also, if you save both of those pages as .spt files and then open them in notepad, you'll notice on comparison that there are some further issues in the php generated file. Does anyone have any idea how I can solve these issues? Any help is greatly appreciated. Thanks
  6. I have the following piece of code, designed for the print-out of ID cards for a member system. [code] $query="SELECT * FROM memb WHERE id_printed='0'"; $result=mysql_query($query) or die("<strong>Error ".mysql_errno().":</strong><br> ".mysql_error()."<br><br>\nQuery: $query"); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $id=mysql_result($result,$i,"id"); $first=mysql_result($result,$i,"first_name"); $last=mysql_result($result,$i,"surname"); $exec_pos=mysql_result($result,$i,"exec_pos"); $day=mysql_result($result,$i,"joined_day"); $month=mysql_result($result,$i,"joined_month"); $year=mysql_result($result,$i,"joined_year"); $image=mysql_result($result,$i,"image"); if(empty($image)){ $image = "http://www.demonfm.co.uk/images/members/membphotos/nophoto.gif"; } if (!($exec_pos=='') && !($exec_pos=='None') && !($exec_pos=='none')) { echo " <div class=\"idmem\"> <div class=\"extimg\"> <img src=\"name.png\" alt=\"name\" /> </div> <div class=\"fbg\"> <img src=\"fbg.png\" alt=\"fieldbg\" /> </div> <div class=\"fname\"> <span class=\"text\">$first $last</span> </div> <div class=\"extimg\"> <img src=\"valid.png\" alt=\"validuntil\" /> </div> <div class=\"fbg\"> <img src=\"fbg.png\" alt=\"fieldbg\" /> </div> <div class=\"fjoin\"> <span class=\"text\">$day $month $year</span> </div> <div class=\"extimg\"> <img src=\"exec.png\" alt=\"execpos\" /> </div> <div class=\"fbg\"> <img src=\"fbg.png\" alt=\"fieldbg\" /> </div> <div class=\"fjoin\"> <span class=\"text\">$exec_pos</span> </div> <div class=\"exfid\"> <span class=\"id\">$id</span> </div> <div class=\"exfpic\"> <img src=\"$image\" width=\"99\" height=\"128\" alt=\"memberpic\" /><br /> <img class=\"logo\" src=\"logo.png\" alt=\"demonlogo\" /> </div> </div> "; } else { echo " <div class=\"idmem\"> <div class=\"timg\"> <img src=\"name.png\" alt=\"name\" /> </div> <div class=\"fbg\"> <img src=\"fbg.png\" alt=\"fieldbg\" /> </div> <div class=\"fname\"> <span class=\"text\">$first $last</span> </div> <div class=\"timg\"> <img src=\"valid.png\" alt=\"validuntil\" /> </div> <div class=\"fbg\"> <img src=\"fbg.png\" alt=\"fieldbg\" /> </div> <div class=\"fjoin\"> <span class=\"text\">$day $month $year</span> </div> <div class=\"fid\"> <span class=\"id\">$id</span> </div> <div class=\"fpic\"> <img src=\"$image\" width=\"99\" height=\"128\" alt=\"memberpic\" /><br /> <img class=\"logo\" src=\"logo.png\" alt=\"demonlogo\" /> </div> </div> "; } $i++; } [/code] 8 cards will fit onto a single A4 sheet of paper. The problem is that the next two cards then span across two sheets, cutting them in half. Is there any way to insert a blank space (Probably as an image or empty DIV) every 8 records to push the next two cards down to the next page and, based on the code above, what would be the easiest way to do this? Thanks in advance.
  7. Excellent stuff! Got it working now, cheers.
  8. Had a quick search but couldn't see anything on this, and all the results Google returns are pretty unclear. I'm building a news system with PHP/mySQL, one of the features is to associate an image with the story. It's literally just a textbox where you input the URL to the image, but it also has a link next to it which goes to a repository of readily prepared stock images in a popup window, to save time. What I need to happen is for the user to click a picture in the popup, and for the URL of that picture to be passed back to the initial page and inserted into the URL textbox. Any help or advice on how I can do this is greatly appreciated. Thanks in advance. :)
  9. I think I get what you mean. You want PHP to read the image size, and then pass it to the Javascript popup code so that the popup will be the right size?
  10. Only needed the actual part to go in the IF section, but fantastic, have it working now. Thanks for your help :)
  11. I'm currently writing a schedule system for a radio station. Basically the schedule page will look a little like this [a href=\"http://www.zodiacwebdesign.co.uk/sites/demonfm/\" target=\"_blank\"]http://www.zodiacwebdesign.co.uk/sites/demonfm/[/a] Now what I want to do is have the system check the current time using $nowtime = date("Hi"); and $nowday = date("D"); and compare it with the entries in the database $day, $starttime and $endtime. If a show is today and nowtime is between $starttime and $endtime, meaning the show is on air at the moment, then I want the show to appear in a different font colour. As you can see from the site I'm having some difficulty and my code is now a little messed up. Is there anyone out there who can give me a hand and make this work? [code]if (what goes here?) { echo "<span class=\"main\"><strong>$start - $end</strong> $name</span><br />";} else { echo "<span class=\"nowshow\"><strong>$start - $end</strong> $name</span><br />" ;}[/code] Many thanks in advance.
×
×
  • 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.