Posted: Fri Jul 28, 2006 5:00 am
its finishing the create table before it gets to the while statementCREATE TABLE test;(
any ideas
thanks reece
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
its finishing the create table before it gets to the while statementCREATE TABLE test;(
Code: Select all
<?php
$maketable = 1
?>Code: Select all
<?php
echo '<strong>' . $howmanyfields . '</strong>';
?>Code: Select all
$endfield=1;
$maketable="CREATE TABLE $table;(";
echo '<strong>' . $howmanyfields . '</strong>';
while ( $endfield <= 2) {
$maketable .= "${$field.$endfield} varchar(${$length.$endfield}) ${$null.$endfield} default '${$default.$endfield}',";
$endfield++;
}Code: Select all
CREATE TABLE test;( varchar() default '', varchar() default '',Code: Select all
${$attribute.$endfield}=$_POST['attribute1$endfield'];Code: Select all
${$attribute.$endfield}=$_POST['attribute1' . $endfield];and here is the current code for the create tableCREATE TABLE ;(testfieldname1; varchar(testfieldname1) testfieldname1 default 'testfieldname1',testfieldname1; varchar(testfieldname1) testfieldname1 default 'testfieldname1',
Code: Select all
$endfield=1;
$maketable="CREATE TABLE $table;(";
while ( $endfield <= 2) {
$maketable .= "${$field.$endfield}; varchar(${$length.$endfield}) ${$null.$endfield} default '${$default.$endfield}',";
$endfield++;
}CREATE TABLE ;(testdefualtfield1; varchar(testdefualtfield1) testdefualtfield1 default 'testdefualtfield1',testdefualtfield2; varchar(testdefualtfield2) testdefualtfield2 default 'testdefualtfield2',
Code: Select all
$table=$_POST['tbname'];
if ($_POST['form_create_table'] == 'yes'){
$endfield=1;
while ( $endfield <= 2) {
${$field.$endfield}=$_POST['field' . $endfield];
$endfield++;
}
$endfield=1;
while ( $endfield <= 2) {
${$length.$endfield}=$_POST['length' . $endfield];
$endfield++;
}
$endfield=1;
while ( $endfield <= 2) {
${$attribute.$endfield}=$_POST['attribute' . $endfield];
$endfield++;
}
$endfield=1;
while ( $endfield <= 2) {
${$null.$endfield}=$_POST['null' . $endfield];
$endfield++;
}
$endfield=1;
while ( $endfield <= 2) {
${$default.$endfield}=$_POST['default' . $endfield];
$endfield++;
}
$endfield=1;
$maketable="CREATE TABLE $table;(";
while ( $endfield <= 2) {
$maketable .= "${$field.$endfield}; varchar(${$length.$endfield}) ${$null.$endfield} default '${$default.$endfield}',";
$endfield++;
}
echo $maketable;Code: Select all
<?php
$maketable = '';
$table=$_POST['tbname'];
if ($_POST['form_create_table'] == 'yes'){
$maketable="CREATE TABLE $table (";
$endfield=1;
while ( $endfield <= 2) {
${$field.$endfield}=$_POST['field' . $endfield];
${$length.$endfield}=$_POST['length' . $endfield];
${$attribute.$endfield}=$_POST['attribute' . $endfield];
${$null.$endfield}=$_POST['null' . $endfield];
${$default.$endfield}=$_POST['default' . $endfield];
$maketable .= "${$field.$endfield}; varchar(${$length.$endfield}) ${$null.$endfield} default '${$default.$endfield}',";
$endfield++;
}
}
echo $maketable;
?>CREATE TABLE (; varchar() default '',; varchar() default '',
Code: Select all
<?php
if ($_POST['form_create_table'] == 'yes'){
$maketable="CREATE TABLE $table (";
/* $endfield=1;
while ( $endfield <= 2) {
${$field.$endfield}=$_POST['field' . $endfield];
${$length.$endfield}=$_POST['length' . $endfield];
${$attribute.$endfield}=$_POST['attribute' . $endfield];
${$null.$endfield}=$_POST['null' . $endfield];
${$default.$endfield}=$_POST['default' . $endfield];
$maketable .= "${$field.$endfield}; varchar(${$length.$endfield}) ${$null.$endfield} default '${$default.$endfield}',";
$endfield++;
}
*/
echo '<h1>Field is ' . $field . '</h1>';
echo '<h1>Length is ' . $length. '</h1>';
echo '<h1>Attribute is ' . $attribute. '</h1>';
echo '<h1>Null is ' . $null. '</h1>';
echo '<h1>Default is ' . $default. '</h1>';
echo '<h1>Endfield is ' . $endfield. '</h1>';
echo '<h1>Maketable is ' . $maketable. '</h1>';
}
?>Field is
Length is
Attribute is
Null is
Default is
Endfield is
Maketable is CREATE TABLE (
(