0

Hi, I've tried several of the fixes for this that I've found on here, but I haven't been able to find a work around.

Here is the code that I'm having the trouble with:

mysql_select_db($db_name,$db);
$result = mysql_query("SELECT * FROM pages WHERE pagenumber LIKE $pagenumber ",$db) ;
while ($myrow = mysql_fetch_array($result)) {

This is the error message I get on my site:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /mnt/Target01/327952/328384/www.liquidskin.com/web/content/xcart/templates_c/customer^main^welcome.tpl on line 25

2
Contributors
3
Replies
5
Views
10 Years
Discussion Span
Last Post by dsustaita
0

Sorry, here is the rest of my code:

//Defining Variables
$pagenumber = $myrow["pagenumber"];
$pagename = $myrow["pagename"];
$html_head = $myrow["html_head"];
$html_body = $myrow["html_body"];
$html_foot = $myrow["html_foot"];
$media_link1 = $myrow["media_link1"];
$media_link2 = $myrow["media_link2"];
$media_link3 = $myrow["media_link3"];
$media_link4 = $myrow["media_link4"];
$media_link5 = $myrow["media_link5"];
$media_link6 = $myrow["media_link6"];
$media_link7 = $myrow["media_link7"];
$html_title = $myrow["html_title"];
$bg_color = $myrow["bg_color"];
$bg_image = $myrow["bg_image"];
$style = $myrow["style"];
$text1 = $myrow["text1"];
$text2 = $myrow["text2"];
$text3 = $myrow["text3"];
$text4 = $myrow["text4"];
$text1 = stripslashes($text1);
}
echo $html_head;
echo $text1;
}
 ?>

<p>
<?php if ($this->_tpl_vars['active_modules']['Bestsellers'] != "" && $this->_tpl_vars['config']['Modules']['bestsellers_menu'] != 'Y'): ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include("modules/Bestsellers/bestsellers.tpl", array());
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<?php endif; ?>
0

Hello.

Pay attention to the quotes :

$result = mysql_query("SELECT * FROM pages WHERE pagenumber LIKE '$pagenumber' ",$db) ;

Hint : You don't have to use LIKE if you don't want to use it with pattern. Instead of LIKE here you can use this :

$result = mysql_query("SELECT * FROM pages WHERE pagenumber='$pagenumber' ",$db) ;

- Mitko Kostov

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.