Question : SQL Syntax error due to empty table or PHP version?

Hello, I'm switching host environments. This site was once working on the previous host but now is not. the site is throwing the following error.:

Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in /var/www/vhosts/growexperts.com/httpdocs/_featured_stories.php on line 28
SELECT * FROM story WHERE story_id IN ()
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 3

is this because there is no data in the story_id column?
Code Snippet:
"; while($row_featstory = mysql_fetch_array($res_featstory)){ $sidx=hide($row_featstory['story_id']); echo " "; } echo "
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:

		
Featured Stories
$row_featstory[story_title] [more]
"; } else { echo sql_err($sql_featstory); } ?>

Open in New Window Select All

Answer : SQL Syntax error due to empty table or PHP version?

When $query_str  is null then you need to use something like
SELECT * FROM story WHERE story_id IS NULL
not
SELECT * FROM story WHERE story_id IN ()
Random Solutions  
 
programming4us programming4us