unserialize help, getting errors


Posted on 16th Feb 2014 07:03 pm by admin

hi all ,
I got a form with 6 fields (2 input and 4 select box), when the page loads one block is shown and through javascript all the fields can be copied multiple times so I need to store the data in array (got hint from here -> http://www.evolt.org/node/60222 ), I manage to save the data but while displaying i get lot of errors

Notice: unserialize() [function.unserialize]: Error at offset 0 of 1 bytes in C:wampwwwartustestme.php on line 67

Notice: unserialize() [function.unserialize]: Error at offset 9 of 10 bytes in C:wampwwwartustestme.php on line 67

this is my php code

Code: <?php
////////////////////////////function defination///////////////////////
function showMonth()
{
$arr=array("January","February","March","April","May","June","July","August","September","October","November","December");
for($i=0;$i<count($arr);$i++)
{
echo "<option value='".$arr[$i]."'>".$arr[$i]."</option>";
}
}
function showYear()
{
$d=getdate();
$curYear=$d['year'];
for($i=$curYear;$i>($curYear-50);$i--)
{
echo "<option value='".$i."'>".$i."</option>";
}
}
// connect to database
define("HOST","localhost");
define("USER","root");
define("PASS","");
define("DATABASE","artuscom");




$con = mysql_connect(HOST,USER,PASS);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db(DATABASE, $con);

// ends here

// start post


if (isset($_POST['submit']))
{
$org = serialize($_POST['curEmpName']);
$des = serialize($_POST['curEmpDesignation']);
$start_month = serialize($_POST['curEmpStartMonth']);
$start_year = serialize($_POST['curEmpStartYear']);
$end_month = serialize($_POST['curEmpEndMonth']);
$end_year = serialize($_POST['curEmpEndYear']);


$query="Insert into artus_test values('','$org','$des','$start_month','$start_year','$end_month','$end_year')";
$result=mysql_query($query);

if ($result) {
echo 'success';
} else { echo 'something failed...';}
}

// show records
if (isset($_POST['showrecord']))
{
$query='SELECT * FROM artus_test';
$result=mysql_query($query);


while($row = mysql_fetch_assoc($result)){
echo "ID: ".unserialize($row['test_id']).", Organization:".unserialize($row['organ']).", Designation:".unserialize($row['design']).", Start-month:".unserialize($row['start_month']).", Start-year:".unserialize($row['start_year']).", End-month:".unserialize($row['end_month']).", End-year:".unserialize($row['end_year'])."<br/>";
}

}
?>
can anyone help please

No comments posted yet

Your Answer:

Login to answer
238 Like 48 Dislike
Previous forums Next forums
Other forums

Cursor statement failed with errors
Following statement failed with the errors.

cursor proj_cursor1 is (select projectID from

Not capturing all the information we require in the form.......
Hi Guys,

I was wondering if you would share some more of your knowledge today, I'm hoping it

While Problem
i am having a problem with a while statement here is the code
Code: [Select]<?php
sess

Question about the upload of large files
Hi there,

I have a question about the upload of large files, like videos (files generally abo

Struct/union and scope problem!
HI all , I have
Code: in header.h typedef struct Node Link; /* ---------

How to implement HTTP connection timeout
Hi All,I would like to implement an HTTP connection timeout.

I am working on a application wh

Multiple upload and Resize
I would like some help on my script I have the for my index.php

////

<html&

simple script won't work. Please help
I'm new to php, and I am having trouble displaying a simple script in my web browser. My php code ex

Need help in Generating Combinations
Need help generating all possible combination of names in an array

Lets say i have the follow

login and redirect
hello! can someone help me.. can you give me an idea.. I want to make a login page and redirects it

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash