?
Solved

Myphpnuke and Gallery

Posted on 2003-03-14
4
Medium Priority
?
259 Views
Last Modified: 2006-11-17
I am trying to integrate Myphpnuke (www.myphpnuke.com) with Gallery (http://gallery.sourceforge.net).

I tried the small tutorial here: www.myphpnuke.com/viewtopic.php?topic=2702&forum=32&start=0 to try and integrate Gallery with MPN. I noticed that I could not complete the last step of that tutorial because my database.php file does not have a "$this->tablePrefix" line in it. Now when I try to run gallery I can see gallery, but I get this error:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/virtual/site2/fst/var/www/html/modules/gallery/classes/database/mysql/Database.php on line 35


line 35 from that file is: "$row = mysql_fetch_row($results);"
and here is the entire contents of my database.php file:


<?php
class MySQL_Database extends Abstract_Database {
var $link;

function MySQL_Database($host, $uname, $pass, $dbname) {
$this->link = mysql_connect($host, $uname, $pass);
mysql_select_db($dbname, $this->link);
}

function query($sql) {
return mysql_query($sql, $this->link);
}

function fetch_row($results) {
$row = mysql_fetch_row($results);
return $row;
}
}
?>

does anyone have any idea what this could be? I feel like I am very close to getting this working. BTW, this is gallery 1.3.3 and mpn 1.8.8



0
Comment
Question by:B3AND1P
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 15

Accepted Solution

by:
VGR earned 1000 total points
ID: 8139567
yes, trivial : this error is because the mysql_query did not return any results (either failed or result set is empty).
You should always add "or die("bad query $query : ".mysql_error())" at the end of commands mysql_query($query)

The same for connect.

I would write this :
<?php
class MySQL_Database extends Abstract_Database {
var $link;

function MySQL_Database($host, $uname, $pass, $dbname) {
$this->link = mysql_connect($host, $uname, $pass) or die("bad connect"); // or set the return value to FALSE and test on exit !!!
mysql_select_db($dbname, $this->link) or die ("bad select db");
// return TRUE; if you chose not to die on error
}

function query($sql) {
mysql_query($sql, $this->link) or die("bad query $sql ".mysql_error());
return TRUE;
}

// CAN ONLY BE CALLED IF $results IS VALID !!!
function fetch_row($results) {
$row = mysql_fetch_row($results);
return $row;
}
}
?>


0
 
LVL 3

Assisted Solution

by:jayrod
jayrod earned 1000 total points
ID: 8158790
It probably didn't return a result because the table prefix is incorrect. In the article the person that used coded the module had to hard code the PN table prefix. Check this value against what you have in your PN database.

by default I believe it's nuke_
0
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 11934645
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    Split: VGR {http:#8139567} & jayrod {http:#8158790}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

snoyes_jw
EE Cleanup Volunteer
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question