hi friends i have a problem i have written a code for accepting table name , feld names and datatype from user and i want to create a table in database . my problem is that i am auable to create a string for creating table can you suggest me the solutions. I this code $tname is table name , fname is array containg values field names and Dtype is an array containg datatype. when i use print_r($_REQUE ST) i am getting all values that array contains but when i m trying to make string using for loop i am notgetting values.
[PHP]
include("conn.p hp");
echo $fnm = count($_GET['Fname']);
echo $dtyp = count($_GET['Dtype']);
$tname = $_REQUEST['tname'];
print_r($_REQUE ST);
$str = "create table ".$tname."( ";
for($i=0;$i<=$f nm;$i++)
{
echo $_REQUEST["Fname"][$i];
echo $str .= $_GET["Fname"][$i]." ".$_GET["Dtype"][$i];
if(strlen($_GET["Dtype"][$i])>0 && $i != $fnm-1)
$str.=",";
}
$str.=") values";
echo $str ;
[/PHP]
[PHP]
include("conn.p hp");
echo $fnm = count($_GET['Fname']);
echo $dtyp = count($_GET['Dtype']);
$tname = $_REQUEST['tname'];
print_r($_REQUE ST);
$str = "create table ".$tname."( ";
for($i=0;$i<=$f nm;$i++)
{
echo $_REQUEST["Fname"][$i];
echo $str .= $_GET["Fname"][$i]." ".$_GET["Dtype"][$i];
if(strlen($_GET["Dtype"][$i])>0 && $i != $fnm-1)
$str.=",";
}
$str.=") values";
echo $str ;
[/PHP]
Comment