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);

}

}

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.