View previous topic :: View next topic |
Author |
Message |
stevem
Joined: 15 Mar 2003 Posts: 85
|
Posted: Wed Feb 11, 2004 7:47 pm Post subject: |
|
|
I think you are confusing the database with tables. The database will be named bg_somethingorother but the tables inside the database can be called anything you like. The table you are trying to create is called b2categories.
So make sure the database itself has been created. Then inside that database you can run the sql file. Most hosts don't allow you to create databases using sql, but have a special way of doing so via a control panel or similar.
Try copying and pasting the following into phpMyAdmin in the database:
Code: | CREATE TABLE b2categories (
cat_ID int(4) NOT NULL auto_increment,
cat_name tinytext NOT NULL,
KEY cat_ID (cat_ID)
) TYPE=MyISAM; |
then run it - does that work? |
|
Back to top |
|
 |
beachgerl
Joined: 14 Apr 2003 Posts: 37 Location: San Diego
|
Posted: Thu Feb 12, 2004 1:49 am Post subject: |
|
|
Hi again. I appreciate your assistance, stevem! Well, I decided to copy and paste exact error message I received in PHPmyadmin and after trying to run the sql file via query and after modifying the categories to 'b2categories':
Code: |
Error
SQL-query :
--
------------------------------------------------------- --
--
--
CREATE TABLE b2categories(
cat_ID int( 4 ) NOT NULL AUTO_INCREMENT ,
cat_name tinytext NOT NULL ,
KEY cat_ID( cat_ID )
) TYPE = MYISAM
MySQL said:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '---------------------------------------------------------
-- |
When I noticed the mySQL version in this .sql file, it was server version 3.23.58 and my new host is currently operating version 4.0.14. Would that affect anything? Because the error said something about version? There is a ';' after myisam in the sql file. Do I need to update it? I'm not sure what else could be wrong since it's just tables, not database itself, like you said. |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 85
|
Posted: Thu Feb 12, 2004 11:59 am Post subject: |
|
|
I can't believe it's a version problem as MySQL should be backwards compatible. The problem seems to be with the lines of comment. Lines with at -- are regarded as comments.
Try one of the following:
1. remove the comment lines
2. put # at the start of each comment line
3. run the code Code: | CREATE TABLE b2categories (
cat_ID int(4) NOT NULL auto_increment,
cat_name tinytext NOT NULL,
KEY cat_ID (cat_ID)
) TYPE=MyISAM; | on its own and see what happens |
|
Back to top |
|
 |
beachgerl
Joined: 14 Apr 2003 Posts: 37 Location: San Diego
|
Posted: Thu Feb 12, 2004 5:11 pm Post subject: It worked! |
|
|
Thanks very much for your help! You rock! I can't believe it's working now. Now, since I have this part down, am I supposed to upload the b2 files since I can't access to the blog itself? Do I install fresh or what's the next step to set up blog on my site and read my old stuff? Sorry for such simple questions. |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 85
|
Posted: Thu Feb 12, 2004 5:25 pm Post subject: |
|
|
You definitely need to upload the b2 files, being careful to change the relevant details in b2config.php. If you are lucky then you should be able to read and login to your blog without any further installation.
It will help if you are using exactly the same files as on the old site if you made any changes to the standard installation. Do you have access to these files?
If things go wrong you may have to start again by removing all the tables from the database and running b2install.php which will recreate them. Then restore the data in the sql file back to the tables. |
|
Back to top |
|
 |
beachgerl
Joined: 14 Apr 2003 Posts: 37 Location: San Diego
|
Posted: Fri Feb 13, 2004 1:05 am Post subject: |
|
|
Kewl! It all works now, including old posts and b2. No problems so far. You really know your stuff and I'm so glad it's workin' again.
Just one last question...I noticed that the cat IDs are screwed up because I included a '0' as a private category where no one can view the entries. How do I edit the cat IDs in phpmyadmin if that's possible? That way I can set 'private' as '0', not '2' as shown.
EDIT:Never mind! I found out how to do this. I got this down and it's all good. Yay!! b2 is truly a breeze to work with after all of this.
Glad you can put up with my hassles! |
|
Back to top |
|
 |
