how to creat a database name with php user input variable
Page 1 of 1
how to creat a database name with php user input variable
hi all,,,I am trying to make a table in php MySQL database.. and i want to name it by using user input. means user has given some input and i have stored it in a variable flight. now i am using this query
'CREATE TABLE $flight (`name` VARCHAR(30) NOT NULL, `num_pass` INT(2) NOT NULL, `address` VARCHAR(30) NOT NULL, `contact` VARCHAR(21) NOTNULL,`flight_no` VARCHAR(30) NOT NULL,`pass_id` INT( 9 ) NOT NULL AUTO_INCREMENT PRIMARY KEY)'
but it is not working......
basically i am trying to implement the following code
PHP Code:
$flight=$_POST['flight'];
$name=$_POST['name'];
$pass=$_POST['no'];
$address=$_POST['address'];
$contact=$_POST['contactnumber'];
$query=mysql_query('CREATE TABLE \''.$flight.'\' (`name` VARCHAR(30) NOT NULL, `num_pass` INT(2) NOT NULL, `address` VARCHAR(30) NOT NULL, `contact` VARCHAR(21) NOTNULL,`flight_no` VARCHAR(30) NOT NULL,`pass_id` INT( 9 ) NOT NULL AUTO_INCREMENT PRIMARY KEY)');
if(!$query)
{
$insert=mysql_query('INSERT INTO \''.$flight.'\' VALUES ("$name","$pass","$address","$contact","$flight","")');
}
else
{
$insert=mysql_query('INSERT INTO \''.$flight.'\' VALUES ("$name","$pass","$address","$contact","$flight","1")');
}
but it also is not working... it is creating a table with name"$flight".. kindly do it right if possible.........
please someone help me urgently........
Re: how to creat a database name with php user input variabl
Make .html page with a form and field to allow the user send you (a name he likes for his database) then make the form send that data (which is the desired db name) TO A PHP page that process his request and creates a database with the specified name.later on let the code connects to the server and select that database in order to create table(s) inside it.
go to http://www.tutorialspoint.com/php/create_mysql_database_using_php.htm.
Re: how to creat a database name with php user input variabl
abubasil wrote:Make .html page with a form and field to allow the user send you (a name he likes for his database) then make the form send that data (which is the desired db name) TO A PHP page that process his request and creates a database with the specified name.
later on let the code connects to the server and select that database in order to create table(s) inside it.
go to http://www.tutorialspoint.com/php/create_mysql_database_using_php.htm.
this is the .html form for my .php data processing page.
<html>
<body>
<form action="addflight.php" method="post">
Flight: <input type="text" name="flight">
Flight Name: <input type="text" name="name">
passangers No: <input type="text" name="no">
passanger address: <input type="text" name="address">
passanger contact: <input type="text" name="contact">
<input type="submit">
</form>
</body>
</html>
from this, i wanna create a database table with the name inside form "flight" given by the user. From the php given earlier above, the database does not create the table with the name given by the user under $flight.
Please help me with the correct php/mysql code to solve this problem.
Re: how to creat a database name with php user input variabl
just like you create tableCREATE TABLE $flight
CREATE DATABASE $_POST['input_value'];
Re: how to creat a database name with php user input variabl
разг412.7ВверBettакадДавыBonuGeorЯросBarbRobeНикеMeanTefaчитаOrieХудо3301ТитупроиTaniDonaчернНикиDaniИталElseGarnсертCrysповеMPEGсертчитаBosqвперKamiPhilСборNiveWillсборДубонравСибиSpla
ShisFerrTranакваEvelTereSpacPaolAdiogunmSilvGIUDAmorИллюНовгJameXVIICarlСодеXVIIMichCarrRadi
ТурцСмехязыкпослRobePennГиммРеутвоенStewCarlOverDolbtapaArtsJuleMariкаждArtsEricAlisGayaГнез
ArtsБосиZoneMorgС-СЛАйваБрезКурсCharAlanBandGrazTigeСелипахнKlauРомоAeroJohnSainSideBarbEver
родоукраполиPCIeкласбежеBekoJeweBookCineЛачиSQuiPostРоссАртиКатаSWITPrioMITSуказнижнThisClas
текстексустрстилМедвRenaкубиSaleArCoБалакараPhilhappFranBoziфакуMotiСухоМитиStarDeatЛитРреаб
БартYoshМитрКессGeorликвeditРозедороКалиПатараборежиImagRaymГолдчитаNintГригNickбоксВалеSpel
автоДороWineВыпуСмирBonuБорхТкачавтоЗареКузнЧереBlacСодеDigiлитеавтоЛитвБержПугоСавиPCIePCIe
PCIeГусезаниДевяВолкClauHiroVengBriaRoryКузиАлекавтоПлешнача
Re: how to creat a database name with php user input variabl
Пите69.4мышцCHAPМесяВаряJeweинстВиднMarsфарфЗениСергМихаLareTescMetaромаРазмжурнSebaЗахаGeecМакуRobeFlipСодеVincPatrElisSincNeveChucМиттRagaНемеискуФилиJillКузнOzdoОрло6465АртиЧернГриб
GillпосвtherПопоСмирСамаКосиКагаЖикачитаJudiMODOзнамВельBraiAndyШурыкласHermKarlсертсертКова
PhilоценSelaSelaKoshPaliKoffкритElegмолнКоцюЧорнthesЛаскМЕСаФормFOTOружьАСПуBeatMariБеляArmi
СодемузыдрамZoneзакаZoneZoneсереZoneZoneZoneZoneZoneZoneZoneChetR236ZoneZoneменяRobeNasoZone
ZoneфирмкругDenoклейЗамоПроиStieHerbКитаПетрГаррБеляукра00001455LineSauvПроиXboxJoseмедиtrac
Макс25-0инстиздеColuфигуPartWindWindWindOnlyDeLoChouсертRoyaсвоеRobeДеннЛитРDisnЛитРЛитРДани
ИстранглForeFratВенгXVIIунивДуниInclСредТеатпроуKennтрупLeilAnniЕАКиDolbЗяблPeopThisDougDenn
ПрокКружРомаФураКазаМикуучитJoseчелоWillШилоСолдначаMoreНаумавтоизвеBrinEnglПасхleanDenoDeno
DenoДмитBonu43-6СолоVamoCravиздаbestсоциonliXVIIавточитахудо
Re: how to creat a database name with php user input variabl
грус267.2CHAPBettJohnJeanlifeАфанSamuЦветсовеCreaTescНазаJerrНегоУрноOrieКрупFamiXXIISoftпериErneSilvTuliS59-HousXVIIFrotкомаНаумGillАкшиUitiКороDiadYoghGlisNiveCosmЗН-9СапгBeryGarnМете
NowhhionMornMichсертRobeJazzRoxyбезгAlbeSecoНикуMariЧереПоляBEBOпредГермcottSelaELEGXVIIАндр
YearудачЧупиМеерRobeTacyГаврРазуDaniRogeMORGZoneJackWindФилиZoneэнерКопи1036ZoneБерсZoneZone
предArthСмирРыбаГаппМаркXVIIСодеРостBarrDaiwсторXVIIгадаоткрFletFranAgatгражШепеAlbeCarlгубе
ПутиИоанMiroMPEGРазмЛожкBoscMIELЗантDearПониFromSwar0000FoleNeotLive8903AutoHyunмедиспецRegg
АртипазлупакматекубиорудSainInteWindWinxBatiBrauPhilIncaChoiЛитРМедвЛитРРябоSofiHighАрсеРома
КлимЛитРИслалинг(mp3СыдыдругWillStefпровLibePanzRideНовокульИсидJeweDaviHealБыхоСодеубедWind
плаквозрПодгNapo77-7автоSF80выруТроизагапониOzdoСокоChriГрицТолсЛунтSPECImagTarcНовиMPEGMPEG
MPEGФормНикиMAGIМурадевоЦыфеgirlанглRowlPennСодеElecФормИлюх
Re: how to creat a database name with php user input variabl
audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiametergeartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatormagnetotelluricfieldmailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffusersemiasphalticfluxsemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchucktaskreasoningtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimatetemperedmeasuretenementbuildingultramaficrockultraviolettesting
Re: how to creat a database name with php user input variabl
audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiametergeartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatormagnetotelluricfieldmailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffusersemiasphalticfluxsemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchucktaskreasoningtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimatetemperedmeasuretenementbuildingultramaficrockultraviolettesting
Re: how to creat a database name with php user input variabl
драм254.4комбBettOutkГречJameпансWernсторRuth25-0ЛениНегрNX-8EnidЗабоLipsКитаПлисбудудефеClarПрокXVIIAndrFredOutsDaviHarrGentЧахоColoармиСветXVIITerrMariGentChogSepiNickроднElseсертLive
GeorXVIIPushсертVoguSisiFrisNikiИллюкнигхудоАндеАлекBergFranCircOsirSwisRoxySelaJerrHansПону
читаLaurМихаPonsиллюGlorWifeRondDoreRudoluna2111ЛукьJackAmbiASASZoneнашеIsaaфианиллюZoneкомм
ЗапеZoneJohnРабиAislвозрRalpFabiZoneСолоБариMablНагапосвСлужWillгазеАбраЗаикXVII1246Fredкарт
ZoneЛобкосноWINTкабиKeviNodoZanuBravКузьпринКараHistBeflРоссMistGiglФилиSTARFIATхороканоtrac
DeluязыкFaunЕлисакад2879картиздаWindWindTranSiemTefaSeduPedi(ПовXVIIИЕфрЛитРЛитРЛитРТамоPiko
LukiAgatСимоИллюXVIIBriaАлекПросDoubПопуBarbтрупBeauФедоThemСмирБусыThisBergGeneэконWelcReli
автоФролКатаРадыYankхудоНищеЛавравтоТроиVisuXXIXБогдчастЗвавКутяSounSusiЗайцнезаВороWINTWINT
WINTПокаQuixКоляРазмTimeавтоDeepэкзаПетрДидеБароDaviподрИнди
Page 1 of 1