Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. Google "php report writer" first result http://www.programmersheaven.com/download/32748/download.aspx
  2. If it is your own database of cities/towns, you will need the longitude / latitude values for each to start with. You will probably need to write a data miner to obtain this information from wherever you can find it (wikipedia, fallingrain, etc). The next step is a bit tricky. You require a bit of mathematical magic, known as the Haversine formula for calculating the distance between lat & long points. You can run as a query i.e: <?php // get long and lat of a given place i.e. Sevilla, Spain $lat = 37.3772; $lon = -5.98694; // now find the nearest places within a given distance (miles) $distance = 12; $result = mysql_query("SELECT cityId, city FROM cities WHERE SQRT(POW(69.1 * (latitude - ".$lat."), 2) + POW(69.1 * (".$lon." - longitude) * COS(latitude / 57.3) , 2)) < ".$distance); ?> If you want to include the distance from the starting city for each record found or order by distance let me know and I will expand on the query. However this is your start point.
  3. You are using the mysqli extension http://uk.php.net/manual/en/mysqli.insert-id.php
  4. Be sure to santitize the input to any form before using in code. Put the following into your search field and see what happens (won't do any damage): // put this into your search box <script language="javascript">alert('xss attack');</script>
  5. Submitting your site to a search engine does not achieve rankings! Read up on ways to improve your site rankings (SEO). All that site submission does is give the search engine a direct url to crawl your site from. It can take months before this happens and achieve search engine indexing. Why even give lets say Google a site submission. If you have done the necessary SEO steps then Google should find you not you tell Google who you are. Lets say you find a popular site with a similar genre that Google loves to spider (it will have good rankings for your keywords). If you were to obtain a link from that site to yours then Google would find your website and index it probably the next day. Links are your friend!
  6. I have a program that does exactly the same thing and the server isn't heavily loaded. Steps to take: 1. Optimise your queries. Make sure that you have indexes on the correct fields when you are checking for duplicates. 2. Unset variables after use, i.e once you load the feed into a variable, after you have inserted into database, unset it. 3. Add more memory to the server and allocate to the script. This is the simplest option. 4. Record a date-time on the feed so that the script will not try and get news from this feed if it has already in lets say the last 24hs. This is a simple query. My script obtains news from thousands of feeds and can take hours to complete however I would suggest you run this on a linux box with only the required software installed. I would say that a windows box is a bad choice as a lot of memory is already allocated to the operating system.
  7. No, a loop is a loop. I'm guessing that the mp3 files are from external domains. This will be why your load time is large.
  8. How many records are returned from the initial query?
  9. Call the 2 functions from 1 function using new parameters: <?php function abc($imagePath, $thumbPath, $file, $size, $quality) { imageReszie($file, $imagePath, $size, $quality); makeThumb($file, $thumbPath, $size, $quality); } // usage abc('images/','images/thumbs/',$file,$quality); ?> Also check your function names, you have spelling mistakes
  10. Add to an htaccess file Options +Indexes
  11. After you connect to the database run the following query mysql_query("SET NAMES 'UTF-8'");
  12. Answer 1. You rub your hands together till they are really sore 2. You take the saw and cut the table in half 3. Two halves make a whole 4. You climb through the hole and escape simple
  13. $sql = "SELECT SUBSTRING(series,1,1) as init, GROUP_CONCAT(series ORDER BY series SEPARATOR '<li><a href=\"\">') FROM series GROUP BY init";
  14. echo "<div>".date("M j, y g:i a", strtotime($ad->date_submit))."</div>";
  15. You mean procedural programming. Object oriented languages were introducted in the late 1960's so it is nothing new. If you want to increase your knowledge of programming and ability to understand code using this practice.
  16. You're in a room with 4 solid brick walls and a solid ceiling. There are no windows and no doors. All that is in the room is a table. How do you get out? Answer coming soon.
  17. The door handle falls out
  18. I would start with some simple tutorials on php & mysql syntax, connecting to a database and performing queries. Your requirement is simple and shouldn't take long to implement. There is tons to go through after a bit of googling. http://www.freewebmasterhelp.com/tutorials/phpmysql
  19. Why try and create your own cache engine when there are so many available? Each cache file for the users page would have a unique identifier i.e userId 1, profile1.tpl.cache userId 2, profile2.tpl.cache Also I do not understand why you would cache such a page. If a users profile was to change then you have no means of resetting the cache other than to delete your cache files. Cache engines can detect this and deal with it in the appropriate fashion. Template caching should be used on files where the data will not change very often. Cache engines usually allow sections of a cache page to become dynamic where data changes often.
  20. MySQL also has a query cache. So if you get the same query running many times it is stored in cache to return a resultset faster. http://www.databasejournal.com/features/mysql/article.php/3110171/MySQLs-Query-Cache.htm
  21. One of the benefits of a template engine (although a lot of bad press on template engines on this forum). http://www.smarty.net/manual/en/caching.php
  22. or $int = (string)56781236; print $int[4];
  23. Thanks, I can work with that result set
  24. The 301 url will not send a referrer header hence you cant pick this up. I would use a 301 to a landing page on the target domain where you can record that a redirect has occurred. Once logged use another 301 to the base url i.e. www.abc.com -> 301 redirect to www.xyz.com/landing.php www.xyz.com/landing.php -> record referral -> 301 redirect to www.xyz.com www.xyz.com
×
×
  • 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.