PHP - Application Data (cities & Zip)
I've been developing an application for some time now. It's come to the point to populate the database with accurate information. I've been searching for a list of City, State, Zip, Long & Lat for each. How can I find something like this? I see tons of them for sale, 79 bucks or so, but I don't want to pay. How do most of these people get their data?
Thank you Similar TutorialsHi Guys http://www.phpfreaks.com/forums/Smileys/nrg_alpha/cool.gif Cool I have social networking application. I am trying to query a database to get the ids of all the users friends. With the ids of all the users friends I am then trying to query a second database with the status feed that contains all users status data. I would like to echo the users friends status data only from the second database code is below hope you can help. Thank you. <?Php session_start(); ?> <?Php //connect. include("connect.php"); //Time ago coverting code. include_once("classes/develop_php_library.php"); // Include the class library $id=$_SESSION['id']; /*find-out users friends*/ $findperson=mysql_query("SELECT * FROM friends WHERE sessid='$id'"); $timeAgoObject = new convertToAgo; // Create an object for the time conversion functions $findfriend=mysql_num_rows($findperson); //Count if the person has any friends. If they have friends get the ids of all their friends if($findfriend>0) { while($rati=mysql_fetch_assoc($findperson)) { $fried=$rati['friendid']; //query the status table to give the users friends status. $mediafeeds=mysql_query("SELECT * FROM status WHERE userid='$fried' LIMIT 0,8"); $media_num=mysql_num_rows($mediafeeds); } //count to see if their any status updates from users friends. if($media_num>0) { //display all the users friends status data. $datamedia="<TABLE BORDER='0' CELLPADDING=8 bgcolor='#FFFFFF' align='center' width='350px' height='30px'>"; while($mini=mysql_fetch_assoc($mediafeeds)) { $user_id=$mini['userid']; $viewer_nme=$mini['username']; $viewer_picture=$mini['viewerpics']; $media_pic=$mini['contentpic']; $desc_ption=$mini['description']; $date_time=$mini['date']; $convertedTime = ($timeAgoObject -> convert_datetime($datetime)); // Convert Date Time $datetime = ($timeAgoObject -> makeAgo($convertedTime)); // Then convert to ago time .. //This is just a table with the data of all the users friends data. $datamedia.="<tr><td valign='top' cellpadding='5' width='10%' bgcolor='#FFFFFF' align='center' >$viewer_nme<br/><a href='friendsprofile.php?uid=$uidd&&viewer=$id'><img src='".$mediapic."' width='80' height='80' align=left></td> <td valign='top' align='left' cellpadding='5' width='60%' bgcolor='#D3D3D3' cellpadding='0'>$introduction<br/>$titlenamed$titled<br/>$descd$desc_ ption<br/><br/>$datetime</td></tr>"; } $datamedia.="</TABLE>"; echo $datamedia; } else { echo "<font color='#333333' size='2' face='sans-serif' align=left><div align='center'> Your friends have not current activities.</div></font>"; } } else { } Hi, I have a requirement of making the single website for different locations, customer running a enterprise, and he wants me to show corresponding items for corresponding locations(nearly around 30 locations) I am very confused how to make this(making separate sub domains for separate location), pls help me regarding this. Thanks, Hi, I need a small help. Here is my situation. I am using a MVC application (e.g. Joomla or Drupal) which has a .htaccess redirect rule that all requests are passed through index.php file. That's normal and this is my main application. Now I installed another application within the application folder structure. What I want do do here is to allow opening the third party application URLs after one logged into my main application. Can anybody provide me some pointers to do the same? Please let me know if you need any further information on this. Any solution irrespective of framework will work. Thanks! Anupam This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=312305.0
Hello everyone,
1 <?php
7 // Create connection
10 // Check connection
14 $firstname = $conn->real_escape_string($_REQUEST['firstname']); 25 $sql2 = "INSERT INTO countries VALUES ('$country')"; 27 $sql3 = "INSERT INTO Contacts (firstname, lastname, address, city, country, phone, email) VALUES ('$firstname', '$lastname', '$address', $city, $country, '$phone_number','$email')";
29 SELECT * FROM cities;
if($conn->query($sql2) === true){
if($conn->query($sql3) === true){ I've searched but can't seem to find anything I can apply to this situation. Most of the resources are dedicated to dropdown menu's from the same table. I have two tables 'regions' and 'cities' and I am looking to create a menu that lists all the cities within a region then moves on to do the same for the rest of the regions in that state: State1 Region1 City1 City2 City3 Region2 City1 City2 City3 Region3 Etc My tables: States table: stateID, state Regions table: regionID, region, stateID Cities table: cityID, city, regionID I currently have two pages- select region, then select city... I'd like to consolidate to one step after choosing a state. I know I need a nested loop, (while?), and to count the results somehow to retrigger loop; also not sure how to handle two mySQL querries in the nested loop. I'm having trouble wrapping my mind around it. Thank you. Hi, I need to develop a module called chat with doctor. User can able to chat with the doctor for that he has to pay some amount to website. Say example user got purchase the Package worth : 2$ =>5min. After 5 min chat will be closed , timer should be shown while chatting. How can we do this? Hey all I have an error in my Facebook application and I'm not sure what's wrong (New to PHP). The error output is: Code: [Select] Warning: array_rand() [function.array-rand]: Second argument has to be between 1 and the number of elements in the array in /home/app/view.php on line 15 And the PHP lines are as follows: $friends = $facebook->api('/me/friends'); print_r(array_rand($friends, 3)); i got this application more then 10 years, all this years nothing happend, untill prev week, someone to lazzy to filled all the info required, but after submitting the form, their uncomplete info just being printed on the database. Which mean the required field code didnt work 2 all, all this year,.. what a dissapointment. Can someone take a look at my scripts and fixed please [attachment deleted by admin] I am building program to manage payment/monthly payments. I've ran into an issue that I haven't been able to overcome and need some help. I've been lurking for a while and decided it was time to ask you guys...Here's the issue: I have a table 'payments' that contains scheduled payments that looks like: id clientid paymentduedate balance expected pending 367 112233 4/16/2011 1030.00 257.50 Y 368 112233 5/16/2011 1030.00 257.50 Y 369 112233 6/16/2011 1030.00 257.50 Y 370 112233 7/16/2011 1030.00 257.50 Y What I need to do that I haven't figured out is to adjust the expected amount according to the payment, update the status to N (not pending) without affecting the later expected payments. For example: they make a payment of $257.50, applies that to row 367, sets the status to N, but leaves the other status' to Y (for obvious reasons). the make a payment of $250.00, leaving the balance at $7.50, so lets add $7.50 to row 368, mark 367 status to N the make a payment of $300.00, leaving the expected balance at $0.00 for row 367, but adjust the balance for row 368 to $215.00 Any ideas? Thanks There are ten list or bookmarks from Prof. Horner's Bible-Reading System found (http://www.facebook.com/group.php?gid=46416541831) each having set number of books from the Bible. One is to read ten chapters a day, one chapter from each of the bookmarks. Type in what day you are on and the program will show you on each of the lists as to what chapter you are suppose to be on. Also want to show statistics that will display how many times the Bible has been read with a break down of all 66 books of the Bible. Started a git respo http://github.com/Kutakizukari/Prof-Horners-Bible-Reading-System Bookmark list as follows: //List 1 $Matthew = 28; $Mark = 16; $Luke = 24; $John = 21; //List 2 $Genesis = 50; $Exodus = 40; $Levitieus = 27; $Numbers = 36; $Deuteronomy = 34; //List 3 $Romans = 16; $I_Corinthians = 16; $II_Corinthians = 13; $Galatians = 6; $Ephesians = 6; $Philipians = 4; $Colossians = 4; $Hebrews = 13; //List 4 $I_Thessalonians = 5; $II_Thessalonians = 3; $I_Timothy = 6; $II_Timothy = 4; $Titus = 3; $Philemon = 1; $James = 5; $I_Peter = 5 ; $II_Peter = 3 ; $I_John = 5; $II_John = 1; $III_John = 1; $Jude = 1; $Revelation = 22; //List 5 $Job = 42; $Ecclesiastes = 12; $Songs_of_Solomon = 8; //List 6 $Psalms = 150; //List 7 $Proverbs = 31; //List 8 $Joshua = 24; $Judges = 21; $Ruth = 4; $I_Samuel = 31; $II_Samuel = 24; $I_Kings = 22; $II_Kings = 25; $I_Chronicles = 29; $II_Chronicles = 36; $Ezra = 10; $Nehemiah = 13; $Esther = 10; //List 9 $Isaiah = 66; $Jeremiah = 52; $Lamentations = 5; $Ezekiel = 48; $Daniel = 12; $Hosea = 14; $Joel = 3; $Amos = 9; $Obadiah = 1; $Jonah = 4; $Micah = 7; $Nahum = 3; $Habakkuk = 3; $Zephaniah = 3; $Haggai = 2; $Zechariah = 14; $Malachi = 4; so on day 1 it should readout Matthew Chapter 1 Genesis Chapter 1 Romans Chapter 1 I Thessalonians Chapter 1 Job Chapter 1 Psalms Chapter 1 Proverbs Chapter 1 Joshua Chapter 1 Isaiah Chapter 1 Acts Chapter 1 on the second day it should all say Chapter two but Matthew reaches day 28 it should move on to Mark Chapter 1 and so on and so on and with each bookmark list. I am urgently looking for a junior PHP web application developer with a portfolio of your code experience, no commercial experience will be considered to.
Please contact me to find out more!
Exciting opportunity for someone wanting to get a foot in the door in the world of IT!!
Hi all, this is my first time on this forum! I have a background with HTML and CSS but have recently started a Masters in Computer Science hoping to come out of it with the tools to get a job with PHP development. Our first assignment has somewhat 'thrown me in the deep end' as we have to construct a search engine that indexes the words of a number of documents and rank them using the TF*IDF algorithm along with the log rule associated with Information retrieval. I am completely new to PHP so the past week has been something of a crash course - This is the code I have so far: Code: [Select] <?php $filename = 'airlines.txt'; $fp = fopen( $filename, 'r' ); $file_contents = fread( $fp, filesize( $filename ) ); fclose( $fp ); //$new_contents = ereg_replace("[^A-Za-z0-9]", "", $file_contents); /*$file_contents = trim($file_contents); $file_contents = preg_replace('/\h+/', ' ', $file_contents); $file_contents = preg_replace('/\v{3,}/', PHP_EOL.PHP_EOL, $file_contents); */ $pat[0] = "/^\s+/"; $pat[1] = "/\s{2,}/"; $pat[2] = "/\s+\$/"; $rep[0] = ""; $rep[1] = " "; $rep[2] = ""; $new_contents = preg_replace("/[^A-Za-z0-9\s\s+]/","",$file_contents); $new_contents = preg_replace($pat,$rep,$new_contents); //preg_replace('~\s{2,}~', ' ', $text); $commonWords = array('a','able','about','above'........and another few hundreds cut out of this not to hurt your eyes!); $lines = explode ( "\n", $new_contents); $lines2 = implode (" ", $lines); $words = explode ( " ", $lines2 ); $useful_words = array_diff( $words, $commonWords ); /*for($i = 0; $i < count($lines); $i++) { echo "Piece $i = $lines[$i] <br />"; }*/ for($i = 0; $i < count($useful_words); $i++) { echo "Words $i = $useful_words[$i] <br />"; } //$arr=array("blah1","blah2","blah3"); file_put_contents("demo2.txt",implode(" ",$useful_words)); //$file_c = file_get_contents("demo.txt"); //$colms = explode(",",trim($file_c)); //print_r($colms); //echo $lines[2]; ?> I've got to the stage where that strips out most of the stop words when the final array is printed, but they have been replaced with spaces or something that I have not come acoss because as you may see I had a bit of trouble originally stripping the punctuation marks. I'm hoping someone can point me in the direction as to how to organise the words I have left after the stripping of stop words which are of no use during the search. I need to store those words into another array and index them which says how many times they appear in that document. I've come across the function array array_count_values ( array $input ) on the manual but I'm not sure about the best way to use it. I've attached the files I've used if that helps. Any help would be greatly appreciated! here is the address http://bancorpfunding.com/contact-form.html either view source or look at code below How do i get the action to send to email without writing a message Hello php gurus,...i need some help here for my php online quiz application. I am doing an online quiz application,where at first a tutor will enter the question and selection of answers,and following by the correct answer through a form. Code: [Select] <html> <body> <form action="insert.php" method="post"> <p>Question: <input type="text" name="Q" /> </p ><p>Answer1: <input type="text" name="A" /> </p> <p>Answer2: <input type="text" name="B" /> </p> <p>Correct Answer: <input type="text" name="ans" /> </p> <p> <input type="submit" /> </p> </form> </body> </html> All the details will be sent to mysql database,and the database structure will be like this : Quote Question AnswerA AnswerB CorrectAnswer 1+1 2 4 A 2+3 6 5 B After that,i have created a php codes to retrieve the Questions from database,and display it in webpage,and the AnswerA and AnswerB will be shown in radio button.So users can choose the answer using radio button... My problem is,i don't know how to compare the 'value' in radio button with the 'CorrectAnswer' in the database,to know the correct answer. And also don't have idea how to calculate the correct answer and getting the results. So,if anyone could help me..i will be really gratefull... Hope can get the solution....plss help me Thank you very much I have attached my documents here... [attachment deleted by admin] HTTP Header input client-ip was set to 1 Error message found: Code: [Select] Notice: Undefined index: user_name in D:\wamp\www\javascript\public\proc\login.php on line <i>9</i> HTTP Header input user-agent was set to 1 Error message found: Code: [Select] Notice: Undefined index: user_name in D:\wamp\www\javascript\public\proc\login.php on line <i>9</i> HTTP Header input referer was set to 1 Error message found: Code: [Select] Notice: Undefined index: user_name in D:\wamp\www\javascript\public\proc\login.php on line <i>9</i> i dont know what they mean by HTTP header soo i cant fix this error .. help ? I am looking to save the user's access of an application. For instance, when they log in, I create a record in the "track_login" table which includes information such as the requesting IP, the user's ID, the date, (not the user's password), etc. And then for every page they visit, I store a record in the "track_page_viewed" table which includes a FK to the "track_login" table and also includes additional information about their request.
Both the track_login and track_page_viewed tables are currently in the same database as used by the primary application.
So far, so good.
Next, I want to start tracking when a user does special tasks such as when they forget their password and request that a new one be emailed to them. Or maybe when they attempt to login with an invalid username and password. Currently, I just included another table called "track_special" which includes the data, the type of special request, etc.
Now, I am thinking of adding three other things to track:
General PHP errors
MySQL errors
Try/Catch errors which I did not expect to happen
One option is just to add these to my "track_special" table or maybe make one or three new tables in the same database.
But is this a good idea? If I have a SQL error, do I really want to store the error in the same database? Maybe I should use a separate database called "myTrackerDB", and include all the above tables in that database? Or maybe I should just write the data to a flat file, and parse the file on a regular basis, and then store the information in the database?
Please provide any recommendations, guidance, suggestions, criticism, etc. Thank you
Hi, I'm working on a project which was going pretty well until I discovered the application doesn't actually know where it is installed. So far when I want to include the config file I just use $_SERVER['DOCUMENT_ROOT'].'/config.php';() Which works fine if the application is installed in the root directory. But how do I get the folder the application is installed in? e.g. Document Root Folder: C:\Web\ Actually Application Folder: C:\Web\MyApp\ How do I get the \MyApp dynamically? I can't just use './' all the time because I have files accessed by AJAX stored in other folders. Thanks in advance. |