Jump to content

serialized php array won't write to mysql db??


kate_rose

Recommended Posts

Hi,

 

I have an array that I am serializing in php & then sending to mysql.

There is no error message but when I look at the database with Navicat 8 there is no entry.

I think the serialize command is working but somehow its not transfering to mysql because I can get the serialized array to echo back to me.  I couldn't evaluate if it is done correctly because I have never seen one before. 

 

I did check to see what datatype the recieving mysql column is designated as. It is set to mediumtext but I don't know what to put in as the length.  I tryed to make it blank but it keeps resetting itself to 0.  If the setting is mediumtext do you need to put in an acceptable length for the entry??  If so what should it be for mediumtext.  It was originally set to 255 but that didn't sound right either.

 

Here is my code:

 

$dbname = "serialized_data";
mysql_select_db($dbname);
$sqlinput = (serialize($picstorage));		//convert picstorage into a sqlinput string
$query = "INSERT INTO serialized_data(key, serialized) VALUES ('picstorage','". $sqlinput ."')"; //story picstorage string in mysql

 

Thanks for any help you can provide.

 

Kate

 

Link to comment
Share on other sites

Can you please give an example of what you might be putting into the column? With mediumtext, I dont believe you have to specify a length.

 

But I think what your problem is, is the way you have serialized to be inserted.

 

'". $sqlinput ."' Is weird. Even if it may be correct by php standards(I never do it, but I dont wanna say its invalid syntax), you generally only want to have the 2 single quotes on both sides of the variable. And I dunno why you have the dots on both sides also. So make it:

 

"$sqlinput"

 

And that should work.

Link to comment
Share on other sites

Here is an example of what I am trying to save to the mysql database.  I put it in code brackets because it is so big.  Certainly there will be larger serialized arrays that will need to be stored in the future.

 

