-
Posts
3,584 -
Joined
-
Last visited
-
Days Won
3
Everything posted by JonnoTheDev
-
Google "php report writer" first result http://www.programmersheaven.com/download/32748/download.aspx
-
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.
-
PHP/SQL - Unable to get the ID after INSERT
JonnoTheDev replied to batman12345's topic in PHP Coding Help
You are using the mysqli extension http://uk.php.net/manual/en/mysqli.insert-id.php -
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>
-
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!
-
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.
-
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.
-
[SOLVED] Mysql / PHP Hanging after first run through
JonnoTheDev replied to doa24uk's topic in MySQL Help
How many records are returned from the initial query? -
Resize and create thumbnails from uploaded image
JonnoTheDev replied to mahalleday's topic in PHP Coding Help
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 -
Polish character issues with PHP/MySQL and UTF-8
JonnoTheDev replied to bedeabc's topic in PHP Coding Help
After you connect to the database run the following query mysql_query("SET NAMES 'UTF-8'"); -
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
-
$sql = "SELECT SUBSTRING(series,1,1) as init, GROUP_CONCAT(series ORDER BY series SEPARATOR '<li><a href=\"\">') FROM series GROUP BY init";
-
echo "<div>".date("M j, y g:i a", strtotime($ad->date_submit))."</div>";
-
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.
-
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.
-
The door handle falls out
-
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.
-
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
-
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
-
How to find the number of a given location.
JonnoTheDev replied to darkhorn's topic in PHP Coding Help
or $int = (string)56781236; print $int[4]; -
Thanks, I can work with that result set
-
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