Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Warning: in_array() [function.in-array]: Wrong datatype for second argument in C:\AppServ\www\library\templates\nav_right.tpl.php on line 62

Posted on 2009-06-29
3
Medium Priority
?
319 Views
Last Modified: 2012-08-13
Hello Experts,
   I try to code php program for recently view items. and it can show the last items that user watched, but when i load this page the first time it will show error message as followed:

Warning: in_array() [function.in-array]: Wrong datatype for second argument in C:\AppServ\www\library\templates\nav_right.tpl.php on line 62

I attached code. Please help me... Many thanks in advance.
<?
$gal_item_id=$_GET['gal_item_id'];
 
// insert codes to retrive title from gal_item_id
		$conn_mysql->db_connect(DB_SERVER_HOST, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_SERVER_DATABASE);
		# Mode SQL Command : Select data in condition
		$sql = " SELECT * from gallery_item where gal_item_id='$gal_item_id' ";
 
		$res['select_item'] = $conn_mysql->query($sql);		
		# Loop data in to variable : Fetch a result row as an associative array
		$arr['detail_item'] = $conn_mysql->fetch_row($res['select_item']);
			# Define variable for use easy
			$gal_item_title = $arr['detail_item']['gal_item_title'];
 
 
?>
 
<?
   $item_link="<a href='?module=gallery&action=info_item&gal_item_id=$gal_item_id'>$gal_item_title</a>";
 
if (! in_array($item_link, $_SESSION['articles']))
$_SESSION['articles'][] = "$item_link";
// Output list of requested articles
 
 
 
 
echo "<ul>";
foreach($_SESSION['articles'] as $doc) echo "<li>$doc</li>";
//echo "<p>$gal_item_title</p></p>";
echo "</ul>";
 
 
 
?>

Open in new window

0
Comment
Question by:dsuthany
[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
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
szewkam earned 2000 total points
ID: 24735316
warning shows because for the first time you don't have declared $_SESSION['articles'] array. To avoid it put at the beginning:
if (!isset($_SESSION['articles'])) $_SESSION['articles'] = array();
0
 

Author Comment

by:dsuthany
ID: 24738590
Many thanks szewkam ;-) Now i can slove the problem..Yahoo
0
 

Author Closing Comment

by:dsuthany
ID: 31597870
I can slove the problem now. Thank you very much
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

604 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