Menu

importing a file -- HELP!!!!!!!!!!

Gemmy
2004-03-09
2013-04-30
  • Gemmy

    Gemmy - 2004-03-09

    Ok, this is my situation, I have the download, read the instructions, no problem.

    I have php, mysql, and the database name set up -- however, this is where it gets muddied up -- my webhost has to create the database name [which they did] -- but since I don't have access to phpmyadmin, is there a way or a program that I can get that will enable me to import the .db file needed?

    I really want to install phpopenchat on my website, I just need a little help with importing the file -- is it even possible if you have the mysql info and don't have access to phpmyadmin?

    Thanks so much!
    Gemmy

     
    • Anonymous

      Anonymous - 2004-03-09

      Nothing's easier.
      Upload db.schema and create a php file like this (edit the uppercase variables). Then execute it. Don't forget to delete both files at the end.
      <?php

      $upsql = file (db.schema');
      $connection = mysql_connect("SQL_HOST_ADDRESS", "SQL_USERNAME", "SQL_PASSWORD")
      or die("Connection to MySQL failed: " . mysql_error());
      echo ("Connected <br>");
      mysql_select_db ('DATABASE_NAME', $connection)
      or die ("Database not found");
      $uplist='';
      foreach ($upsql as $uprow) {
      if (substr($uprow, 0, 1)!="#") uplist.=trim($uprow);
      }
      $upqueries = explode (';', $uplist);
      foreach ($upqueries as $upquery) {
        $result = mysql_query ($upquery), $connection)
         or echo("Query not valid: " . mysql_error() . "<br>");
      }
      mysql_close ($connection);

      ?>

       
    • Anonymous

      Anonymous - 2004-03-09

      Edit these lines:

      $upsql = file ('db.schema');
      at the beginning and

      $result = mysql_query ($upquery, $connection)
      at the end.

      Sorry for these errors.

       
      • Gemmy

        Gemmy - 2004-03-09

        Hiyaz -- hope you'll tolerate some more questions -- do I need to upload the file to a specific folder or just to the phpopenchat folder?

        I understand upload, understand creating the php file, but how do I execute it?  Just like I do when I install things?

        Thanks so much for answering my questions :-)
        Gemmy

         
      • Gemmy

        Gemmy - 2004-03-09

        I'm a step closer I think LoL

        I did as you told me, uploaded the db.schema to the main phpopenchat folder, along with all the other php files, and creating a file called upload.php [which i'm enclosing here] -- but when i go to http://mysite.com/phpopenchat/upload.php I get an error message...where am I going wrong?

        This is the php file I have:

        <?php

        $upsql = file ('db.schema');
        $connection = mysql_connect('localhost', 'username', 'password')
        or die("Connection to MySQL failed: " . mysql_error());
        echo ("Connected <br>");
        mysql_select_db ('databasename', $connection)
        or die ("Database not found");
        $uplist='';
        foreach ($upsql as $uprow) {
        if (substr($uprow, 0, 1)!="#") uplist.=trim($uprow);
        }
        $upqueries = explode (';', $uplist);
        foreach ($upqueries as $upquery) {
          $result = mysql_query ($upquery, $connection)
           or echo("Query not valid: " . mysql_error() . "<br>");
        }
        mysql_close ($connection);

        ?>

        And this is the error message I'm getting:

        Parse error: parse error, unexpected T_CONCAT_EQUAL in /home/virtual/site63/fst/var/www/html/phpopenchat/upload.php on line 11

        If it would be easier to contact me via e-mail, I'll be glad to give it to you :-)

        Thanks so much for trying to help me!
        Gemmy

         
    • Anonymous

      Anonymous - 2004-03-10

      A simple mistake. Add $ to line 11

      $uplist.=trim($uprow);

       
    • meitak

      meitak - 2004-10-20

      Heyas, just letting you know this helped me a bunch!  However, there is an error with:

      or echo("Query not valid: " . mysql_error() . "<br>");

      I am not sure what it was but I had to take it out.  My final working code looked like tihs: Note: I have some commented out commands that were just to inform me whteher or not it was working. If it's not working for you you can take out the comments to test it.  and also I changed the default database etc to be the name of mine but I set the password back to default "password" so you must change it to be your database password. 

      NOTE: db.schema must be in the same directory as this php file when you execute it!!

      Btw, a huge thanks to crisci for writing this!  I had a huge headache trying to get db imported into my database on windows, as I couldn't figure out how to do it with mysql.

      <?php

      $upsql = file ('db.schema');
      $connection = mysql_connect('localhost', 'phpopenchat', 'password')

      or die("Connection to MySQL failed: " . mysql_error());
      echo ("Connected <br>");
      mysql_select_db ('phpopenchat', $connection)
      or die ("Database not found");
      $uplist='';
      //echo ("worked1<br>");
      foreach ($upsql as $uprow) {
          if (substr($uprow, 0, 1)!="#") $uplist.=trim($uprow);
      //    echo ("worked2<br>");
         
      }

      $upqueries = explode (';', $uplist);

      foreach ($upqueries as $upquery) {
      //print_r( $upquery );
          $result = mysql_query ($upquery, $connection);// remove ; to restore to original
      //    echo ("<br>");
      //    print_r( $result );   
      //    echo ("<br>");
      //    or echo("Query not valid: " . mysql_error() . "<br>");   
      //    echo ("worked3<br>");
      }
      mysql_close ($connection);
      echo ("connection closed");

      ?>

       
    • pmr3

      pmr3 - 2004-10-20

      I am also having a problem at this stage in the installation, importing db.schema.  I tried using the PHP file solution described here, but I'm not sure if it was successful or not...

      After I run my update.php script, the response is simply "Connected".  However, running test.php still shows red (failure) in the section "POC database schema checked".

      I also notice when browsing my MySQL database that there some tables have been created with the "poc_" prefix, when my database is only supposed to use a "db_" prefix.  Is this a problem?  Do I need to create a new database such as "mywebsite_-_com_poc"?  Currently, my hosting plan only allows for one database, which I am already using for a PHP-based forum.  I don't see why I couldn't use the same one for PHPopenchat as long as the table names don't repeat.

      Anyway, as you can all see, I am almost completely oblivious in the areas of MySQL and PHP... I'm just hoping that I can get through this ONE installation so that my hobby website will feature a decent chat fuction.  I greatly appreciate any help and guidance you can give me.  Thanks.

       
    • pmr3

      pmr3 - 2004-10-20

      By the way.. what I really need may just be a more detailed, newbie-friendly walkthrough of the installation.  Usually I can figure out new computer-things myself by reading the documentation, but unfortunately in the case of PHPopenchat, it looks like the majority of support is offered only in German.  If there is another walkthrough of the installation in English that someone can simply refer me to, feel free to do that!

       
    • meitak

      meitak - 2004-10-20

      Okay. I just went thorugh h*** finally getting phpopenchat to install, but it was finally successful.  What type of OS are you using? I may be able to help.  Btw, I found out my problem was the version I was trying to install was wrong, and so the whole importing db schema was moot... when i used the right version I am pretty sure it automatically imported it.

       
    • pmr3

      pmr3 - 2004-10-20

      I'm using Windows XP Pro.. which seems to make the process a lot fuzzier than it would be on linux.  Unfortunately it's all I know.

      I'm trying to install PHPopenchat version 3.0.1, and I have already updated my adodb files to the latest version (4.53) just in case, since many have run into problems with that.

      If it is of use, feel free to view my test.php and install.php (and anything else at my domain you want):
      http://holabuddy.com/phpopenchat/test.php
      http://holabuddy.com/phpopenchat/install.php

      Thanks meitak -- I'm eager to hear from you!

       
    • pmr3

      pmr3 - 2004-10-20

      Phew.. I was able to figure out the installation.

      Now I'm going to see if I can figure out how to administer things as operator.. I don't see anything leading to it.  I expect this to be much less of a headache though  :)

       
    • meitak

      meitak - 2004-10-21

      glad ot hear your install was successful.  with xp i had to install 3.0.0.  It was kindof buggy though and i switched to another chat program.  I like it b/c it's integratable with phpbb:  Here is the link:

      http://www1.sigmachat.com/panel/cp_enhancements/addons/auth_phpBB2.zip

       
    • meitak

      meitak - 2004-10-21

      oh and here's a link to my chat:  I haven't customized it much yet though.  The sucky thing is it's hosted by another website, but it's nice and easy and very user friendly.

      http://katie.gotdns.org/chat.html

       

Log in to post a comment.