Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Seeking applications ...
Author Message
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Tue Jan 13, 2009 5:46 pm Reply with quote

jakec, Looks good to me :clap:

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
gator81
Worker
Worker



Joined: Jun 09, 2007
Posts: 172

PostPosted: Tue Jan 13, 2009 7:31 pm Reply with quote

Ty jakec, that did it, it is working now Smile

I will try to see what you did beyond the original so i can understand why I was getting the 500 error.

again, ty very much for the hard work.
 
View user's profile Send private message
gator81







PostPosted: Tue Jan 13, 2009 8:21 pm Reply with quote

This is working great, and if you dont mind, i would like to ask another question......Smile

could this be used in more then just a module and or block?

Now I am not wanting to push my luck Smile but if I dont ask then I dont know. But could the quotes be added to like a content post? or placed in the header or like the bar you see at the header, like where you have "home,downloads,forums".

This is not a have to thing, but a question to see if it could be done without alot of problems.

thanks for the input
 
jakec
Site Admin



Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom

PostPosted: Wed Jan 14, 2009 1:35 am Reply with quote

I've just changed the SQL queries to suit the new layer, so these should not have been causing an error 500.

There is no reason why these couldn't be added to the header, but it would require a hack of the theme.
 
View user's profile Send private message
gator81







PostPosted: Wed Jan 14, 2009 2:10 am Reply with quote

jakec, you have been a great help, and If i am being to much of a pest please let me know...What you have done has helped me a lot already. Since you have the whole program, you should either add your name to the copyrite or with your skill you could probally improve on it and release one on your own Smile

My other question about putting the quote other places on the site, would I need to basically use all the code that would be in the block-Quotes.php file? and try to get it to load in the certian areas?

I am a trial and error person, so I ask alot of questions, I just try to be carefull not to abuse the help that I am getting.
 
jakec







PostPosted: Wed Jan 14, 2009 7:46 am Reply with quote

I'll need to have a look at the code tonight, but be under no illusion than I am an expert, I am very much a trial and error person like you. Wink

I am not too bothered about the copyright, the changes I made were minor and the module could probably do with a security check by one of the experts here. I am not saying that there is a problem, but I am not the person to say either way.
 
gator81







PostPosted: Wed Jan 14, 2009 2:09 pm Reply with quote

I thank you for being humble, to me your trial and error are on such a higher level then myself. I would be happy just to have your level of skill, I would be someone then Smile
Again, ty for your help and time you are putting into this.
 
jakec







PostPosted: Wed Jan 14, 2009 4:31 pm Reply with quote

It's definitely possible to add the quotes to your header, but it would require some hacking of the theme you are using. I'm not a theme expert either, but some themes display the latest downloads, or web links in the footer and the principle is the same, just querying a different table in the database.

No problem, for some reason I've always enjoyed helping people. Very Happy
 
Palbin







PostPosted: Wed Jan 14, 2009 5:01 pm Reply with quote

This is the code that you need to insert in the given area. Now if you need to add a row or column to a table via html you would need to add that code, but if you are just entering it into an existing cell that this could should be fine. It is possible you could run into a conflict with the variables used in the sql statements, but probably not.

Code:


mt_srand((double)microtime()*1000000);

$quotesql = "SELECT COUNT(qid) FROM ".$prefix."_quotes";
$result = $db->sql_query($quotesql);

if ($result)
{
   list($count) = $db->sql_fetchrow($result);
}
else
{
   $count = 0;
}

if ($count < 1)
{
   $content .= "There aren't enough quotes in the database right now.";
}
else
{
   $index = 1;
   if ($count > 1)
   {
      $index = mt_rand(0, ($count - 1));
   }

   $quotesql = "SELECT quote, author FROM ".$prefix."_quotes ORDER BY qid LIMIT " . sprintf("%d", ($index - 1)) . ", 1";
        $result = $db->sql_query($quotesql);

   if ($result)
   {
      list($quote, $author) = $db->sql_fetchrow($result);
       
      $content .= "<b>" . $quote . "</b>";
      if ($author != "")
      {
         $content .= "<br><br>";
         $content .= "-- " . $author;
      }
   }
   else
   {
      $content .= "A database error has occurred.";
   }
}
 
Palbin







PostPosted: Wed Jan 14, 2009 5:02 pm Reply with quote

if you want to make this block xhtml compliant you need to change all the <br> tags to <br /> tags. Not a must, but just an option.
 
gator81







PostPosted: Thu Jan 15, 2009 1:17 am Reply with quote

as time permits i will see what iit will do thanks
 
jakec







PostPosted: Thu Jan 15, 2009 1:23 am Reply with quote

Good point Palbin, I should of checked for compliancy when I changed the DB layer. Doh
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Seeking applications ...

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©