Jump to content

serialize() unserialize()


arturo322

Recommended Posts

this was the url

http://localhost/prototype/index.php?go=2

 

This is my actual code but it seems my code does the action twice and not only on if (go=2) statement and, there were no strings inserted on the database

<?php

$who = $_SESSION['who'];

//$sql = "select s.scode,pl.section from subj s,pload pl where pl.scode=s.scode && pl.pid=$who";

$sql = "select s.sname,pl.plid,pl.section from subj s,pload pl where pl.scode=s.scode && pl.pid=$who";

$myquery = mysql_query($sql);

$count_rows = mysql_num_rows($myquery);

for($x=0;$x<$count_rows;$x++){

$fetch_value = mysql_fetch_array($myquery);

//echo "<tr>$fetch_value[scode] - $fetch_value[section]</tr>";

echo "<th><a href=?go=$fetch_value[plid]>$fetch_value[sname] - $fetch_value[section]</a></th>

";

}

?>

<?php

extract($_GET);

if (isset($go)){

$sql = "select s.scode,s.sname,pl.section from subj s,pload pl where pl.scode=s.scode && pl.pid=$who";

$myquery = mysql_query($sql);

$count_rows = mysql_num_rows($myquery);

for($x=0;$x<$count_rows;$x++){

$fetch_value = mysql_fetch_array($myquery);

if ($go = $fetch_value[scode]){

$field[0] = "Student Name";

$field[1] = "fail";

$field_ser = serialize($field);

print_r($field_ser);

//$field_unser = unserialize($field_ser);

//print_r($field_unser);

echo $filed_ser;

$sql = "update pload set classrecfield='$field_ser' where plid='$go' && pid='who'";

mysql_query($sql);

}

}

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.