Current location: Hot Scripts Forums » Programming Languages » PHP » PHP broken??


PHP broken??

Reply
  #1 (permalink)  
Old 09-04-05, 07:34 AM
zoic zoic is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
PHP broken??

I've made my own forum system for my site and in this upcoming version of my site I've finally added the feature that makes it so when there's a new post and you view the post it's no longer considered new from there on out. BUT, my problem is this, it works locally on my computer but not on the actual server for my website.

The way that I'm going about this is by 2 session variables which are actually array's, "new_posts" and "read_posts". The first contains the post id's of the posts that are considered new and the second contains the post id's of when you read a new post. To test to see if a forum has new posts in it I use the in_array() function which requires 2 arguments and returns a boolean value (true or false). The first one is what you are looking for in the array and the second one is the actual array your looking in.

I get the following error on the server:


Warning: in_array(): Wrong datatype for second argument in /home/kryptek/public_html/forum.php on line 89


The PHP Version of my computer is 4.2.3 and the PHP version of my host server is 4.3.10. If anyone could help me out I would greatly appreciate it, I want to get my new version of my site up by monday so I'm kind of running short on time now and this problem just came up
__________________
Zoic
"There's no place like 127.0.0.1"
KrypTek.org
Reply With Quote
  #2 (permalink)  
Old 09-04-05, 08:28 AM
khine khine is offline
New Member
 
Join Date: Sep 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb

Quote:
I get the following error on the server:


Warning: in_array(): Wrong datatype for second argument in /home/kryptek/public_html/forum.php on line 89
Can you put your forum.php code here... so that we can find the error and analyse.

all the best,

khine.
Reply With Quote
  #3 (permalink)  
Old 09-04-05, 08:31 AM
zoic zoic is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Sometimes, you might want to search values in array, that does not exist. In this case php will display nasty warning:
Wrong datatype for second argument in call to in_array() .

In this case, add a simple statement before the in_array function:

if (sizeof($arr_to_searchin) == 0 || !in_array($value, $arr_to_searchin)) { ... }

In this case, the 1st statement will return true, omitting the 2nd one.
I found that on PHP.net and so I'm messing with that a bit, I've gotten rid of the errors now I just need to get it to a point where it will work how I want it to.
__________________
Zoic
"There's no place like 127.0.0.1"
KrypTek.org
Reply With Quote
  #4 (permalink)  
Old 09-04-05, 08:36 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
could you show the line 89 and where the variables being passed to it assigned?
edit: ok, now I see
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]

Last edited by NeverMind; 09-04-05 at 08:38 AM.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 profitable script sites for sale cms-master.com General Advertisements 3 07-03-07 10:17 AM
PHP Downside--Solutions? Amulet PHP 10 07-15-05 08:26 AM
PHP multi-dimensional array sorting issue aqw PHP 2 06-24-05 11:09 PM
PHP / Graphic Developers someotherguy582 Job Offers & Assistance 1 06-05-05 07:40 PM
100 Web Templates & 10 PHP Scripts for sale! HostersUK.co.uk General Advertisements 0 01-10-04 12:31 AM


All times are GMT -5. The time now is 06:12 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.