GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 06-Jun-2006, 09:49
jrobbio's Avatar
jrobbio jrobbio is offline
Regular Member
 
Join Date: Jan 2003
Location: Loughborough, England
Posts: 840
jrobbio will become famous soon enough
Question

MySQL setup for large address system


Hello all its been a long time, but I hope you are well and can help me!

I've converted an access database into MySQL that I now need to query. When it is completed, it is going to be a massive database ~ 50mb of MySQL data.

Here are the details I am using to create the tables.

Code:
DROP TABLE IF EXISTS `Addresses`; CREATE TABLE `Addresses` ( `Postcode` VARCHAR(8) NULL, `Homes` DOUBLE(15, 5) NULL, `Leads` INT(10) NULL, `Map Easting` INT(10) NULL, `Map Northing` INT(10) NULL, PRIMARY KEY (`Postcode`), INDEX `Map Easting` (`Mappoint Easting`), INDEX `Map Northing` (`Mappoint Northing`) ) ENGINE = INNODB; SET FOREIGN_KEY_CHECKS = 1; EOF

And here is some sample data:

Code:
INSERT INTO `Addresses` (`Postcode`, `Homes`, `Leads`, `Map Easting`, `Map Northing`) VALUES ("AL1 1AG ", 6.0, 0, 515486, 206497), ("AL1 1AJ ", 52.0, 0, 515488, 206412), ("AL1 1BH ", 48.0, 0, 514835, 206655), ("AL1 1BX ", 17.0, 0, 514616, 206889), ("AL1 1BY ", 7.0, 0, 514585, 206994), ("AL1 1BZ ", 11.0, 0, 514666, 207043),

I am incredibly rusty since it has been a while since I dealt with this type of thing, but I want to create a form so when someone enters their postcode e.g. AL1 1BH, it gives them the number of homes and Leads in response and the coordinates of the postcode from Map Easting and Map Northing.

Any other suggestions too would be appreciated.

Thanks in advance,

JR
  #2  
Old 07-Jun-2006, 03:39
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough

Re: MySQL setup for large address system


Hello Rob,

It's nice to 'see' you again

Unless I have misunderstood your question, this is a very simple query:

PHP Code:

// init variable holding data
$postcode_data = array();

// SQL
$sql =    'SELECT *'
    . ' FROM `Addresses`'
    . ' WHERE `Postcode` ='
    . " '".mysql_escape_string( $_POST['postcode'] )."'";

if( $result=@mysql_unbuffered_query($sql, $conn) )
{
    $postcode_data = @mysql_fetch_assoc( $result );
}

// preview result:
echo '<pre>'; print_r( $postcode_data ); die( '</pre>' ); //*/ 


  #3  
Old 08-Jun-2006, 15:27
jrobbio's Avatar
jrobbio jrobbio is offline
Regular Member
 
Join Date: Jan 2003
Location: Loughborough, England
Posts: 840
jrobbio will become famous soon enough

Re: MySQL setup for large address system


Its been a long long time since I've dealt with MySQL and PHP so I am close to step 1 again, though I'm pretty sure I will pick it up slowly.

When I have the database set up, I'll give this query a try.

JR
 
 

Recent GIDBlogInstall Adobe Flash - Without Administrator Rights by LocalTech

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pointer Usage in C++: Beginner to Advanced varunhome C++ Forum 0 19-Aug-2005 09:25
[Tutorial] Pointers in C (Part II) Stack Overflow C Programming Language 0 27-Apr-2005 17:36
Macromedia DWMX and PHP MySQL setup soulja90 MySQL / PHP Forum 1 17-Mar-2004 04:50
Windows: From only £20p/y,Linux: from $10p/m. ASP, ASP.NET, PHP, Free MySQL, +More EyotaHosts Web Hosting Advertisements & Offers 0 28-Jun-2003 13:54

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 06:10.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.