Hi i am trying to get the List of columns from a specific table in mysql and then generate a form based on the columns but i keep getting an error and the page is just blank.
mysql_select_db($DB_Name) or die(mysql_error());
$query=mysql_query("SHOW COLUMNS FROM mytable") or die (mysql_error());
$j=0;
while($row=mysql_fetch_assoc($query)){
if(substr($row,0,2)=="S_"){
echo substr($row,2);?>:<input type="text" name="<?php echo $row;?>" maxlength="<?php echo getlength($j, "mytable");?>" /><?php ?><!--textbox code here --><?php
}
$j++;
}
getlength(); is a method i wrote to make it easier to get the length of a field for a column. It works accurately.
thanks
i think i didnt mention. Since the site is dynamic the name of the column isnt known. The point of this is to get the list of column names from a specific table and display it in an orderly manner.
substryou can restrict the count of string values,not an array...