a:308:{i:0;s:54:"Leguminosae subfamily Faboideae\Abrus_precatorius_herb";i:1;s:34:"Malvaceae\Abutilon_umbellatum_herb";i:2;s:57:"Leguminosae subfamily Mimosoideae\Acacia_macracantha_herb";i:3;s:54:"Leguminosae subfamily Mimosoideae\Acacia_muricata_herb";i:4;s:42:"Euphorbiaceae\Acalypha_chamaedryfolia_herb";i:5;s:37:"Amaranthaceae\Achyranthes_aspera_herb";i:6;s:35:"Euphorbiaceae\Adelia_ricinella_herb";i:7;s:58:"Leguminosae subfamily Faboideae\Alysicarpus_vaginalis_herb";i:8;s:39:"Amaranthaceae\Amaranthus_crassipes_herb";i:9;s:37:"Amaranthaceae\Amaranthus_viridis_herb";i:10;s:30:"Rutaceae\Amyris_elemifera_herb";i:11;s:31:"Rutaceae\Amyris_elemifera_herb2";i:12;s:29:"Annonaceae\Annona_glabra_herb";i:13;s:31:"Annonaceae\Annona_muricata_herb";i:14;s:31:"Annonaceae\Annona_squamosa_herb";i:15;s:35:"Papaveraceae\Argemone_mexicana_herb";i:16;s:40:"Euphorbiaceae\Argythamnia_candicans_herb";i:17;s:42:"Euphorbiaceae\Argythamnia_fasciculata_herb";i:18;s:32:"Moraceae\Artocarpus_altilis_herb";i:19;s:41:"Asclepiadaceae\Asclepias_curassavica_herb";i:20;s:36:"Acanthaceae\Asystasia_gangetica_herb";i:21;s:36:"Sterculiaceae\Ayenia_insulicola_herb";i:22;s:33:"Meliaceae\Azadirachta_indica_herb";i:23;s:33:"eliaceae\Azadirachta_indica_herb2";i:24;s:32:"Malvaceae\Bastardia_viscosa_herb";i:25;s:61:"Leguminosae subfamily Caesalpinioideae\Bauhinia_monandra_herb";i:26;s:40:"Compositae\Bidens_alba var. radiata_herb";i:27;s:45:"Compositae\Bidens_alba var. radiata_herb_leaf";i:28;s:46:"Compositae\Bidens_alba var. radiata_herb_leaf2";i:29;s:35:"Compositae\Bidens_cynapiifolia_herb";i:30;s:37:"Acanthaceae\Blechum_pyradmidatum_herb";i:31;s:34:"Myoporaceae\Bontia_daphnoides_herb";i:32;s:38:"Boraginaceae\Bourreria_succulenta_herb";i:33;s:38:"Crassulaceae\Bryophyllum_pinnatum_herb";i:34;s:40:"Malpighiaceae\Bunchosia_glandulosa _herb";i:35;s:33:"Burseraceae\Bursera_simaruba_herb";i:36;s:62:"Leguminosae subfamily Caesalpinioideae\Caesalpinia_bonduc_herb";i:37;s:63:"Leguminosae subfamily Caesalpinioideae\Caesalpinia_bonduc_herb2";i:38;s:67:"Leguminosae subfamily Caesalpinioideae\Caesalpinia_pulcherrima_herb";i:39;s:33:"Cruciferae\Cakile_lanceolata_herb";i:40;s:52:"Leguminosae subfamily Faboideae\Canavalia_rosea_herb";i:41;s:41:"Capparaceae\Capparis_cynophallophora_herb";i:42;s:34:"Capparaceae\Capparis_flexuosa_herb";i:43;s:34:"Capparaceae\Capparis_frondosa_herb";i:44;s:32:"Capparaceae\Capparis_indica_herb";i:45;s:38:"Scrophulariaceae\Capraria_biflora_herb";i:46;s:35:"Solanaceae\Capsicum_frutescens_herb";i:47;s:39:"Sapindaceae\Cardiospermum_corindum_herb";i:48;s:40:"Sapindaceae\Cardiospermum_corindum_herb2";i:49;s:29:"Caricaceae\Carica_papaya_herb";i:50;s:42:"Casuarinaceae\Casuarina_equisetifolia_herb";i:51;s:36:"Apocynaceae\Catharanthus_roseus_herb";i:52;s:33:"Amaranthaceae\Celosia_nitida_herb";i:53;s:29:"Ulmaceae\Celtis_iguanaea_herb";i:54;s:59:"Leguminosae subfamily Faboideae\Centrosema_virginianum_herb";i:55;s:35:"Solanaceae\Cestrum_laurifolium_herb";i:56;s:36:"Solanaceae\Cestrum_laurifolium_herb2";i:57;s:33:"Solanaceae\Cestrum_nocturnum_herb";i:58;s:34:"Solanaceae\Cestrum_nocturnum_herb2";i:59;s:34:"Solanaceae\Cestrum_nocturnum_herb3";i:60;s:81:"Leguminosae subfamily Caesalpinioideae\Chamaecrista_glandulosa var. swartzii_herb";i:61;s:82:"Leguminosae subfamily Caesalpinioideae\Chamaecrista_glandulosa var. swartzii_herb2";i:62;s:40:"Euphorbiaceae\Chamaesyce_articulata_herb";i:63;s:35:"Euphorbiaceae\Chamaesyce_hirta_herb";i:64;s:43:"Euphorbiaceae\Chamaesyce_hypericifolia_herb";i:65;s:42:"Euphorbiaceae\Chamaesyce_hyssopifolia_herb";i:66;s:41:"Euphorbiaceae\Chamaesyce_ophthalmica_herb";i:67;s:29:"Rubiaceae\Chiococca_alba_herb";i:68;s:30:"Rubiaceae\Chiococca_alba_herb2";i:69;s:35:"Oleaceae\Chionanthus_compactus_herb";i:70;s:37:"Compositae\Chromolaena_corymbosa_herb";i:71;s:35:"Compositae\Chromolaena_sinuata_herb";i:72;s:31:"Vitaceae\Cissus_trifoliata_herb";i:73;s:32:"Vitaceae\Cissus_trifoliata_herb2";i:74;s:33:"Vitaceae\Cissus_verticillata_herb";i:75;s:40:"Verbenaceae\Citharexylum_fruticosum_herb";i:76;s:33:"Rutaceae\Citrus_aurantifolia_herb";i:77;s:31:"Capparaceae\Cleome_viscosa_herb";i:78;s:39:"Verbenaceae\Clerodendrum_aculeatum_herb";i:79;s:28:"Guttiferae\Clusia_rosea_herb";i:80;s:29:"Guttiferae\Clusia_rosea_herb2";i:81;s:35:"Polygonaceae\Coccoloba_uvifera_herb";i:82;s:37:"Rhamnaceae\Colubrina_arborescens_herb";i:83;s:35:"Rhamnaceae\Colubrina_elliptica_herb";i:84;s:38:"Anacardiaceae\Comocladia_dodonaea_herb";i:85;s:36:"Combretaceae\Conocarpus_erectus_herb";i:86;s:33:"Compositae\Conyza_canadensis_herb";i:87;s:33:"Tiliaceae\Corchorus_aestuans_herb";i:88;s:33:"Tiliaceae\Corchorus_hirsutus_herb";i:89;s:35:"Tiliaceae\Corchorus_siliquosus_herb";i:90;s:34:"Boraginaceae\Cordia_alliodora_herb";i:91;s:35:"Boraginaceae\Cordia_collococca_herb";i:92;s:34:"Boraginaceae\Cordia_laevigata_herb";i:93;s:32:"Boraginaceae\Cordia_obliqua_herb";i:94;s:36:"Boraginaceae\Cordia_rickseckeri_herb";i:95;s:34:"Boraginaceae\Cordia_sebestena_herb";i:96;s:35:"Bignoniaceae\Crescentia_cujete_herb";i:97;s:39:"Celastraceae\Crossopetalum_rhacoma_herb";i:98;s:54:"Leguminosae subfamily Faboideae\Crotalaria_incana_herb";i:99;s:57:"Leguminosae subfamily Faboideae\Crotalaria_lotifolia_herb";i:100;s:35:"Euphorbiaceae\Croton_astroites_herb";i:101;s:35:"Euphorbiaceae\Croton_betulinus_herb";i:102;s:36:"Euphorbiaceae\Croton_fishlockii_herb";i:103;s:46:"Euphorbiaceae\Croton_flavens var. rigidus_herb";i:104;s:33:"Euphorbiaceae\Croton_lobatus_herb";i:105;s:37:"Convolvulaceae\Cuscuta_americana_herb";i:106;s:37:"Compositae\Cyanthillium_cinereum_herb";i:107;s:39:"Euphorbiaceae\Dalechampia_scandens_herb";i:108;s:39:"Loranthaceae\Dendropemon_caribaeus_herb";i:109;s:58:"Leguminosae subfamily Mimosoideae\Desmanthus_virgatus_herb";i:110;s:54:"Leguminosae subfamily Faboideae\Desmodium_glabrum_herb";i:111;s:55:"Leguminosae subfamily Faboideae\Desmodium_glabrum_herb2";i:112;s:54:"Leguminosae subfamily Faboideae\Desmodium_incanum_herb";i:113;s:57:"Leguminosae subfamily Faboideae\Desmodium_procumbens_herb";i:114;s:56:"Leguminosae subfamily Faboideae\Desmodium_triflorum_herb";i:115;s:42:"Cucurbitaceae\Doyerea_emetocathartica_herb";i:116;s:41:"Celastraceae\Elaeodendron_xylocarpum_herb";i:117;s:32:"Compositae\Emilia_fosbergii_herb";i:118;s:34:"Rubiaceae\Erithalis_fruticosa_herb";i:119;s:35:"Rubiaceae\Erithalis_fruticosa_herb2";i:120;s:42:"Erythroxylaceae\Erythroxylum_brevipes_herb";i:121;s:32:"Myrtaceae\Eugenia_axillaris_herb";i:122;s:30:"Myrtaceae\Eugenia_biflora_herb";i:123;s:30:"Myrtaceae\Eugenia_cordata_herb";i:124;s:33:"Myrtaceae\Eugenia_ligustrina_herb";i:125;s:32:"Myrtaceae\Eugenia_monticola_herb";i:126;s:30:"Myrtaceae\Eugenia_procera_herb";i:127;s:34:"Myrtaceae\Eugenia_underwoodii_herb";i:128;s:41:"Euphorbiaceae\Euphorbia_heterophylla_herb";i:129;s:35:"Euphorbiaceae\Euphorbia_lactea_herb";i:130;s:39:"Euphorbiaceae\Euphorbia_petiolaris_herb";i:131;s:38:"Euphorbiaceae\Euphorbia_tirucalli_herb";i:132;s:33:"Rubiaceae\Exostema_caribaeum_herb";i:133;s:34:"Rubiaceae\Exostema_caribaeum_herb2";i:134;s:35:"Oleaceae\Forestiera_eggersiana_herb";i:135;s:54:"Leguminosae subfamily Faboideae\Galactia_eggersii_herb";i:136;s:53:"Leguminosae subfamily Faboideae\Galactia_striata_herb";i:137;s:30:"Lythraceae\Ginoria_rohrii_herb";i:138;s:54:"Leguminosae subfamily Faboideae\Gliricidia_sepium_herb";i:139;s:34:"Rhamnaceae\Gouania_lupuloides_herb";i:140;s:35:"Rhamnaceae\Gouania_lupuloides_herb2";i:141;s:39:"Zygophyllaceae\Guaiacum_officinale_herb";i:142;s:32:"Rubiaceae\Guettarda_odorata_herb";i:143;s:31:"Rubiaceae\Guettarda_scabra_herb";i:144;s:36:"Euphorbiaceae\Gymnanthes_lucida_herb";i:145;s:69:"Leguminosae subfamily Caesalpinioideae\Haematoxylum_campechianum_herb";i:146;s:41:"Sterculiaceae\Helicteres_jamaicensis_herb";i:147;s:43:"Boraginaceae\Heliotropium_angiospermum_herb";i:148;s:43:"Boraginaceae\Heliotropium_curassavicum_herb";i:149;s:38:"Boraginaceae\Heliotropium_indicum_herb";i:150;s:40:"Malpighiaceae\Heteropterys_purpurea_herb";i:151;s:37:"Malvaceae\Hibiscus_schizopetalus_herb";i:152;s:39:"Euphorbiaceae\Hippomane_mancinella_herb";i:153;s:34:"Cactaceae\Hylocereus_trigonus_herb";i:154;s:60:"Leguminosae subfamily Faboideae\Indigofera_suffruticosa_herb";i:155;s:36:"Convolvulaceae\Ipomoea_violacea_herb";i:156;s:39:"Amaranthaceae\Iresine_angustifolia_herb";i:157;s:43:"Convolvulaceae\Jacquemontia_cumanensis_herb";i:158;s:43:"Convolvulaceae\Jacquemontia_havanensis_herb";i:159;s:44:"Convolvulaceae\Jacquemontia_solanifolia_herb";i:160;s:38:"Theophrastaceae\Jacquinia_arborea_herb";i:161;s:39:"Theophrastaceae\Jacquinia_berterii_herb";i:162;s:35:"Oleaceae\Jasminum_grandiflorum_herb";i:163;s:29:"Oleaceae\Jasminum_sambac_herb";i:164;s:37:"Euphorbiaceae\Jatropha_multifida_herb";i:165;s:40:"Acanthaceae\Justicia_periplocifolia_herb";i:166;s:37:"Crassulaceae\Kalanchoe_tubiflora_herb";i:167;s:39:"Zygophyllaceae\Kallstroemia_maxima_herb";i:168;s:42:"Zygophyllaceae\Kallstroemia_pubescens_herb";i:169;s:37:"Rhamnaceae\Krugiodendron_ferreum_herb";i:170;s:39:"Combretaceae\Laguncularia_racemosa_herb";i:171;s:36:"Verbenaceae\Lantana_involucrata_herb";i:172;s:36:"Verbenaceae\Lantana_urticifolia_herb";i:173;s:34:"Labiatae\Leonotis_nepetifolia_herb";i:174;s:35:"Labiatae\Leonotis_nepetifolia_herb2";i:175;s:33:"Compositae\Lepidaploa_glabra_herb";i:176;s:60:"Leguminosae subfamily Mimosoideae\Leucaena_leucocephala_herb";i:177;s:33:"Verbenaceae\Lippia_nodiflora_herb";i:178;s:40:"Bignoniaceae\Macfadyena_unguis-cati_herb";i:179;s:40:"Malpighiaceae\Malpighia_woodburyana_herb";i:180;s:36:"Malvaceae\Malvastrum_americanum_herb";i:181;s:40:"Malvaceae\Malvastrum_corchorifolium_herb";i:182;s:41:"Malvaceae\Malvastrum_coromandelianum_herb";i:183;s:35:"Anacardiaceae\Mangifera_indica_herb";i:184;s:36:"Celastraceae\Maytenus_laevigata_herb";i:185;s:33:"Compositae\Melanthera_aspera_herb";i:186;s:37:"Sapindaceae\Melicoccus_bijugatus_herb";i:187;s:34:"Cactaceae\Melocactus_intortus_herb";i:188;s:37:"Sterculiaceae\Melochia_nodiflora_herb";i:189;s:41:"Convolvulaceae\Merremia_quinquefolia_herb";i:190;s:38:"Cucurbitaceae\Momordica_charantia_herb";i:191;s:39:"Cucurbitaceae\Momordica_charantia_herb2";i:192;s:36:"Capparaceae\Morisonia_americana_herb";i:193;s:37:"Capparaceae\Morisonia_americana_herb2";i:194;s:35:"Myrtaceae\Myrcianthes_fragrans_herb";i:195;s:35:"Myrtaceae\Myrciaria_floribunda_herb";i:196;s:32:"Apocynaceae\Nerium_oleander_herb";i:197;s:32:"Acanthaceae\Oplonia_spinosa_herb";i:198;s:31:"Cactaceae\Opuntia_dillenii_herb";i:199;s:32:"Cactaceae\Opuntia_rubescens_herb";i:200;s:35:"Oxalidaceae\Oxalis_corniculata_herb";i:201;s:65:"Leguminosae subfamily Caesalpinioideae\Parkinsonia _aculeata_herb";i:202;s:37:"Passifloraceae\Passiflora_edulis_herb";i:203;s:39:"Passifloraceae\Passiflora_suberosa_herb";i:204;s:32:"Compositae\Pectis_linifolia_herb";i:205;s:34:"Apocynaceae\Pentalinon_luteum_herb";i:206;s:33:"Piperaceae\Peperomia_humilis_herb";i:207;s:39:"Piperaceae\Peperomia_magnoliifolia_herb";i:208;s:38:"Phytolaccaceae\Petiveria_alliacea_herb";i:209;s:37:"Euphorbiaceae\Phyllanthus_amarus_herb";i:210;s:33:"Solanaceae\Physalis_angulata_herb";i:211;s:54:"Leguminosae subfamily Faboideae\Pictetia_aculeata_herb";i:212;s:33:"Urticaceae\Pilea_microphylla_herb";i:213;s:53:"Urticaceae\Pilea_microphylla var. trianthemoides_herb";i:214;s:31:"Urticaceae\Pilea_tenerrima_herb";i:215;s:35:"Cactaceae\Pilosocereus_royenii_herb";i:216;s:60:"Leguminosae subfamily Faboideae\Piscidia_carthagenensis_herb";i:217;s:37:"Nyctaginaceae\Pisonia_subcordata_herb";i:218;s:78:"Nyctaginaceae\Pisonia_subcordata_herb2 ~Nyctaginaceae\Pisonia_subcordata_herb3";i:219;s:65:"Leguminosae subfamily Mimosoideae\Pithecellobium_unguis-cati_herb";i:220;s:37:"Labiatae\Plectranthus_amboinicus_herb";i:221;s:36:"Compositae\Pluchea_carolinensis_herb";i:222;s:44:"Plumbaginaceae\Plumbago_scandens_flower_herb";i:223;s:37:"Plumbaginaceae\Plumbago_scandens_herb";i:224;s:30:"Apocynaceae\Plumeria_alba_herb";i:225;s:31:"Apocynaceae\Plumeria_rubra_herb";i:226;s:51:"Leguminosae subfamily Faboideae\Poitea_florida_herb";i:227;s:52:"Leguminosae subfamily Faboideae\Poitea_florida_herb2";i:228;s:34:"Portulacecea\Portulaca_pilosa_herb";i:229;s:39:"Portulacecea\Portulaca_teretifolia_herb";i:230;s:33:"Verbenaceae\Priva_lappulacea_herb";i:231;s:34:"Verbenaceae\Priva_lappulacea_herb2";i:232;s:30:"Myrtaceae\Psidium_guajava_herb";i:233;s:31:"Myrtaceae\Psidium_guajava_herb2";i:234;s:33:"Rubiaceae\Psychotria_brownei_herb";i:235;s:34:"Rubiaceae\Psychotria_microdon_herb";i:236;s:31:"Punicaceae\Punica_granatum_herb";i:237;s:35:"Combretaceae\Quisqualis_indica_herb";i:238;s:30:"Rubiaceae\Randia_aculeata_herb";i:239;s:34:"Apocynaceae\Rauvolfia_viridis_herb";i:240;s:37:"Rhizophoraceae\Rhizophora_mangle_herb";i:241;s:54:"Leguminosae subfamily Faboideae\Rhynchosia_minima_herb";i:242;s:55:"Leguminosae subfamily Faboideae\Rhynchosia_minima_herb2";i:243;s:58:"Leguminosae subfamily Faboideae\Rhynchosia_reticulata_herb";i:244;s:35:"Euphorbiaceae\Ricinus_communis_herb";i:245;s:34:"Phytolaccaceae\Rivina_humilis_herb";i:246;s:32:"Rubiaceae\Rondeletia_pilosa_herb";i:247;s:33:"Acanthaceae\Ruellia_tuberosa_herb";i:248;s:45:"Scrophulariaceae\Russelia_equisetiformis_herb";i:249;s:29:"Labiatae\Salvia_serotina_herb";i:250;s:52:"Leguminosae subfamily Mimosoideae\Samanea_saman_herb";i:251;s:33:"Salicaceae\Samyda_dodecandra_herb";i:252;s:37:"Euphorbiaceae\Savia_sessiliflora_herb";i:253;s:38:"Euphorbiaceae\Savia_sessiliflora_herb2";i:254;s:35:"Goodeniaceae\Scaevola_plumieri_herb";i:255;s:40:"Celastraceae\Schaefferia_frutescens_herb";i:256;s:38:"Rubiaceae\Scolosanthus_versicolor_herb";i:257;s:62:"Leguminosae subfamily Caesalpinioideae\Senna_bicapsularis_herb";i:258;s:62:"Leguminosae subfamily Caesalpinioideae\Senna_occidentalis_herb";i:259;s:36:"Sapindaceae\Serjania_polyphylla_herb";i:260;s:37:"Sapindaceae\Serjania_polyphylla_herb2";i:261;s:38:"Aizoaceae\Sesuvium_portulacastrum_herb";i:262;s:25:"Malvaceae\Sida_acuta_herb";i:263;s:28:"Malvaceae\Sida_ciliaris_herb";i:264;s:26:"Malvaceae\Sida_glabra_herb";i:265;s:29:"Malvaceae\Sida_glomerata_herb";i:266;s:26:"Malvaceae\Sida_repens_herb";i:267;s:36:"Malvaceae\Sidastrum_multiflorum_herb";i:268;s:36:"Sapotaceae\Sideroxylon_obovatum_herb";i:269;s:41:"Sapotaceae\Sideroxylon_foetidissimum_herb";i:270;s:42:"Sapotaceae\Sideroxylon_foetidissimum_herb2";i:271;s:34:"Solanaceae\Solanum_americanum_herb";i:272;s:33:"Solanaceae\Solanum_polygamum_herb";i:273;s:30:"Solanaceae\Solanum_torvum_herb";i:274;s:35:"Rubiaceae\Spermacoce_assurgens_herb";i:275;s:36:"Spigaliaceae\Spigelia_anthelmia_herb";i:276;s:34:"Anacardiaceae\Spondias_mombin_herb";i:277;s:43:"Verbenaceae\Stachytarpheta_jamaicensis_herb";i:278;s:43:"Convolvulaceae\Stictocardia_tiliifolia_herb";i:279;s:44:"Malpighiaceae\Stigmaphyllon_emarginatum_herb";i:280;s:45:"Malpighiaceae\Stigmaphyllon_emarginatum_herb2";i:281;s:56:"Leguminosae subfamily Faboideae\Stylosanthes_hamata_herb";i:282;s:33:"Surianaceae\Suriana_maritima_herb";i:283;s:33:"Meliaceae\Swietenia_mahogani_herb";i:284;s:34:"Meliaceae\Swietenia_mahogani_herb2";i:285;s:36:"Compositae\Synedrella_nodiflora_herb";i:286;s:42:"Compositae\Synedrella_nodiflora_herb_fruit";i:287;s:39:"Bignoniaceae\Tabebuia_heterophylla_herb";i:288;s:35:"Bignoniaceae\Tabebuia_lepidota_herb";i:289;s:43:"Apocynaceae\Tabernaemontana_divaricata_herb";i:290;s:36:"Portulacecea\Talinum_fruticosum_herb";i:291;s:61:"Leguminosae subfamily Caesalpinioideae\Tamarindus_indica_herb";i:292;s:62:"Leguminosae subfamily Caesalpinioideae\Tamarindus_indica_herb2";i:293;s:30:"Bignoniaceae\Tecoma_stans_herb";i:294;s:54:"Leguminosae subfamily Faboideae\Tephrosia_cinerea_herb";i:295;s:57:"Leguminosae subfamily Faboideae\Tephrosia_noctiflora_herb";i:296;s:54:"Leguminosae subfamily Faboideae\Teramnus_labialis_herb";i:297;s:36:"Combretaceae\Terminalia_catappa_herb";i:298;s:33:"Malvaceae\Thespesia_populnea_herb";i:299;s:35:"Euphorbiaceae\Tragia_volubilis_herb";i:300;s:29:"Ulmaceae\Trema_micrantha_herb";i:301;s:40:"Aizoaceae\Trianthema_portulacastrum_herb";i:302;s:42:"Phytolaccaceae\Trichostigma_octandrum_herb";i:303;s:33:"Compositae\Tridax_procumbens_herb";i:304;s:34:"Turneraceae\Turnera_ulmifolia_herb";i:305;s:35:"Sterculiaceae\Waltheria_indica_herb";i:306;s:38:"Rutaceae\Zanthoxylum_martinicense_herb";i:307;s:39:"Rutaceae\Zanthoxylum_martinicense_herb2";}

 

