PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
xGSTQ
Involved
Involved


Joined: Feb 03, 2006
Posts: 267
Location: UK

PostPosted: Fri Jan 22, 2010 9:36 am Reply with quote Back to top

ok so im converting an Evo module to work on RN

Its RottNAudio module

Ive not asked the owner of the module (RottNKorpse) because I have looked though is forum support section and he states PHPNuke is dead and this module will only work on Evo and Evo Extreme.. and that he has no intention to convert it any other distro.

However once I do get it all working okay, I will email him a asking for permission to release it to the RN community.

Anyway's that to one side, I got it working on Ravens Nuke, but with one small problem I just cant sort.

What I am stuck on is calling the Database from a database.php file that is included in a playlist.php file

The Evo database.php file is simply

Code:
include('../../config.php');
$dbcnx = mysql_connect("$dbhost","$dbuname","$dbpass");
$dbselect = mysql_select_db("$dbname");
if ((!$dbcnx) || (!$dbselect)) { echo "Can't connect to database"; }


And it calls the DB fine and works no problem

However to get the same thing working in RN I have to change the above code to
Code:
$dbhost = '******';
$dbuname = '******';
$dbpass = '******';
$dbname = '******';
$prefix = '******';
$dbcnx = mysql_connect("$dbhost","$dbuname","$dbpass");
$dbselect = mysql_select_db("$dbname");
if ((!$dbcnx) || (!$dbselect)) { echo "Can't connect to database"; }


that connects and it all works fine...

Basicly is there an easier way to do it so users don't have to input the DB details into the database.php file it uses ??

I tried to bypass the database.php by using the below code but that didn't work either

Code:
require_once ('mainfile.php');
global $db, $prefix;

$result = $db->sql_query("SELECT * FROM ".$prefix."_rottnaudio_config");
$song_order_sql = $db->sql_fetchrow($result);
$song_order = $song_order_sql['song_order'];
$playlist_sql = $db->sql_query("SELECT * FROM ".$prefix."_rottnaudio_songs ORDER BY ".$song_order." ASC") or die('Query failed: ' . mysql_error());


Any help or advice please
View user's profile Send private message Send e-mail Visit poster's website
Palbin
Site Admin


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

PostPosted: Fri Jan 22, 2010 4:05 pm Reply with quote Back to top

Code:

require_once ('mainfile.php');
global $db, $prefix;

$result = $db->sql_query("SELECT * FROM ".$prefix."_rottnaudio_config");
$song_order_sql = $db->sql_fetchrow($result);
$song_order = $song_order_sql['song_order'];
$playlist_sql = $db->sql_query("SELECT * FROM ".$prefix."_rottnaudio_songs ORDER BY ".$song_order." ASC") or die('Query failed: ' . mysql_error());


The above should work. There has to be some details you are not mentioning. If you wnat to send it to me I can take a look at it, but if it is a module and you are doing the above it should work fine.
View user's profile Send private message
xGSTQ
Involved
Involved


Joined: Feb 03, 2006
Posts: 267
Location: UK

PostPosted: Fri Jan 22, 2010 4:55 pm Reply with quote Back to top

Ill pack it up in the morning and PM u a link m8, its baffled me... probably something really simple and daft that ive just over looked.

Thanks
View user's profile Send private message Send e-mail Visit poster's website
eldorado
Involved
Involved


Joined: Sep 10, 2008
Posts: 414
Location: France,Translator

PostPosted: Fri Jan 22, 2010 8:40 pm Reply with quote Back to top

Weird lol , Palbin's technique here is the best to call DB without config.

Didn't you say it didn't work by directly calling config.php?
View user's profile Send private message Visit poster's website MSN Messenger
Palbin
Site Admin


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

PostPosted: Fri Jan 22, 2010 8:50 pm Reply with quote Back to top

I have emailed the corrected files to xGSTQ. All that was needed was to define INCLUDE_PATH in database.php.
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum