kate_rose Posted June 22, 2008 Share Posted June 22, 2008 I have a very long string in a mysql database & I am trying to recall it and unserialize it back into the original array. Just to be sure I am getting the correct string I echo it. It says 'Resource id #4'. When I looked this up it seems that that is what you get if the variable you are trying to echo is an array. I don't think it should be an array yet since I haven't unserialized it. The unserialize function isn't creating the array either so I get nothing when I try to look at that with a 'print_r'. I am sure its something simple since this is the first time I have done this but I don't see it. I thought perhaps the string was too big but then it wouldn't have fit in the original variable when I serialized it for storage. Here is the code: <?php include ("functions.php"); connectto_guana_plants (); $picstorage = array (); $query = "SELECT serialized FROM serialized_data WHERE title = 'picstorage'"; $result = mysql_query($query) OR die(mysql_error()); echo $result; $picstorage = unserialize($result); print_r ($picstorage); ?> I just reran it & I am getting an error which is: Warning: unserialize() expects parameter 1 to be string, resource given in C:\wamp\www\Guana_Plant_Key\browser.php on line 16 I guess somehow $result is not a string?? Thanks, Kate Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/ Share on other sites More sharing options...
sasa Posted June 22, 2008 Share Posted June 22, 2008 try <?php include ("functions.php"); connectto_guana_plants (); $picstorage = array (); $query = "SELECT serialized FROM serialized_data WHERE title = 'picstorage'"; $result = mysql_query($query) OR die(mysql_error()); $data = mysql_result($result,0); echo $data; $picstorage = unserialize($data); print_r ($picstorage); ?> Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-571621 Share on other sites More sharing options...
DarkWater Posted June 22, 2008 Share Posted June 22, 2008 Uhh, you're echoing the MySQL result, not the result set. That's your problem. Do what sasa said or do: <?php include ("functions.php"); connectto_guana_plants (); $picstorage = array (); $query = "SELECT serialized FROM serialized_data WHERE title = 'picstorage'"; $result = mysql_query($query) OR die(mysql_error()); $row = mysql_fetch_array($result); $data = $row['serialized']; echo $data; $picstorage = unserialize($data); print_r ($picstorage); ?> Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-571628 Share on other sites More sharing options...
kate_rose Posted June 22, 2008 Author Share Posted June 22, 2008 Those 2 solutions worked in that I was able to echo the string but I still didn't get the unserialized data loaded into the $picstorage array. Question: In the manual it looks like mysql_fetch_array is for loading an array directly from mysql into a php array. So why use it? At that point isn't the variable still a string?? Is that perhaps why the unserialize command is not working, because it is impossible to unserialize a php array and it only works on strings?? Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-571693 Share on other sites More sharing options...
kate_rose Posted June 23, 2008 Author Share Posted June 23, 2008 I have been struggling with the unserialize command again this morning & I could still really use some advice. Any help would be greatly appreciated. Kate Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-572296 Share on other sites More sharing options...
DarkWater Posted June 23, 2008 Share Posted June 23, 2008 This line: $data = $row['serialized']; Makes $data into a string...Does it error out with my code? Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-572298 Share on other sites More sharing options...
kate_rose Posted June 23, 2008 Author Share Posted June 23, 2008 DW, I have copied your code exactly into a new test file and I don't get any errors. The string prints out just fine but the array that has been unserialized does not. K- Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-572359 Share on other sites More sharing options...
kate_rose Posted June 23, 2008 Author Share Posted June 23, 2008 When I try to show the array with a while loop instead of the 'print_r' it gives me this error message: Warning: Variable passed to each() is not an array or object in C:\wamp\www\Guana_Plant_Key\browser.php on line 19 the code I used has worked before for me but just in case $picstorage = unserialize($data); while (list ($key, $val) = each ($picstorage)) { echo "$key -> $val <br>"; } Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-572364 Share on other sites More sharing options...
sasa Posted June 23, 2008 Share Posted June 23, 2008 can you echo $data and post it here Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-572422 Share on other sites More sharing options...
kate_rose Posted June 23, 2008 Author Share Posted June 23, 2008 a:308:{i:0;s:54:"Leguminosae subfamily FaboideaeAbrus_precatorius_herb";i:1;s:34:"MalvaceaeAbutilon_umbellatum_herb";i:2;s:57:"Leguminosae subfamily MimosoideaeAcacia_macracantha_herb";i:3;s:54:"Leguminosae subfamily MimosoideaeAcacia_muricata_herb";i:4;s:42:"EuphorbiaceaeAcalypha_chamaedryfolia_herb";i:5;s:37:"AmaranthaceaeAchyranthes_aspera_herb";i:6;s:35:"EuphorbiaceaeAdelia_ricinella_herb";i:7;s:58:"Leguminosae subfamily FaboideaeAlysicarpus_vaginalis_herb";i:8;s:39:"AmaranthaceaeAmaranthus_crassipes_herb";i:9;s:37:"AmaranthaceaeAmaranthus_viridis_herb";i:10;s:30:"RutaceaeAmyris_elemifera_herb";i:11;s:31:"RutaceaeAmyris_elemifera_herb2";i:12;s:29:"AnnonaceaeAnnona_glabra_herb";i:13;s:31:"AnnonaceaeAnnona_muricata_herb";i:14;s:31:"AnnonaceaeAnnona_squamosa_herb";i:15;s:35:"PapaveraceaeArgemone_mexicana_herb";i:16;s:40:"EuphorbiaceaeArgythamnia_candicans_herb";i:17;s:42:"EuphorbiaceaeArgythamnia_fasciculata_herb";i:18;s:32:"MoraceaeArtocarpus_altilis_herb";i:19;s:41:"AsclepiadaceaeAsclepias_curassavica_herb";i:20;s:36:"AcanthaceaeAsystasia_gangetica_herb";i:21;s:36:"SterculiaceaeAyenia_insulicola_herb";i:22;s:33:"MeliaceaeAzadirachta_indica_herb";i:23;s:33:"eliaceaeAzadirachta_indica_herb2";i:24;s:32:"MalvaceaeBastardia_viscosa_herb";i:25;s:61:"Leguminosae subfamily CaesalpinioideaeBauhinia_monandra_herb";i:26;s:40:"CompositaeBidens_alba var. radiata_herb";i:27;s:45:"CompositaeBidens_alba var. radiata_herb_leaf";i:28;s:46:"CompositaeBidens_alba var. radiata_herb_leaf2";i:29;s:35:"CompositaeBidens_cynapiifolia_herb";i:30;s:37:"AcanthaceaeBlechum_pyradmidatum_herb";i:31;s:34:"MyoporaceaeBontia_daphnoides_herb";i:32;s:38:"BoraginaceaeBourreria_succulenta_herb";i:33;s:38:"CrassulaceaeBryophyllum_pinnatum_herb";i:34;s:40:"MalpighiaceaeBunchosia_glandulosa _herb";i:35;s:33:"BurseraceaeBursera_simaruba_herb";i:36;s:62:"Leguminosae subfamily CaesalpinioideaeCaesalpinia_bonduc_herb";i:37;s:63:"Leguminosae subfamily CaesalpinioideaeCaesalpinia_bonduc_herb2";i:38;s:67:"Leguminosae subfamily CaesalpinioideaeCaesalpinia_pulcherrima_herb";i:39;s:33:"CruciferaeCakile_lanceolata_herb";i:40;s:52:"Leguminosae subfamily FaboideaeCanavalia_rosea_herb";i:41;s:41:"CapparaceaeCapparis_cynophallophora_herb";i:42;s:34:"CapparaceaeCapparis_flexuosa_herb";i:43;s:34:"CapparaceaeCapparis_frondosa_herb";i:44;s:32:"CapparaceaeCapparis_indica_herb";i:45;s:38:"ScrophulariaceaeCapraria_biflora_herb";i:46;s:35:"SolanaceaeCapsicum_frutescens_herb";i:47;s:39:"SapindaceaeCardiospermum_corindum_herb";i:48;s:40:"SapindaceaeCardiospermum_corindum_herb2";i:49;s:29:"CaricaceaeCarica_papaya_herb";i:50;s:42:"CasuarinaceaeCasuarina_equisetifolia_herb";i:51;s:36:"ApocynaceaeCatharanthus_roseus_herb";i:52;s:33:"AmaranthaceaeCelosia_nitida_herb";i:53;s:29:"UlmaceaeCeltis_iguanaea_herb";i:54;s:59:"Leguminosae subfamily FaboideaeCentrosema_virginianum_herb";i:55;s:35:"SolanaceaeCestrum_laurifolium_herb";i:56;s:36:"SolanaceaeCestrum_laurifolium_herb2";i:57;s:33:"SolanaceaeCestrum_nocturnum_herb";i:58;s:34:"SolanaceaeCestrum_nocturnum_herb2";i:59;s:34:"SolanaceaeCestrum_nocturnum_herb3";i:60;s:81:"Leguminosae subfamily CaesalpinioideaeChamaecrista_glandulosa var. swartzii_herb";i:61;s:82:"Leguminosae subfamily CaesalpinioideaeChamaecrista_glandulosa var. swartzii_herb2";i:62;s:40:"EuphorbiaceaeChamaesyce_articulata_herb";i:63;s:35:"EuphorbiaceaeChamaesyce_hirta_herb";i:64;s:43:"EuphorbiaceaeChamaesyce_hypericifolia_herb";i:65;s:42:"EuphorbiaceaeChamaesyce_hyssopifolia_herb";i:66;s:41:"EuphorbiaceaeChamaesyce_ophthalmica_herb";i:67;s:29:"RubiaceaeChiococca_alba_herb";i:68;s:30:"RubiaceaeChiococca_alba_herb2";i:69;s:35:"OleaceaeChionanthus_compactus_herb";i:70;s:37:"CompositaeChromolaena_corymbosa_herb";i:71;s:35:"CompositaeChromolaena_sinuata_herb";i:72;s:31:"VitaceaeCissus_trifoliata_herb";i:73;s:32:"VitaceaeCissus_trifoliata_herb2";i:74;s:33:"VitaceaeCissus_verticillata_herb";i:75;s:40:"VerbenaceaeCitharexylum_fruticosum_herb";i:76;s:33:"RutaceaeCitrus_aurantifolia_herb";i:77;s:31:"CapparaceaeCleome_viscosa_herb";i:78;s:39:"VerbenaceaeClerodendrum_aculeatum_herb";i:79;s:28:"GuttiferaeClusia_rosea_herb";i:80;s:29:"GuttiferaeClusia_rosea_herb2";i:81;s:35:"PolygonaceaeCoccoloba_uvifera_herb";i:82;s:37:"RhamnaceaeColubrina_arborescens_herb";i:83;s:35:"RhamnaceaeColubrina_elliptica_herb";i:84;s:38:"AnacardiaceaeComocladia_dodonaea_herb";i:85;s:36:"CombretaceaeConocarpus_erectus_herb";i:86;s:33:"CompositaeConyza_canadensis_herb";i:87;s:33:"TiliaceaeCorchorus_aestuans_herb";i:88;s:33:"TiliaceaeCorchorus_hirsutus_herb";i:89;s:35:"TiliaceaeCorchorus_siliquosus_herb";i:90;s:34:"BoraginaceaeCordia_alliodora_herb";i:91;s:35:"BoraginaceaeCordia_collococca_herb";i:92;s:34:"BoraginaceaeCordia_laevigata_herb";i:93;s:32:"BoraginaceaeCordia_obliqua_herb";i:94;s:36:"BoraginaceaeCordia_rickseckeri_herb";i:95;s:34:"BoraginaceaeCordia_sebestena_herb";i:96;s:35:"BignoniaceaeCrescentia_cujete_herb";i:97;s:39:"CelastraceaeCrossopetalum_rhacoma_herb";i:98;s:54:"Leguminosae subfamily FaboideaeCrotalaria_incana_herb";i:99;s:57:"Leguminosae subfamily FaboideaeCrotalaria_lotifolia_herb";i:100;s:35:"EuphorbiaceaeCroton_astroites_herb";i:101;s:35:"EuphorbiaceaeCroton_betulinus_herb";i:102;s:36:"EuphorbiaceaeCroton_fishlockii_herb";i:103;s:46:"EuphorbiaceaeCroton_flavens var. rigidus_herb";i:104;s:33:"EuphorbiaceaeCroton_lobatus_herb";i:105;s:37:"ConvolvulaceaeCuscuta_americana_herb";i:106;s:37:"CompositaeCyanthillium_cinereum_herb";i:107;s:39:"EuphorbiaceaeDalechampia_scandens_herb";i:108;s:39:"LoranthaceaeDendropemon_caribaeus_herb";i:109;s:58:"Leguminosae subfamily MimosoideaeDesmanthus_virgatus_herb";i:110;s:54:"Leguminosae subfamily FaboideaeDesmodium_glabrum_herb";i:111;s:55:"Leguminosae subfamily FaboideaeDesmodium_glabrum_herb2";i:112;s:54:"Leguminosae subfamily FaboideaeDesmodium_incanum_herb";i:113;s:57:"Leguminosae subfamily FaboideaeDesmodium_procumbens_herb";i:114;s:56:"Leguminosae subfamily FaboideaeDesmodium_triflorum_herb";i:115;s:42:"CucurbitaceaeDoyerea_emetocathartica_herb";i:116;s:41:"CelastraceaeElaeodendron_xylocarpum_herb";i:117;s:32:"CompositaeEmilia_fosbergii_herb";i:118;s:34:"RubiaceaeErithalis_fruticosa_herb";i:119;s:35:"RubiaceaeErithalis_fruticosa_herb2";i:120;s:42:"ErythroxylaceaeErythroxylum_brevipes_herb";i:121;s:32:"MyrtaceaeEugenia_axillaris_herb";i:122;s:30:"MyrtaceaeEugenia_biflora_herb";i:123;s:30:"MyrtaceaeEugenia_cordata_herb";i:124;s:33:"MyrtaceaeEugenia_ligustrina_herb";i:125;s:32:"MyrtaceaeEugenia_monticola_herb";i:126;s:30:"MyrtaceaeEugenia_procera_herb";i:127;s:34:"MyrtaceaeEugenia_underwoodii_herb";i:128;s:41:"EuphorbiaceaeEuphorbia_heterophylla_herb";i:129;s:35:"EuphorbiaceaeEuphorbia_lactea_herb";i:130;s:39:"EuphorbiaceaeEuphorbia_petiolaris_herb";i:131;s:38:"EuphorbiaceaeEuphorbia_tirucalli_herb";i:132;s:33:"RubiaceaeExostema_caribaeum_herb";i:133;s:34:"RubiaceaeExostema_caribaeum_herb2";i:134;s:35:"OleaceaeForestiera_eggersiana_herb";i:135;s:54:"Leguminosae subfamily FaboideaeGalactia_eggersii_herb";i:136;s:53:"Leguminosae subfamily FaboideaeGalactia_striata_herb";i:137;s:30:"LythraceaeGinoria_rohrii_herb";i:138;s:54:"Leguminosae subfamily FaboideaeGliricidia_sepium_herb";i:139;s:34:"RhamnaceaeGouania_lupuloides_herb";i:140;s:35:"RhamnaceaeGouania_lupuloides_herb2";i:141;s:39:"ZygophyllaceaeGuaiacum_officinale_herb";i:142;s:32:"RubiaceaeGuettarda_odorata_herb";i:143;s:31:"RubiaceaeGuettarda_scabra_herb";i:144;s:36:"EuphorbiaceaeGymnanthes_lucida_herb";i:145;s:69:"Leguminosae subfamily CaesalpinioideaeHaematoxylum_campechianum_herb";i:146;s:41:"SterculiaceaeHelicteres_jamaicensis_herb";i:147;s:43:"BoraginaceaeHeliotropium_angiospermum_herb";i:148;s:43:"BoraginaceaeHeliotropium_curassavicum_herb";i:149;s:38:"BoraginaceaeHeliotropium_indicum_herb";i:150;s:40:"MalpighiaceaeHeteropterys_purpurea_herb";i:151;s:37:"MalvaceaeHibiscus_schizopetalus_herb";i:152;s:39:"EuphorbiaceaeHippomane_mancinella_herb";i:153;s:34:"CactaceaeHylocereus_trigonus_herb";i:154;s:60:"Leguminosae subfamily FaboideaeIndigofera_suffruticosa_herb";i:155;s:36:"ConvolvulaceaeIpomoea_violacea_herb";i:156;s:39:"AmaranthaceaeIresine_angustifolia_herb";i:157;s:43:"ConvolvulaceaeJacquemontia_cumanensis_herb";i:158;s:43:"ConvolvulaceaeJacquemontia_havanensis_herb";i:159;s:44:"ConvolvulaceaeJacquemontia_solanifolia_herb";i:160;s:38:"TheophrastaceaeJacquinia_arborea_herb";i:161;s:39:"TheophrastaceaeJacquinia_berterii_herb";i:162;s:35:"OleaceaeJasminum_grandiflorum_herb";i:163;s:29:"OleaceaeJasminum_sambac_herb";i:164;s:37:"EuphorbiaceaeJatropha_multifida_herb";i:165;s:40:"AcanthaceaeJusticia_periplocifolia_herb";i:166;s:37:"CrassulaceaeKalanchoe_tubiflora_herb";i:167;s:39:"ZygophyllaceaeKallstroemia_maxima_herb";i:168;s:42:"ZygophyllaceaeKallstroemia_pubescens_herb";i:169;s:37:"RhamnaceaeKrugiodendron_ferreum_herb";i:170;s:39:"CombretaceaeLaguncularia_racemosa_herb";i:171;s:36:"VerbenaceaeLantana_involucrata_herb";i:172;s:36:"VerbenaceaeLantana_urticifolia_herb";i:173;s:34:"LabiataeLeonotis_nepetifolia_herb";i:174;s:35:"LabiataeLeonotis_nepetifolia_herb2";i:175;s:33:"CompositaeLepidaploa_glabra_herb";i:176;s:60:"Leguminosae subfamily MimosoideaeLeucaena_leucocephala_herb";i:177;s:33:"VerbenaceaeLippia_nodiflora_herb";i:178;s:40:"BignoniaceaeMacfadyena_unguis-cati_herb";i:179;s:40:"MalpighiaceaeMalpighia_woodburyana_herb";i:180;s:36:"MalvaceaeMalvastrum_americanum_herb";i:181;s:40:"MalvaceaeMalvastrum_corchorifolium_herb";i:182;s:41:"MalvaceaeMalvastrum_coromandelianum_herb";i:183;s:35:"AnacardiaceaeMangifera_indica_herb";i:184;s:36:"CelastraceaeMaytenus_laevigata_herb";i:185;s:33:"CompositaeMelanthera_aspera_herb";i:186;s:37:"SapindaceaeMelicoccus_bijugatus_herb";i:187;s:34:"CactaceaeMelocactus_intortus_herb";i:188;s:37:"SterculiaceaeMelochia_nodiflora_herb";i:189;s:41:"ConvolvulaceaeMerremia_quinquefolia_herb";i:190;s:38:"CucurbitaceaeMomordica_charantia_herb";i:191;s:39:"CucurbitaceaeMomordica_charantia_herb2";i:192;s:36:"CapparaceaeMorisonia_americana_herb";i:193;s:37:"CapparaceaeMorisonia_americana_herb2";i:194;s:35:"MyrtaceaeMyrcianthes_fragrans_herb";i:195;s:35:"MyrtaceaeMyrciaria_floribunda_herb";i:196;s:32:"ApocynaceaeNerium_oleander_herb";i:197;s:32:"AcanthaceaeOplonia_spinosa_herb";i:198;s:31:"CactaceaeOpuntia_dillenii_herb";i:199;s:32:"CactaceaeOpuntia_rubescens_herb";i:200;s:35:"OxalidaceaeOxalis_corniculata_herb";i:201;s:65:"Leguminosae subfamily CaesalpinioideaeParkinsonia _aculeata_herb";i:202;s:37:"PassifloraceaePassiflora_edulis_herb";i:203;s:39:"PassifloraceaePassiflora_suberosa_herb";i:204;s:32:"CompositaePectis_linifolia_herb";i:205;s:34:"ApocynaceaePentalinon_luteum_herb";i:206;s:33:"PiperaceaePeperomia_humilis_herb";i:207;s:39:"PiperaceaePeperomia_magnoliifolia_herb";i:208;s:38:"PhytolaccaceaePetiveria_alliacea_herb";i:209;s:37:"EuphorbiaceaePhyllanthus_amarus_herb";i:210;s:33:"SolanaceaePhysalis_angulata_herb";i:211;s:54:"Leguminosae subfamily FaboideaePictetia_aculeata_herb";i:212;s:33:"UrticaceaePilea_microphylla_herb";i:213;s:53:"UrticaceaePilea_microphylla var. trianthemoides_herb";i:214;s:31:"UrticaceaePilea_tenerrima_herb";i:215;s:35:"CactaceaePilosocereus_royenii_herb";i:216;s:60:"Leguminosae subfamily FaboideaePiscidia_carthagenensis_herb";i:217;s:37:"NyctaginaceaePisonia_subcordata_herb";i:218;s:78:"NyctaginaceaePisonia_subcordata_herb2 ~NyctaginaceaePisonia_subcordata_herb3";i:219;s:65:"Leguminosae subfamily MimosoideaePithecellobium_unguis-cati_herb";i:220;s:37:"LabiataePlectranthus_amboinicus_herb";i:221;s:36:"CompositaePluchea_carolinensis_herb";i:222;s:44:"PlumbaginaceaePlumbago_scandens_flower_herb";i:223;s:37:"PlumbaginaceaePlumbago_scandens_herb";i:224;s:30:"ApocynaceaePlumeria_alba_herb";i:225;s:31:"ApocynaceaePlumeria_rubra_herb";i:226;s:51:"Leguminosae subfamily FaboideaePoitea_florida_herb";i:227;s:52:"Leguminosae subfamily FaboideaePoitea_florida_herb2";i:228;s:34:"PortulaceceaPortulaca_pilosa_herb";i:229;s:39:"PortulaceceaPortulaca_teretifolia_herb";i:230;s:33:"VerbenaceaePriva_lappulacea_herb";i:231;s:34:"VerbenaceaePriva_lappulacea_herb2";i:232;s:30:"MyrtaceaePsidium_guajava_herb";i:233;s:31:"MyrtaceaePsidium_guajava_herb2";i:234;s:33:"RubiaceaePsychotria_brownei_herb";i:235;s:34:"RubiaceaePsychotria_microdon_herb";i:236;s:31:"PunicaceaePunica_granatum_herb";i:237;s:35:"CombretaceaeQuisqualis_indica_herb";i:238;s:30:"RubiaceaeRandia_aculeata_herb";i:239;s:34:"ApocynaceaeRauvolfia_viridis_herb";i:240;s:37:"RhizophoraceaeRhizophora_mangle_herb";i:241;s:54:"Leguminosae subfamily FaboideaeRhynchosia_minima_herb";i:242;s:55:"Leguminosae subfamily FaboideaeRhynchosia_minima_herb2";i:243;s:58:"Leguminosae subfamily FaboideaeRhynchosia_reticulata_herb";i:244;s:35:"EuphorbiaceaeRicinus_communis_herb";i:245;s:34:"PhytolaccaceaeRivina_humilis_herb";i:246;s:32:"RubiaceaeRondeletia_pilosa_herb";i:247;s:33:"AcanthaceaeRuellia_tuberosa_herb";i:248;s:45:"ScrophulariaceaeRusselia_equisetiformis_herb";i:249;s:29:"LabiataeSalvia_serotina_herb";i:250;s:52:"Leguminosae subfamily MimosoideaeSamanea_saman_herb";i:251;s:33:"SalicaceaeSamyda_dodecandra_herb";i:252;s:37:"EuphorbiaceaeSavia_sessiliflora_herb";i:253;s:38:"EuphorbiaceaeSavia_sessiliflora_herb2";i:254;s:35:"GoodeniaceaeScaevola_plumieri_herb";i:255;s:40:"CelastraceaeSchaefferia_frutescens_herb";i:256;s:38:"RubiaceaeScolosanthus_versicolor_herb";i:257;s:62:"Leguminosae subfamily CaesalpinioideaeSenna_bicapsularis_herb";i:258;s:62:"Leguminosae subfamily CaesalpinioideaeSenna_occidentalis_herb";i:259;s:36:"SapindaceaeSerjania_polyphylla_herb";i:260;s:37:"SapindaceaeSerjania_polyphylla_herb2";i:261;s:38:"AizoaceaeSesuvium_portulacastrum_herb";i:262;s:25:"MalvaceaeSida_acuta_herb";i:263;s:28:"MalvaceaeSida_ciliaris_herb";i:264;s:26:"MalvaceaeSida_glabra_herb";i:265;s:29:"MalvaceaeSida_glomerata_herb";i:266;s:26:"MalvaceaeSida_repens_herb";i:267;s:36:"MalvaceaeSidastrum_multiflorum_herb";i:268;s:36:"SapotaceaeSideroxylon_obovatum_herb";i:269;s:41:"SapotaceaeSideroxylon_foetidissimum_herb";i:270;s:42:"SapotaceaeSideroxylon_foetidissimum_herb2";i:271;s:34:"SolanaceaeSolanum_americanum_herb";i:272;s:33:"SolanaceaeSolanum_polygamum_herb";i:273;s:30:"SolanaceaeSolanum_torvum_herb";i:274;s:35:"RubiaceaeSpermacoce_assurgens_herb";i:275;s:36:"SpigaliaceaeSpigelia_anthelmia_herb";i:276;s:34:"AnacardiaceaeSpondias_mombin_herb";i:277;s:43:"VerbenaceaeStachytarpheta_jamaicensis_herb";i:278;s:43:"ConvolvulaceaeStictocardia_tiliifolia_herb";i:279;s:44:"MalpighiaceaeStigmaphyllon_emarginatum_herb";i:280;s:45:"MalpighiaceaeStigmaphyllon_emarginatum_herb2";i:281;s:56:"Leguminosae subfamily FaboideaeStylosanthes_hamata_herb";i:282;s:33:"SurianaceaeSuriana_maritima_herb";i:283;s:33:"MeliaceaeSwietenia_mahogani_herb";i:284;s:34:"MeliaceaeSwietenia_mahogani_herb2";i:285;s:36:"CompositaeSynedrella_nodiflora_herb";i:286;s:42:"CompositaeSynedrella_nodiflora_herb_fruit";i:287;s:39:"BignoniaceaeTabebuia_heterophylla_herb";i:288;s:35:"BignoniaceaeTabebuia_lepidota_herb";i:289;s:43:"ApocynaceaeTabernaemontana_divaricata_herb";i:290;s:36:"PortulaceceaTalinum_fruticosum_herb";i:291;s:61:"Leguminosae subfamily CaesalpinioideaeTamarindus_indica_herb";i:292;s:62:"Leguminosae subfamily CaesalpinioideaeTamarindus_indica_herb2";i:293;s:30:"BignoniaceaeTecoma_stans_herb";i:294;s:54:"Leguminosae subfamily FaboideaeTephrosia_cinerea_herb";i:295;s:57:"Leguminosae subfamily FaboideaeTephrosia_noctiflora_herb";i:296;s:54:"Leguminosae subfamily FaboideaeTeramnus_labialis_herb";i:297;s:36:"CombretaceaeTerminalia_catappa_herb";i:298;s:33:"MalvaceaeThespesia_populnea_herb";i:299;s:35:"EuphorbiaceaeTragia_volubilis_herb";i:300;s:29:"UlmaceaeTrema_micrantha_herb";i:301;s:40:"AizoaceaeTrianthema_portulacastrum_herb";i:302;s:42:"PhytolaccaceaeTrichostigma_octandrum_herb";i:303;s:33:"CompositaeTridax_procumbens_herb";i:304;s:34:"TurneraceaeTurnera_ulmifolia_herb";i:305;s:35:"SterculiaceaeWaltheria_indica_herb";i:306;s:38:"Rutaceaeanthoxylum_martinicense_herb";i:307;s:39:"Rutaceaeanthoxylum_martinicense_herb2";} Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-572433 Share on other sites More sharing options...
kate_rose Posted June 23, 2008 Author Share Posted June 23, 2008 Actually the string ends with ';}' but for some reason it didn't get copied. Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-572438 Share on other sites More sharing options...
sasa Posted June 23, 2008 Share Posted June 23, 2008 you have error in your serialized string start of string 'a:306' means array with 308 elements, it's OK 'i:0;s:54:"Leguminosae subfamily FaboideaeAbrus_precatorius_herb";' -> on index 0 is string 54 char long but your string has 53 char, this is error etc. are you do some operation with serialized string before put it in database is it any caracter between Faboideae and Abrus in your 1st string? Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-572661 Share on other sites More sharing options...
Barand Posted June 23, 2008 Share Posted June 23, 2008 see Kate_Rose earlier post http://www.phpfreaks.com/forums/index.php/topic,203051.msg919662.html#msg919662 The data had "\" in it before being inserted into the database table. Were they escaped before writing? Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-572702 Share on other sites More sharing options...
kate_rose Posted June 23, 2008 Author Share Posted June 23, 2008 No, I am not doing anything to it before storing it in the db. I did not escape the back slashes. I mentioned it before but I should have asked specifically. I will go see if I can figure out how to do that & come back. Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-572725 Share on other sites More sharing options...
DarkWater Posted June 23, 2008 Share Posted June 23, 2008 Did you use mysql_real_escape_string() on it? Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-572726 Share on other sites More sharing options...
kate_rose Posted June 23, 2008 Author Share Posted June 23, 2008 Oh - that just means the double backslash . . Duh! Originally I had all the backslashes in the mysql database doubled but then when I loaded it into the php array the doubles where still there. So I removed them from the db & everything worked fine. I assumed that meant that I was OK with them even though I had read about using the escape. Sorry for all the hastle over such a small thing . I have some errands to run so I will fix it later this eve & mark this solved then. Thanks everyone for all your time. Kate Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-572730 Share on other sites More sharing options...
kate_rose Posted June 23, 2008 Author Share Posted June 23, 2008 Wow that was really easy. Thanks again folks. I can't promise it won't happen again but I am learning. Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-572739 Share on other sites More sharing options...
DarkWater Posted June 24, 2008 Share Posted June 24, 2008 Heh, no problem. =D Quote Link to comment https://forums.phpfreaks.com/topic/111344-solved-debug-unserialize-not-working/#findComment-572752 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.