I tried removing the dots and having just the '$sqlinput' but that didn't seem to fix the problem.  I think that the dots and extra quotes are what is needed to pass a php variable into a mysql command.  At least that is what I have done in the past.  Am I just confused  ???.

Link to comment
Share on other sites

I think that the dots and extra quotes are what is needed to pass a php variable into a mysql command.

 

while it may work, it certainly isnt necessary. Did you try what I said about just single quotes around the variable? And my lord, can't you split up that variable into something smaller??

Link to comment
Share on other sites

Instead of writing the whole array to a single record, why don't you normalise the data and have 300 rows with a single name in each row.

 

[pre]

data

------+-----------+--------------------------------------------------------------------

id    |    key    |  name

------+-----------+--------------------------------------------------------------------

1    |  xyz    | Leguminosae subfamily Faboideae\Abrus_precatorius_herb

2    |  xyz    | Malvaceae\Abutilon_umbellatum_herb

3    |  xyz    | Leguminosae subfamily Mimosoideae\Acacia_macracantha_herb

4    |  xyz    | Leguminosae subfamily Mimosoideae\Acacia_muricata_herb

5    |  xyz    | Euphorbiaceae\Acalypha_chamaedryfolia_herb[/pre]

 

I'd also avoid using the escape character "\" in your data

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.