Jump to content

Fergal Andrews

Members
  • Posts

    65
  • Joined

  • Last visited

Everything posted by Fergal Andrews

  1. Hi Ron_ron Try: for ($i = 0; $i <= 9; $i++) { if ($match[$i] == "H") { $drDisWins++; } }
  2. Hi justlukeyou, If I understand you correctly, this is what you want: <?php $query = "SELECT * FROM productfeed LIMIT 0, 15"; $fetchdata = mysql_query($query) or die("query: $query<br>This has an error: " . mysql_error() . '<br>'); $i = 1; while($row = mysql_fetch_array($fetchdata)) { $id = $row['id']; $image = $row['awImage']; $link = $row['link']; $description = $row['description']; $fulldescription = $row['fulldescription']; $price = $row['price']; echo "<div class='productpagemenu'> <div class='productpagedescription'> <center> <a href='$link' target='_blank' >$description</a> </center> </div> <div class='productpageimage'> <center> <a href='$link' target='_blank'><img src='$image' width=\"95%\"/></a> </center> </div> <div class='productpageprice'> <center> <center>&#38;#163; $price</center> </center> </div> <div class='productpagepricebutton'> <center> <center><a href='$link' target='_blank' ><img src=/images/buybutton.png /></a></center> </center> </div> </div>"; if ($i % 3 == 0) { echo "<br />"; } $i++; } ?> cheers, Fergal
  3. Hi dingleberry, If you just want to put the URL into the form field you could do this: <input type="text" name="url" value="$url" size="30" /> so long as this piece of code is accessible by the code that writes the form. <?php $url="".$_SERVER['HTTP_REFERER']; echo $url; ?> Cheers, Fergal
  4. Hi c_pattle, I wouldn't have all possible URLs in the sitemap. Firstly if there quite a few films in your database you will end up with a huge sitemap. The other reason is that it is possible an automated site map will pick create results for files that you don't want displayed, maybe a backup of another file. Cheers, Fergal
  5. Hi matthew9090, Is the file_get_html() function definitely returning the page HTML? If it is, then you are not assigning the output of strip_tags to anything. Try: $html = strip_tags($html); split() is a deprecated function in php 5.3. Maybe try explode(). Hope that helps, Fergal
  6. Hi mdmartinny, Use unlink (http://www.php.net/manual/en/function.unlink.php). cheers, Fergal
  7. Hi dflow, If you are looking for a MySQL search it would be: SELECT * FROM mytable WHERE mydate BETWEEN '2011-04-17 00:00:00' AND '2011-04-25 23:59:59' cheers, Fergal
  8. Hi anthelo, SELECT tblnews .*, tblnews_categories.* FROM tblnews INNER JOIN tblnews_categories ON table_news.id=tblnews_categories.id cheers, Fergal
  9. Hi stockychaser, glad you got it sorted. All the best, Fergal
  10. Hi stockychaser, Your connection code looks fine. If you're getting a blank page it is probably because error reporting is turned off. Try inserting this at the top of your script: error_reporting(E_ALL); ini_set('display_errors','On'); If you have direct access to the database try running your SQL query directly to make sure it doesn't contain any errors. Fergal
  11. Hi HCProfessionals, This will give you the time difference in minutes. Note that midnight date is 28, not 27 which is today's date as it is midnight tomorrow morning (if that makes sense!). <?php $currentTime = date("Y-m-d h:i:s"); $midnight = strtotime("2011-02-28 00:00:00"); $now = strtotime($currentTime); echo round (abs ($midnight - $now) / 60,2)." minutes"; ?> Cheers, Fergal
  12. Hi rckehoe, If this is only happening with large files it could be due to a timeout error. file_get_contents may not have time to completely read the file before the timeout limit is exceeded. You could try increasing the timeout value in your php.ini file if you have access to it. You could also check if it is a timeout error by only reading a small amount of the file. I'm not sure if this will work with binary data though. $url = 'http://somesite.com/myfile.txt'; $file = fopen($url, "r"); $contents = fgets($file, 100000); //Limits to 100KB fclose($file); If that gets part of the file then I reckon it is a timeout error. Cheers, Fergal
  13. Hi stockychaser, I can't see the country drop-down in the page you link to. Are you definitely getting a connection to your database? Try putting some debugging code in to see if you are getting any results. Use var_dump() to view the content of $obj_queryCarCategory <?php while($obj_queryCarCategory = mysql_fetch_object($result_queryCarCategory)) { var_dump($obj_queryCarCategory); ?> Can you post the code that does the database connection and query? Cheers, Fergal
  14. sorry, should have said, if you have set up php to run from the command line in windows you probably don't need to use wget.
  15. Hi phpmady, If you are on a windows machine you can set up a scheduled task and run the PHP script using wget for windows. http://gnuwin32.sourceforge.net/packages/wget.htm. This calls the script using an http request. http://en.wikipedia.org/wiki/Wget Cheers, Fergal
  16. Hi phpmady, You can trigger a PHP script using a cronjob on your server. The script extracts the required data from the database, formats it and sends an HTTP request to an SMS gateway. For the actual sending of an sms from php, have a look at this tutorial: http://www.sephiroth.it/tutorials/flashPHP/sms/ To trigger Cheers, Fergal
  17. hi drayarms, Try changing $imagebytes = $row[image]; to $imagebytes = $row['image']; If that doesn't work check that nothing is being outputted before header("Content-type: image/jpeg"); cheers , Fergal
  18. hi php_guy, The browser has to load each page it is redirected to and the server hosting the page must process the code before it redirects to the next page. Therefore it is possible for someone to shut down the browser or hit the stop button. You can test this by setting up your redirects and use a browser plugin to throttle your connection speed to simulate different types of connection speed. Cheers, Fergal
  19. Hi stijnvb, I've never done this myself but I think you can achieve what you are looking for by utilising PHP's socket functons. Have a look in the manual at "Socket" and "fsockopen()" in particular. Cheers, Fergal
  20. Hi cool_techie, I can't see any obvious mistakes in your code but try entering the SQL statement directly in MySQL to make sure that is not producing any errors. Are any of the fields numeric in the db table? If so, remove the quotes around the corresponding values in the SQL. You might also want to do a var_dump($_POST) in process.php to make sure nothing strange is getting posted. Best of luck, Fergal
  21. Hi pappakaka, Try changing your conditional operators like this: elseif(!strlen($this->password) >= 6) to elseif (strlen($this->password) < 6) and elseif(!$this->confemail == $this->email) to elseif ($this->confemail != $this->email) cheers, Fergal
  22. hi pappakaka, The first error is because your SQL statement is failing. This looks like it is because there is no column called ID. Try changing it to SELECT username FROM users WHERE username = '{$this->username}' The second error is because eregi is deprecated. This means that it is being phased out of PHP. I think it is no longer in PHP 5.3 but I'm not certain about that. A deprecated function will still work but it is not good to use it. Use preg_match instead: if(empty($this->email) || !preg_match('/^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]{2,4}$/',$this->email)) $this->errors[] = 'Invalid Email'; cheers, Fergal
  23. Hi cs.punk, You can capture the output of print_r instead of echoing it by adding a return value: print_r($myArray, true); Try this with your code: <?php $name = array('Chris', 'Bob', 'Jack'); $names = print_r($name, true); echo $names; ?> cheers, Fergal
  24. Hi svensegers99, You will need to use javascript if you want the page to automatically redirect after a certain amount of time. setTimeout("window.location.href='homepage.html'", 5000); Cheers, Fergal
  25. Hi Toy, Where are you making a connection to MySQL and selecting the database? If you are doing that outside of this piece of code are you sure the connection is available to it? $conn = mysql_connect('localhost', 'mysql_username', 'mysql_password') or die('Cannot connect to db server'); mysql_select_db('database_name', $conn) or die('Cannot select database'); Also you can't just access data using $result in this piece of code. You need to actually fetch the data using : $row = mysql_fetch_assoc($result); $username = $row['username']; One other thing, put quotes around array index names. Your code has: $result[username] which should be $result['username'], though as I said you can't access this value like that. Hope that helps, Fergal
×
×
  • 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.