unable to access database in php
<p>I am using the following script for appending the serialized array </p>

<pre><code>mysql_select_db("formdemo", $con);

    $result=mysql_query("select * from rohit where fid='$y'");
    if(mysql_num_rows($result)!=0)
    {
        if($result)
        {
            while($row=mysql_fetch_array($result))
            {
                $n=$row['tags'];

                $a=explode(',', $n);
                print_r($a);
                $cnt=count($a);
                $x=unserialize($row['data']);
                for($i=0;$i&lt;$cnt;$i++)
                {
                    $d=$_GET[$a[$i]];
                    array_push($x,$d);
                }
                array_push($x,"&lt;br/&gt;");
            }
        }
    }
    $str=serialize($x);
    $sql="update rohit set data='$str' where fid='$y'";
    if(!mysql_query($sql,$con))
        die(mysql_error());
    else
        echo "Your data has been updated successfully\n";
</code></pre>

<p>when i am running this for the first time when database is empty, then it is giving an error:
array_push() expects parameter 1 to be array,
and store a value b;0 in database. what should i do in this situation. please help...</p>
