Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Krika News


DMXaudio

Recommended Posts

Krika News error in edit news

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/soluco00/public_html/loja/admin/edit_news.php on line 74

 

My edit_news.php

 

<?php
/*
 $Id: edit_news.php,v1.0 2004/05/10 22:50:51 

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');


?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	  <td valign="top"> 

		<table width="98%" border="3" cellspacing="0" cellpadding="0" bordercolor="#999999" align="left">
		  <tr> 
			<td align="center" valign="top">
			  <table width="100%" border="1" cellspacing="3" cellpadding="3" class="dataTableContent">
				<tr>
				  <td class="dataTableRow"> 
					<div align="left">Krika news v1.0 by Fco Martin de la 
					  Sierra Hz.<br>

				 <?php echo TEXT_HEADING_CONTENT; ?>

					   </div>
				  </td>
				</tr>
			  </table>
			  <br>
			  <?php
/*------------------------------------------------*/

$conectar = mysql_connect(DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD) or die(ERROR_DB);
$consulta="select name from languages";
$query=mysql_query($consulta,$conectar);

$num_filas=mysql_num_rows($query);
echo '<br>';



$i=0;
while ($i < $num_filas) {
$result1[$i]=mysql_result($query,$i);
echo "<b>" . $result1[$i] . "</b>";
include("form_noticia.php");
$i++;
echo "<br><br>";
}


/*---------------------------------------------------*/
?>
			</td>
		  </tr>
		</table>
		<p align="center"> </p>
		<p> </p>
		<p> </p>
	  </td>
  </tr>
</table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

Line 70 - 76

 

$conectar = mysql_connect(DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD) or die(ERROR_DB);
$consulta="select name from languages";
$query=mysql_query($consulta,$conectar);

$num_filas=mysql_num_rows($query);
echo '<br>';

 

 

Tanks for help

Link to comment
Share on other sites

  • 4 weeks later...

I believe the problem is caused because this code tries tor re-connect to the database.

 

change this:

 

/*------------------------------------------------*/

$conectar = mysql_connect(DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD) or die(ERROR_DB);
$consulta="select name from languages";
$query=mysql_query($consulta,$conectar);

$num_filas=mysql_num_rows($query);
echo '<br>';



$i=0;
while ($i < $num_filas) {
$result1[$i]=mysql_result($query,$i);
echo "<b>" . $result1[$i] . "</b>";
include("form_noticia.php");
$i++;
echo "<br><br>";
}


/*---------------------------------------------------*/

 

to:

 

/*------------------------------------------------*/
$consulta="select name from languages";
$query=tep_db_query($consulta);

$num_filas=tep_db_num_rows($query);
echo '<br>';



$i=0;
while ($i < $num_filas) {
$result1[$i]=tep_db_fetch_array($query);
echo "<b>" . $result1[$i] . "</b>";
include("form_noticia.php");
$i++;
echo "<br><br>";
}


/*---------------------------------------------------*/

 

haven't tested anything though.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...