PDA

View Full Version : How to insert this PHP line?!?!


WoodiE
07-29-2003, 04:52 AM
Hello, I'm wanting to install a quote script called phpMyQuote (http://www.skintech.org/myquote/index.php) on my forum.

I'd like to display the quotes on the forum home, but I am unsure of how to or where to insert the php code. Below is part of the Readme file:


How to install Random Quote Viewer into your webpage:

1.) The first thing is to edit file quotes.inc.php. You just have to change the line:
$path = "/home/httpd/virtual/temp/myQuotes/";

Just write the right path where config.inc.php exist !

2.) Now open your personal webpage and go to the position where random quote should be displayed. You have to include file quotes.inc.php and then you just call function ShowQuote() which return string with quote:

Example:
include("quotes.inc.php");
echo ShowQuote();

You should also check for the right path in include statement.
If you dont use mysql at your webpage the code should be like this:

Example:
include("quotes.inc.php");
$link = ConnectMysql();
echo ShowQuote();
DisconnectMysql($link);

We have also include example which can be found in file testQuote.php


I know I have the script installed correctly because the testQuote.php displays them just fine, I just don't have a clue on how to get this on my forum home, would anyone care to help me out?


-Michael

Gary King
07-29-2003, 04:48 PM
Open forum/index.php and find:require('./global.php');

Replace withrequire('./global.php');
include("quotes.inc.php");

$showquote=ShowQuote();

Now place $showquote in your forumhome template wherever you want it to show up.

WoodiE
07-29-2003, 08:10 PM
I receive this error when I do the above:

LINE 8:Table 'rcnitro_forum.quotes' doesn't exist

What would cause that?

-Michael

Dean C
07-29-2003, 08:41 PM
You don't have the table in your database :)

Velocd
07-29-2003, 08:44 PM
Perhaps replace:
require('./global.php');
include("quotes.inc.php");

$showquote=ShowQuote();


With:

include("quotes.inc.php");
$showquote=ShowQuote();

require('./global.php');


My only guess is the DB connections are getting interlinked or something. Maybe it is searching for rcnitro_forum on the vBulletin database? Which, of course, is the wrong thing.

Velocd
07-29-2003, 08:46 PM
Oh, or as Mist said, you didn't add the table into your database. ;)

WoodiE
07-29-2003, 08:56 PM
Hmm this script looks so easy, but its kicking my butt right now.

Here is what I have setup for my config.inc.php file:


<?
$host = "localhost";
$username = "rcnitro_quotes";
$password = "************";
$database = "rcnitro_quote";
$mytable = "quotes";
?>


I have already imported/ran or whatever you call it the "dump.sql" and have added two test quotes. The database even shows them as being added. I goto quotes admin panel and I can add, edit, and delete quotes just fine.

So what am I doing wrong?


-Michael


EDIT: One thing I did forget to mention... the quotes script is installed in "public_html/quotes" while the forum is installed on "public_html/forum" if that makes any difference.

Velocd
07-29-2003, 09:29 PM
If config.inc.php is located in that directory, than what you should do is:


require_once('global.php');

chdir('../quotes/');
require_once('config.inc.php');
$showquote=ShowQuote();


I believe..

WoodiE
07-29-2003, 09:54 PM
Done as you suggested and received this error:

Fatal error: Call to undefined function: showquote() in /home/rcnitro/public_html/forum/index.php on line 21

-Michael

Velocd
07-29-2003, 09:56 PM
Sorry, I made you reference to the wrong file ... ^^

Replace:

config.inc.php

With:

quotes.inc.php

;)

WoodiE
07-29-2003, 10:10 PM
Man I'm starting to hate this script... replaced it as you said and I'm back to this error:

LINE 8:Table 'rcnitro_forum.quotes' doesn't exist


:(


-Michael

Gary King
07-30-2003, 01:51 AM
Then you need to create the table for the script.

Isn't there an installer included or something that would create the table for you?

Logician
07-30-2003, 08:44 AM
Instead of integrating an alien script, you can use the quote hack which at the end do the same job.