Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Pages: 1 [2]

Author Topic: 1.5.31 text-db  (Read 12952 times)

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
1.5.31 text-db
« Reply #15 on: May 12, 2007, 08:59:24 AM »

Quote from: centered
[url]http://img225.imageshack.us/img225/3341/screenshot1zd2.th.png[/url]

Well as you can see, I got alot farther this time around, I get a snews site coming up.

Again I am stuck on a non-object, yet again.  This time I don't know if I can fix...
         $db = new Database(db('dbname')) or die(db('dberror'));

         $result_articles = $db->executeQuery($query_articles);
         $numrows_articles = $resultSet->getRowCount($result_articles); non-object on this line....Codetwist's if then script showed there is an object, but some rewriting of the line may need to completed first....

http://www.mediafire.com/?cduoiz2bhc5
If anyone wants to try...
You created:
$result_articles = $db->executeQuery($query_articles);

You are trying to use:
$resultSet->getRowCount($result_articles);

Where this $resultSet comes from?
Logged

centered

  • Guest
1.5.31 text-db
« Reply #16 on: May 12, 2007, 01:32:11 PM »

*sips morning coffee*

Ah ha!thanks code!!!

I will try and fix it this morning!
Logged

centered

  • Guest
1.5.31 text-db
« Reply #17 on: May 12, 2007, 02:09:27 PM »

*sigh*
Still get the error
$db = new Database(db('dbname')) or die(db('dberror'));
if (db) {
   echo 'Object created';
}
else {
   echo 'No $db object created';
}

         $result_articles = $db->executeQuery($query_articles);
if (db) {
   echo 'Object created';
}
else {
   echo 'No $db object created';
}
         $numrows_articles = $result_articles->num_rows();  LINE 538

Object created
Php-Txt-Db-Access Error:
SQL Type AND not supported
Object created
( ! ) Fatal error: Call to a member function num_rows() on a non-object in /var/www/snews15c/snews.php on line 538
Logged

centered

  • Guest
1.5.31 text-db
« Reply #18 on: May 12, 2007, 03:05:01 PM »

SO I went back a few lines, Substring is not supported by Text-db
solution:
//$query_articles = $db->executeQuery("UPDATE ".db('prefix')."articles SET published = 1 AND SUBSTRING(position, 1, 1) != '2'");
      $query_articles = $db->executeQuery("UPDATE ".db('prefix')."articles SET published = 1");
      $data = array();
      while ($query_articles->next()) {
         $row = $query_articles->getCurrentValuesAsHas();
         if (substr($row['field'], 1, 1) !== '2') {  
            $data[] = $row;
            }
      }

Guess what?  
Call to a member function next() on a non-object...

About the above error in the previous two posts: Gobo from the text-db forums gave me this:
Quote
You can get the number of rows in a resultset by executing getRowCount() on that object. Which directly connects to the last question: $query_articles is the object or resultset returned by $db->executeQuery(...). This is the one where you use getRowCount: $query_articles->getRowCount(). But keep in mind that we are working with an object here, not a query string! So you cannot simply add your AND clause as $query_articles is no string! As a result, $query_articles only contains the AND clause you intended to add and " AND category = $use_cat_id" is no valid SQL statement.
Looks like more work to be done...
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
1.5.31 text-db
« Reply #19 on: May 12, 2007, 10:22:53 PM »

If Your code really contains  
Code: [Select]
if (db) {
   echo 'Object created';
}
else {
   echo 'No $db object created';
}
then you aren't checking $db object at all. This if (db) is interpreted as if ('db') by PHP.
RTM.
Over.
Logged

centered

  • Guest
1.5.31 text-db
« Reply #20 on: May 13, 2007, 07:50:54 AM »

Code you are probably more right than you know.  This project may have been more than I can handle with my present skill.

Thanks for everyone's help anyway!
Logged

centered

  • Guest
1.5.31 text-db
« Reply #21 on: May 16, 2007, 07:08:38 PM »

Well a little bug told me to continue with the script with 1.6....

Almost there I hope....
Logged

centered

  • Guest
1.5.31 text-db
« Reply #22 on: May 21, 2007, 03:33:51 PM »

Just to update... if anyone is looking...

I have a semi working script.  I need to to translate a few SUBSTRING lines that I found out from Gobo (from the text-db forums) doesn't work with Text-db.  I also need to debug the script for errors.  I have a bug with the categories function.  It current shows Home then Home(0).  I have to see what is going on there...

Otherwise, I hope I can release something in the next 2 weeks. Hopefully...
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
1.5.31 text-db
« Reply #23 on: May 21, 2007, 04:01:40 PM »

Quote from: centered
Just to update... if anyone is looking... I hope I can release something in the next 2 weeks. Hopefully...
Some of us are watching this thread for updates. Good to hear that progress continues. I hope you are keeping track of your changes throughout snews.php with comments. Once you have it de-bugged and running smoothly, you can then use your 1.5.31 as a reference in doing the same with 1.6. I have a 1.6. snews.php file that has comments showing where the changes are made in 1.6 over 1.5.31, and you/we could use that as the starter-file for 1.6 txt.db version. Several functions are the same, some have minor changes, and a few are signicantly changed... but database queries are done the same way and are pretty much in the same locations & functions from file-to-file.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

centered

  • Guest
1.5.31 text-db
« Reply #24 on: May 21, 2007, 07:59:50 PM »

This will be a 1.6 text-db version, since the code is (seems to be) relatively the same

I made a mistake by mixing 1.5 code with 1.6 since I changed to 1.6 immediatly after release.  I need to fix all the problems then clean up all the code and add commenting to each section.  I owe a big thanks to Dobey and Gobo (from the text-db forums), I would have never figured out certain things without them.

Maintaining the release and bug fixes will take awhile because of my experience...


does the 1.6 version have the code commented for the changes between 1.5 and 1.6?  I don't think i noticed that....
Logged

centered

  • Guest
1.5.31 text-db
« Reply #25 on: May 22, 2007, 08:10:19 AM »

I am working on the script tonight.  I have a few problems that I need to get around.

1. Substring, as mentioned before text-db does not support SUBSTRING, so I did a work around based on Gobo's code.  Well the query failed in one the most important part...

2. Search, sort of broken because of the above problem.  I can search normal text and get a result, but I think searching through articles one would get the error if the above is not fixed.  But wait...

3. New Article/Extra Content.  Well I can't search a site if I have no content right?  I have everything but the damn Submit button on both these functions...

4. Pages.  So I thought to myself, 1.4 didn't have pages.  It was a good feature added to 1.5,1.6.  It works... to a point.  I can successfully add a page with content and have it show up under the admin screen to view/edit.  When i try and view the page, I get a 404.   I can gather the page is not being called correctly or at all by the script... When I view the database (it's a text document, why not?!?!) The article was added...

So my trek continues on...

Oh and I still can't find why 2 home's (Home, Home(0) ) are displaying under categories....
Logged

centered

  • Guest
1.5.31 text-db
« Reply #26 on: May 23, 2007, 06:54:34 AM »

Time to go to sleep, big meeting with the VP in the morning   :D

Got alot done, and i think i messed up ALOT...

Substring problem is sort of fixed, but I messed up the sitemap and search engine functions...  Fixing one leads to another problem...

Maybe its late...
Logged
Pages: 1 [2]