Jump to content

daveh33

Members
  • Posts

    183
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

daveh33's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. ....I have changed the function to preg_match instead of preg_match_all and its working perfectly thank you so much for your help everyone! much appreciated!!!
  2. Thats what I thought, I've changed the echo/print // print_r($matches); echo $matches[1]; but it just displays 'Array'
  3. :-) I can see the article! But it still has 'Array ( [0] => Array ( [0] =>' at the start, it's also looping and showing it twice...
  4. <? $url = "http://www.thesun.co.uk/sol/homepage/sport/other_sports/racing/1142207/Templegates-racing-tips.html"; $page = file_get_contents($url); // echo $page; preg_match_all("/<roottag>(.+?)<\/roottag>/", $page, $matches); print_r($matches); ?>
  5. yes - when I echo $page it loads the entire webpage where the article is. When I view the source I can see the <roottag> </roottag> tags
  6. Thanks - I have changed that line of code and the output is now: - Array ( [0] => Array ( ) [1] => Array ( ) )
  7. Hi, I am trying to write a script for my website to get an article from an external website. The external website has the article in a set of tags <roottag> & </roottag> The code I am using is $page = file_get_contents($url); preg_match_all("/<roottag>.+<\/roottag>/", $page, $matches); print_r($matches); when this code runs the below is output: - Array ( [0] => Array ( ) ) I've not used this function in php and am a bit stuck! so any help is really appreciated
  8. I am writing a 5-star rating script and trying to get mouse over images to work. I have my 5 stars for the user to click: - <a href=\"#\" onclick=\"document.comment.rating.value='1'; return false;\"><img src=\"star01.gif\" border=\"0\" /></a> <a href=\"#\" onclick=\"document.comment.rating.value='2'; return false;\"><img src=\"star01.gif\" border=\"0\" /></a> <a href=\"#\" onclick=\"document.comment.rating.value='3'; return false;\"><img src=\"star01.gif\" border=\"0\" /></a> <a href=\"#\" onclick=\"document.comment.rating.value='4'; return false;\"><img src=\"star01.gif\" border=\"0\" /></a> <a href=\"#\" onclick=\"document.comment.rating.value='5'; return false;\"><img src=\"star01.gif\" border=\"0\" /></a> This sets the value of the hidden field no problem. When the user clicks a star (e.g 4) I would like the first 4 stars image source to change - if anyone can help me with this it is much appreciated. Thanking you in advanced!
  9. if (!$_POST['field-name']) { // The field has no value } else { // The field has a value }
  10. Hi I have a script which shows a members profile, an example page url is: - index.php?username=Dave I want to make it the member can share there profile via the url mydomain.com/Dave and when they hit that url it displays the content of index.php?username=Dave How do I go about setting this up? Is it htaccess?
  11. Hi - I am trying to get a script to work which can watermark my images - I am working of this tutorial: - http://www.trap17.com/index.php/watermark-image-simple-php-script_t36015.html I have a file called watermark.php with the below code: - <?php // this script creates a watermarked image from an image file - can be a .jpg .gif or .png file // where watermark.gif is a mostly transparent gif image with the watermark - goes in the same directory as this script // where this script is named watermark.php // call this script with an image tag // <img src="watermark.php?path=imagepath"> where path is a relative path such as subdirectory/image.jpg $imagesource = $_GET['path']; $watermarkPath = $_GET['watermark']; $filetype = substr($imagesource,strlen($imagesource)-4,4); $filetype = strtolower($filetype); $watermarkType = substr($watermarkPath,strlen($watermarkPath)-4,4); $watermarkType = strtolower($watermarkType); if($filetype == ".gif") $image = @imagecreatefromgif($imagesource); else if($filetype == ".jpg" || $filetype == "jpeg") $image = @imagecreatefromjpeg($imagesource); else if($filetype == ".png") $image = @imagecreatefrompng($imagesource); else die(); if(!$image) die(); if($watermarkType == ".gif") $watermark = @imagecreatefromgif($watermarkPath); else if($watermarkType == ".png") $watermark = @imagecreatefrompng($watermarkPath); else die(); if(!$watermark) die(); $imagewidth = imagesx($image); $imageheight = imagesy($image); $watermarkwidth = imagesx($watermark); $watermarkheight = imagesy($watermark); $startwidth = (($imagewidth - $watermarkwidth)/2); $startheight = (($imageheight - $watermarkheight)/2); imagecopy($image, $watermark, $startwidth, $startheight, 0, 0, $watermarkwidth, $watermarkheight); imagejpeg($image); imagedestroy($image); imagedestroy($watermark); ?> Within the directory I have - watermark.php, index.php, watermark.gif & test.jpg index.php simply contains: - <? header("Content-type: image/jpeg"); ?> <img src="watermark.php?path=test.jpg&watermark=watermark.gif" /> All it seems to display is the page url ... no image - any ideas why??
  12. I have a data management system which was previously configured to use a MySQL database.. As the database has expanded it doesn't seem to be able to cope with the amount of data - so I am transferring it to a MSSQL database. Most of the move has been pretty straight forward but I am having problems with one query: - $result=mysql_query("SELECT DISTINCT(number) FROM $tablename WHERE NOT EXISTS ( SELECT DISTINCT(number) FROM dbo.STOPS WHERE $tablename.number=dbo.STOPS.number ) LIMIT $start,$finish") or die(mysql_error()); I am aware that is MSSQL there isn't a LIMIT function... but I dont know an alternative? Any ideas?
  13. the $start & $end will either be: - A E F J K P Q Z
  14. Thats great- but look at my actual code $list=$_GET['list']; list($start,$end) = explode("-", $list); This produces the $start="A"; $end="E"; how can I use variables in that statement?
  15. I have a mysql database with a table which contains two fields -areaid,area I am trying to return a set of results in a while statement which will get any records in my table which start with the letters A,B,C,D,E This is my code.. $start="A"; $end="E"; $query=mysql_query("SELECT * FROM mytable WHERE area LIKE 'A%%%'"); while ($data=mysql_fetch_array($query)) { $areaid=$data['areaid']; $area=$data['area']; echo "<a href=\"area.php?id=$areaid\">$area</a><br /><br />"; } I know my query isn't quite right, but im not sure if this is the best way to do this? Any help is appreciated
×
×
  • 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.