Auto save username

QuestionsAuto save username
Jorge Barosa asked 8 years ago

Hello,

I have this query:

mysql_select_db ( $database_ggi, $ggi );
$query_rsUserName = sprintf ( "SELECT nome FROM utilizadores WHERE utilizador = '%s'", $_SESSION['MM_Username'] );
$rsUserName = mysql_query ( $query_rsUserName, $ggi ) or die ( mysql_error () );
$row_rsUserName = mysql_fetch_assoc ( $rsUserName );
$totalRows_rsUserName = mysql_num_rows ( $rsUserName );

and I would like to autosave the username on the table, something like this:

$col = array();
$col["title"] = "Utilizador";
$col["name"] = "Utilizador";
$col["width"] = "0";
$col["align"] = "left";
$col["hidden"] = false;
$col["editable"] = true; // esta coluna não editável
$col["editoptions"] = array("size"=>20); // with default display of textbox with size 20
// $col["editrules"] = array("required"=>false); // required:true(false), number:true(false), minValue:val, maxValue:val
// $col["editrules"] = array("edithidden"=>true);
// $col["formatter"] = "date"; // format as date
$col["formatter"] = "autocomplete"; // autocomplete
$col["formatoptions"] = $rsUserName;
$cols[] = $col;

But this is not working, can you help me.

Thanks
Jorge Barosa

3 Answers
Abu Ghufran answered 8 years ago

For default value, you can set

$col["editoptions"]["defaultValue"] = 'default';

Jorge answered 8 years ago

Hello Abu,

Thanks for your answer.

I want this field to be saved, but I don't want the user to edit the field!

$col = array();
$col["title"] = "Utilizador";
$col["name"] = "Utilizador";
$col["width"] = "20";
$col["align"] = "left";
$col["hidden"] = false;
$col["editable"] = false; // esta coluna não editável
// $col["editoptions"] = array("size"=>20); // with default display of textbox with size 20
$col["editoptions"]["defaultValue"] = $nome;
$cols[] = $col;

How can I do it?

Regards,
Jorge Barosa

Abu Ghufran answered 8 years ago

You can set it readonly.
$col["editrules"]["readonly"] = true;

Your Answer

13 + 7 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?