GregL83
-
Posts
119 -
Joined
-
Last visited
Never
Posts posted by GregL83
-
-
Hello all ,
I am building a PHP/MySQL driven site. I want to purchase annual access to a zipcode/city/state database. I have a table that stores records with location information that should be relatively static.
I am having trouble developing the relational database structure... The problem occurs with an update of the zipcode database. How do relative fields, from other tables, stay current?
Example:
Location Table
Zipcode Tableid location_id A 1 B 2 C 1 id zipcode city state 1 02134 boston ma 2 02445 brookline ma What happens when the zipcode database update has an additional zip code that is before the two in my example? Also, what if boston and brookline were to trade zipcodes (unlikely, but in theory)... The sample zipcode tables I have looked at do not come with the ID column.
My general question is: How do you maintain zipcode/city/state table(s) that have related records in another table? Remember the zipcode updates.....
Thanks and sorry for the long post..
-
Depends on the current data format.
You can use a spreadsheet and save it as a CSV file. CSV files can be imported into a database table. I use HeidiSQL. CSV files use commas and quotations to designate rows and cols.
If you are starting from scratch I would put it into a spreadsheet and import each table.
-
-
Yes, provide the location of the mysql server (domainB) in your database connection function.
i.e.
$connection = mysql_connect('domain_location','username','password');
assuming your using php.
-
My web host had the save session line commented out of the PHP.ini file!
Solved.
-
No one?!?
I have this posted on several sites with no responses...
-
Hey all .
I have built a login system using AJAX. The system worked perfect on my local machine. Once I uploaded the script to my hosting server I noticed a problem. I can log in and the session variables are carried to each page; however, when I go to my domain root for example http://domain.com instead of http://domain.com/index.php I run into problems. The session seems to exist in radical states. The session variables I set are recognized at random about 40% of the time. I can hit refresh multiple times and watch myself be logged in and be logged out like a slot machine. No other page is experiencing this problem. Even stranger, I logged out and went to domain root http://domain.com and hit refresh and achieved the same results. My session variables were existent sometimes and non existent other times. I went back to other pages on my site and the session variables did not exist because I had logged out. Obviously this seems to be a problem with my sessions. At the top of each page <?php session_start(); ?> is placed. I then use a login class to check if the user is logged in and set $logged_in equal to true or false.
My basic page flow is as follows:
LOGIN
random page -> login popup div -> send login form elements to ajax page located in ajax folder -> ajax page uses login class to login or display errors
LOGOUT
random page -> logout page -> call login class to destroy session and variables
-
does your server or php need to be setup specially?
I get the code
<?= $valueA ?>
printed in the input field...
-
What does it mean when php is written like this in a form?
file "test.php"
<form method="post" action="test.php" <input name="a" value=" <?= $valueA ?> " /> </form>
Thanks!
-
not sure, but I think you have to call it using setcookie again.... try it out...
anybody know?
-
sorry if I didn't explain it better....
I set the cookie in the body of the code and/or delete it there as well.
<html> <head></head> <body> <?php # start session session_start(); # create cookie setcookie('value', $value, time() + 3600, "/"); # display cookie; after page has been refreshed echo $_COOKIE["value"]; # deleting cookies setcookie('value', "", time() - 3600, "/"); ?> </body> </html>
if anyone notices and error feel free to let us know, I use this method and it works for me...
-
Anytime you want to pull the variable use $_COOKIE['value'].
Make sure that the session is started by session_start() ...
Thats it.
-
Your browser may need to refresh after the cookie is disabled. Try closing down the browser and re-opening it.
I do something like this:
<?php session_start(); setcookie('value', $value, time() + 3600, "/"); echo $_COOKIE['value']; ?>
to delete I use:
<?php session_start(); setcookie('value', '', time() - 3600, "/"); ?>
-
There is no form passing this variable along. It is a link that is as follows:
www.domain.com/locater.php?st=ma&ct=Boston
Thus, $_GET['st'] is 'ma'. If I echo $_GET['st'] I get: ma
-
anybody else have any ideas? I might just have to replicate this error in a simple script and tell my webhost to look at it.
-
hmm.. the error does say table user_acess.unip and that is the database name...
-
It is table 'ma' and it exists according to all the other scripts and functions except this one. sorry for posting the results like that. I have no idea where .unip comes from. I think its gotta be a setting of mysql, php.ini, or my web server... I am stumped and enraged that my webhost continues to tell me it is a scripting error without properly reviewing the circumstances.
-
my results....
Array ( [0] => ak [Tables_in_user_access] => ak ) Array ( [0] => al [Tables_in_user_access] => al ) Array ( [0] => ar [Tables_in_user_access] => ar ) Array ( [0] => az [Tables_in_user_access] => az ) Array ( [0] => ca [Tables_in_user_access] => ca ) Array ( [0] => co [Tables_in_user_access] => co ) Array ( [0] => ct [Tables_in_user_access] => ct ) Array ( [0] => de [Tables_in_user_access] => de ) Array ( [0] => fl [Tables_in_user_access] => fl ) Array ( [0] => ga [Tables_in_user_access] => ga ) Array ( [0] => hi [Tables_in_user_access] => hi ) Array ( [0] => ia [Tables_in_user_access] => ia ) Array ( [0] => id [Tables_in_user_access] => id ) Array ( [0] => il [Tables_in_user_access] => il ) Array ( [0] => in [Tables_in_user_access] => in ) Array ( [0] => ks [Tables_in_user_access] => ks ) Array ( [0] => ky [Tables_in_user_access] => ky ) Array ( [0] => la [Tables_in_user_access] => la ) Array ( [0] => ma [Tables_in_user_access] => ma ) Array ( [0] => md [Tables_in_user_access] => md ) Array ( [0] => me [Tables_in_user_access] => me ) Array ( [0] => mi [Tables_in_user_access] => mi ) Array ( [0] => mn [Tables_in_user_access] => mn ) Array ( [0] => mo [Tables_in_user_access] => mo ) Array ( [0] => ms [Tables_in_user_access] => ms ) Array ( [0] => mt [Tables_in_user_access] => mt ) Array ( [0] => nc [Tables_in_user_access] => nc ) Array ( [0] => nd [Tables_in_user_access] => nd ) Array ( [0] => ne [Tables_in_user_access] => ne ) Array ( [0] => nh [Tables_in_user_access] => nh ) Array ( [0] => nj [Tables_in_user_access] => nj ) Array ( [0] => nm [Tables_in_user_access] => nm ) Array ( [0] => nv [Tables_in_user_access] => nv ) Array ( [0] => ny [Tables_in_user_access] => ny ) Array ( [0] => oh [Tables_in_user_access] => oh ) Array ( [0] => ok [Tables_in_user_access] => ok ) Array ( [0] => or [Tables_in_user_access] => or ) Array ( [0] => pa [Tables_in_user_access] => pa ) Array ( [0] => ri [Tables_in_user_access] => ri ) Array ( [0] => sc [Tables_in_user_access] => sc ) Array ( [0] => sd [Tables_in_user_access] => sd ) Array ( [0] => tn [Tables_in_user_access] => tn ) Array ( [0] => tx [Tables_in_user_access] => tx ) Array ( [0] => users [Tables_in_user_access] => users ) Array ( [0] => ut [Tables_in_user_access] => ut ) Array ( [0] => va [Tables_in_user_access] => va ) Array ( [0] => vt [Tables_in_user_access] => vt ) Array ( [0] => wa [Tables_in_user_access] => wa ) Array ( [0] => wi [Tables_in_user_access] => wi ) Array ( [0] => wv [Tables_in_user_access] => wv ) Array ( [0] => wy [Tables_in_user_access] => wy )
the $_GET['st'] variable is set to 'ma' and that should select from that table. this page was correctly function before my webhost went and f'd it up
-
I ran this function
<?php $tables = mysql_query("SHOW TABLES FROM user_access;"); print_r($tables); ?>
All that printed was:
" Resource id #3 "
Also, I have other functioning pages using these tables. I have verified using PHPMYADMIN that all the tables are still intact....
-
the table exists still. it was working well before my account settings were changed by my webhost. also, other functions use these tables and work fine....
-
no, that is a 2 letter state identifier. in my example it would be " ma " for massachusetts.
-
hmm that code came out crappy..let me make it easier to read
<?php function stringsize($string){ $limit = 12; $str = $string; if (strlen($str) > $limit){ $str = substr($str, 0, $limit).'...'; } return $str; } $query = "SELECT nme, tp, r, vd, ovr, rr, enr, vr, ser, bnr FROM ".$_GET['st']." WHERE ct = '".$_GET['ct']."' ORDER BY nme"; $result = mysql_query($query) or die("Query failed: ".mysql_error()); while (list($name, $type, $rater, $vd, $overall, $ratio, $enter, $value, $service, $bnr) = mysql_fetch_row($result) or die("Query failed: ".mysql_error())){ echo "<tr><td><div class=\"ltr_scn\"><a href=\"scene.php?st=".$_GET['st']."&ct=".$_GET['ct']."&sc=$name\">$name</div></a></td><td><div class=\"ltr_scn\">$type</div></td><td><div class=\"ltr_scn\"><a href=\"\">"; $rater = stringsize($rater); echo "$rater</div></a></td><td class=\"ltr_scn\">"; if($vd == "y"){ echo "Yes"; } else{ echo "No"; } ?>
the rest of my code simply echo's the variables...
-
ok I ran the test and the mysql connection is fine...
I don't know how much that will help, because it is identical to the simplified version of this code. Keep in mind that this application ran perfectly fine for a few months until my webhost made the changes indicated at the begining of this thread. And the mystery is still not solved....thanks for you efforts so far though... I greatly appreciate it
see code below in next post
-
Ok.....I think were on to something...which guru can solve this....
I get the error:
" Query failed: Table 'user_access.uinp' doesn't exist "
I think this has to do with the server settings. Its weird though because this table is accessed for other functions...
[SOLVED] Help import text file into mySQL
in MySQL Help
Posted
I have the same problem with my host. Some hosts force you to use phpmyadmin...
Hack fix: Build your db locally (localhost). You can export your db from phpmyadmin and import it locally with heidisql. Use heidisql to import the csv to your local copy of the db. Export the db tables as sql format. Import the .sql file into phpmyadmin...