Jump to content

Recommended Posts

Hi,

 

I have a very big signup form and it is almost impossible to create a full table for it because of very high number of form fields and I dont want to create a field for each of them in my database's table.

 

but I managed to store all the form values in an array, is there a way to fully insert an array to just one field? and for future use select it again as an array?

 

Thanks.

The answer is no, in order to do this you would need to create a field for each one in your database...  It'll be the easiest way to do it for future programming.

 

My registration is quite extensive as well, and my users table in my database has 110 different things it could have in it..  the only way for future programming would be to do it that way as well....  also i'd make a functions.php to keep all of your functions in, and keep your insert statement in functions.php and just call it when you need it..  here is the way i write functions that may help you to write functions easier to read...

 

<?php
function insert_aact($userdata, $page, $action, $id, $crev, $old) {
$sql = "INSERT INTO z_".$page." SET
		about_txt = '".$old[about_txt]."',
		last_edited = '".$old[last_edited]."'";
mysql_query($sql);
$id = mysql_insert_id();
$sql = "INSERT INTO adminact SET
		aact_admin = '".$userdata[admin][username]."',
		aact_crev = '$crev',
		aact_itemid = '$id',
		aact_page = '$page',
		aact_action = '$action',
		aact_ip = '$userdata[_ip]',
		aact_date = now()";
mysql_query($sql);

}
?>

 

However since all of your stuff is in an array you could put in only like say $data in the function, and then use like username = '$data[username]',

password = '$data[password]',

 

and so on to the end...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.