Jump to content

GregL83

Members
  • Posts

    119
  • Joined

  • Last visited

    Never

Posts posted by GregL83

  1. 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...

  2. Hello all  :D  ,

     

    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

    id location_id
    A 1
    B 2
    C 1
    Zipcode Table
    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..

  3. 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.

  4. Hey all  ;D.

    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

  5. 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...

  6. 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, "/");
    ?>
    

  7. 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.

  8. 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

  9. 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....

  10. 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...

  11. 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

  12. 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...

×
×
  • 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.