beachgerl
Joined: 14 Apr 2003 Posts: 37 Location: San Diego
|
Posted: Sat Feb 21, 2004 3:10 pm Post subject: Parse error |
|
|
Hi, I'm using your script once again to backup my journal. This time around I'm using 0.6.2.2 and I received an error that said:
Code: | Parse error: parse error in /home/domain/public_html/blog/b2backup.php on line 19 |
And the script I used in b2backup.php is:
Code: |
1 <?php
2 require_once ('b2config.php');
3 require_once($b2inc."/b2functions.php");
4 dbconnect();
5 get_currentuserinfo();
6
7 if (!($user_login)) exit;
8 if ($user_level!=10) exit;
9
10 $filename = "b2_backup_" . date("y-m-d");
11 header("Content-Disposition: filename=$filename.sql");
12 header("Content-Type: application/force-download");
13
14 $cmd = "/usr/bin/mysqldump -q -u $dbusername -p$dbpassword -h $dbhost $dbname";
15
16 exec($cmd, $sql);
17
18 for($i = 0; $i < count($sql); $i++) {
19 echo $sql[$i] . "\r\n";
20 }
21 ?> |
I'm not sure what's wrong. Parse error on line 19.
I also updated b2menutop.txt file. Any help would be appreciated. |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 85
|
Posted: Sat Feb 21, 2004 4:39 pm Post subject: |
|
|
I can't see any problems in the code, unless there are some strange non-printing characters that have crept in. Try opening the file in a text editor and see if anything looks odd and perhaps carefully retyping lines 18-20 in case something strange has happened.
Also make sure there is nothing before the opening <?php or after the closing ?>.
Another idea, which depends on the operating system you are using. It may be that it objects to "\r\n" for a new line. Try removing \r so that line 19 says: Code: | echo $sql[$i] . "\n"; |
Still no good and desperate? Try replacing \r\n by some unusual characters that can't possibly be used anywhere else in your database then, when the backup file has downloaded, in a text editor replace the unusual characters by a new line. |
|
Back to top |
|
 |
beachgerl
Joined: 14 Apr 2003 Posts: 37 Location: San Diego
|
Posted: Sun Feb 22, 2004 1:38 am Post subject: |
|
|
stevem wrote: | Try opening the file in a text editor and see if anything looks odd and perhaps carefully retyping lines 18-20 in case something strange has happened.
Also make sure there is nothing before the opening <?php or after the closing ?>.
Another idea, which depends on the operating system you are using. It may be that it objects to "\r\n" for a new line. Try removing \r so that line 19 says: Code: | echo $sql[$i] . "\n"; |
Still no good and desperate? Try replacing \r\n by some unusual characters that can't possibly be used anywhere else in your database then, when the backup file has downloaded, in a text editor replace the unusual characters by a new line. |
I followed your directions to the T and the error message I got as a result is:
Code: | Parse error: parse error in /home/domain/public_html/blog/b2backup.php on line 20 |
This applies to 3 different way of doing it ("\r\n", "\n", and unusual characters"). the Line 20 is the "?>" part, not line 19. Weird. Also, menutop.text also doesn't show the backup link either in b2edit.php. I even re-typed everything and still got this same error. I used TextEdit in plain text format. I didn't have that problem with 0.6.2.1 but with newer version it seemed to have a problem for strange reason. Thanks again for your reply. |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 85
|
Posted: Sun Feb 22, 2004 1:15 pm Post subject: |
|
|
I must admit that suggesting replacing "\r\n" was born out of desperation, so not surprised it didn't work
Let's deal with b2menutop.txt first. In the line Code: | 10 b2backup.php Backup | you must use tab and not spaces between 10 and b2backup.php and before Backup.
I wouldn't have thought that the difference between 0.6.2.1 & 0.6.2.2 would have much effect on b2backup.php since the functions it uses are identical. However, do you have 0.6.2.1 still going to test it on?
Perhaps you could send me your copy of b2backup.php to look at to see if it works on my system or if there's an error in it somewhere. If you wish to do this and to keep things secure and private, zip up b2backup.php and put it somewhere on your site away from your blog. Private message me to say where and once I've downloaded it you can delete it. |
|
Back to top |
|
 |
beachgerl
Joined: 14 Apr 2003 Posts: 37 Location: San Diego
|
Posted: Sun Feb 22, 2004 7:39 pm Post subject: Re: Success! |
|
|
I went lengths to fix this. I simply looked for the old b2backup.php file that I originally used on old host. Well, I found it (it was really good thing that I backed up everything on my old server including b2) and I used this old file to upload to both 0.6.2.1 and 0.6.2.2 without modifying anything and it worked! So did the menutop as well. I was able to execute a sql download. It was a big relief. Hah. Stevem, I really appreciate all of your help. Your quick responses did a big difference. |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 85
|
Posted: Sun Feb 22, 2004 7:48 pm Post subject: |
|
|
Great! I'm glad it works. All I can think of is that something strange crept into the new b2backup.php but it doesn't matter any more |
|
Back to top |
|
 |
|