Page 1 of 2

Works on Home server Doesn`t work on Real Server

Posted: Tue Feb 24, 2004 5:00 am
by doggy
I made a script for a site and it works on my home pc but on my remote server it give me errors why is that.

Code: Select all

<?php
$DB = new DB;				
$DB->sql = "SELECT * FROM Menu";                                                                                                  
$DB->result = mysql_query($DB->sql);                                                                                               
while($DB->row = mysql_fetch_array($DB->result)) {
$sid = $DB->row[sid];
$title = $DB->row[title];
$link = $DB->row[slink];
echo "<tr><td width="24" height="19" valign="top"><img src="themes/blue/images/menu-side.gif" width="24" height="19"></td>
<td width="70%" valign="top"><a href="index.php?p=$link">$title</a> <a href="admin.php?func=edit&sid=$sid">!</a> <a href="admin.php?func=del&sid=$sid">*</td></tr>";
}
?>
and it gives me this Error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/atlas/domains/atlaspharm.za.net/public_html/themes/blue/theme.php on line 67

Posted: Tue Feb 24, 2004 5:51 am
by Straterra
That script isn't 67 lines long. Post the whole code.

Posted: Tue Feb 24, 2004 6:54 am
by doggy

Code: Select all

<?php

/************************************************************************/
/* This system is copy righted to atlas pharmacy                        */
/* ==================================================================== */
/*                                                                      */
/* copyright (c) 2004 by stefan vorster                                 */
/* http://www.atlaspharm.co.za                                          */
/*                                                                      */
/* this program is may not be changed or rewrited with out              */
/* stefan vorster saying so                                             */
/************************************************************************/

$bgcolor1 = "#EAEFFF";
$bgcolor2 = "#EAEFFF";
$bgcolor3 = "#D3DDFE";
$bgcolor4 = "#5076FA";
$textcolor1 = "#3C3CFF";
$textcolor2 = "#3C3CFF";

function OpenTable() {
    global $bgcolor3, $bgcolor4;
    echo "<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="$bgcolor4"><tr><td>\n";
    echo "<table width="100%" border="0" cellspacing="1" cellpadding="8" bgcolor="$bgcolor3"><tr><td>\n";
}

function CloseTable() {
    echo "</td></tr></table></td></tr></table>\n";
}

function themeheader($title) {
echo "<head>
<title>[ Atlas Pharmacy ] - [ $title ]</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>";
}


function themebody() {
echo "<body background="themes/blue/images/spacer.gif" text="#4183FC" link="#4183FC" vlink="#4183FC" alink="#4183FC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="80" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="themes/blue/images/header-spacer.gif">
        <!--DWLayoutTable-->
        <tr> 
          <td width="48" height="80">&nbsp;</td>
          <td width="754" valign="top"><img src="themes/blue/images/logo.gif" width="162" height="80"></td>
        </tr>
      </table></td>
  </tr>
  <tr> 
    <td width="100%" height="19">&nbsp;</td>
    <td width="1">&nbsp;</td>
  </tr>
  <tr> 
    <td height="242" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="138" height="22">&nbsp;</td>
          <td width="34">&nbsp;</td>
          <td width="616">&nbsp;</td>
        </tr>
        <tr> 
          <td rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">";
$DB = new DB;				
$DB->sql = "SELECT * FROM Menu";                                                                                                  
$DB->result = mysql_query($DB->sql);                                                                                               
while($DB->row = mysql_fetch_array($DB->result)) {
$sid = $DB->row[sid];
$title = $DB->row[title];
$link = $DB->row[slink];
echo "<tr><td width="24" height="19" valign="top"><img src="themes/blue/images/menu-side.gif" width="24" height="19"></td>
<td width="70%" valign="top"><a href="index.php?p=$link">$title</a> <a href="admin.php?func=edit&sid=$sid">!</a> <a href="admin.php?func=del&sid=$sid">*</td></tr>";
}
echo "</table></td>
          <td height="20">&nbsp;</td>
          <td valign="top"><table width="80%" border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td width="80%" height="20" valign="top">";
}
				
function themefooter() {
echo "</td>
              </tr>
            </table></td>
        </tr>
        <tr> 
          <td height="20">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr> 
          <td height="19" colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="themes/blue/images/footmsgcen.gif">
              <!--DWLayoutTable-->
              <tr> 
                <td width="24" height="19" valign="top"><img src="themes/blue/images/footmsglight.gif" width="24" height="19"></td>
                <td width="946" valign="top"><div align="center">Designed and 
                    Developed by <a href="mailto:atlas@serv.co.za">Atlas Pharmacy</a></div></td>
                <td width="24" valign="top"><img src="themes/blue/images/footmsgright.gif" width="24" height="19"></td>
              </tr>
            </table></td>
        </tr>
      </table></td>
    <td>&nbsp;</td>
  </tr>
</table>";
}

?>

Posted: Tue Feb 24, 2004 10:24 am
by AVATAr
are you shure that

$DB->sql = "SELECT * FROM Menu";

is returning something?

Posted: Tue Feb 24, 2004 11:08 pm
by doggy
On my home server it works with out any errors or any thing. It is just on my web server that i have that it doesn`t work. Now how does that work that it works on one computer and then on a other one it doesn`t work. :s

Posted: Tue Feb 24, 2004 11:29 pm
by markl999
Try changing $DB->result = mysql_query($DB->sql); to
$DB->result = mysql_query($DB->sql) or die(mysql_error());

and see if it outputs any errors. I'd also add the mysql_error() to wherever mysql_connect() is used (in the DB class), i'll bet it's just your mysql username and/or password is incorrect.

Posted: Tue Feb 24, 2004 11:49 pm
by doggy
Thanks dude. All it was was.
$DB->sql = "SELECT * FROM Menu";

And in the db the table is called menu not Menu.

Thanks every one for helping me

Posted: Tue Feb 24, 2004 11:58 pm
by doggy
I have includes files. They work on my home server but not on my web server ... now why is that i wonder.

Warning: adminadd(admin/editor.php): failed to open stream: No such file or directory in /home/atlas/domains/atlaspharm.za.net/public_html/admin.php on line 17

Warning: adminadd(): Failed opening 'admin/editor.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/atlas/domains/atlaspharm.za.net/public_html/admin.php on line 17

Posted: Wed Feb 25, 2004 12:12 am
by doggy
This is giving me that error.

Code: Select all

<?php
function editer($title, $valuetext, $valuecontent) {
themeheader("$title");
themebody();
echo "<body onLoad="DoInitEdit(divContent.innerHTML);">"
    ."<link href='admin/Includes/Style.Editor.css' rel='stylesheet' type='text/css'>"
	."<script language="JavaScript" src="admin/Includes/Script.Editor.js" type="text/javascript"></script>"
	."<div id="divContent" name="divContent" style="position:absolute;top:-1000;left:-1000;">"
    ."$valuecontent</div>"
	."<form name="frmEditor" method="post">"
	."<table><tr><td class="bar">Title</td><td><input name="txtTitle" id="txtTitle" type="text" size="40" value="$valuetext"></td></tr>"
	."<tr><td class="bar">Content</td><td><input id="txtContent" name="txtContent" style="position:absolute;top:-1000;left:-1000;">";
	include("admin/editor.php");
echo "</td></tr>"
	."<input type="hidden" name="op" id="op" value="$title">"
	."<tr><td></td><td><input type="submit" value="$title" onclick="txtContent.value = objEditor.document.body.innerHTML"></td></tr>"
	."</table></form>";
themefooter();
}

?>
[google]php include [/google]

Posted: Thu Feb 26, 2004 6:36 am
by doggy
Could some one please help me out. PLEASE

Posted: Thu Feb 26, 2004 6:40 am
by AVATAr
what is adminadd(admin/editor.php)?

show us admin.php on line 17 ...

Posted: Thu Feb 26, 2004 6:57 am
by doggy
include("admin/editor.php");

Posted: Thu Feb 26, 2004 7:03 am
by AVATAr
the file editor.php inst in the dir admin/
try using: is_file

Posted: Thu Feb 26, 2004 7:27 am
by Illusionist
is the server your running at home not real?

Posted: Thu Feb 26, 2004 7:28 am
by doggy
it is real but its a windows server... just running apache for windows