Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

PHP auto generating SQL statement.

$
0
0
I am working on a website that will be for a database, and managing it, through PHP and SQL, I am trying to make it pull down all the column names and place them in the statement, and also get all the $_POST[] data from the textarea's that are named correctly. and it will not work, I'm not sure if I am doing it correctly, this is the first time I have tried to do something like this.


$string = mysql_query("SELECT * FROM ".$_SESSION['username']."");
	
$sql = "INSERT INTO ".$_SESSION['username']." ('". 
for($j=0; $j < mysql_num_fields($string); $j++) {
	$string1 .= mysql_field_name($string, $j)."', '".; 
}
."') VALUES ('".
for($j=0; $j < mysql_num_fields($string); $j++) {
	$_POST[mysql_field_name($string, $j)]."', '". 
}
"')";
	


Viewing all articles
Browse latest Browse all 51036

Trending Articles