Create Hash column in mysql table [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I need to create an extra column (using PHP and mysql) in my table that contains a random key. Maybe I could hash data from the row table to have unique values. Please I need suggestions.

using a timestamp as a source for a hash should be enough to get a unique hash. Better to use microtime() instead of time() because there could be 2 requests in the same second.
$hash = sha1(microtime());

Related

How can I get table data for my tables in my website? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 days ago.
Improve this question
How can I get table data for my tables in my website?
I want to update my table data every minute. Is there any extension for it?
And Could you give me a example for better understanding?
I don't know anything about extract data. So, I didn't try anything.

Use MySQL to generate semi random string on insert [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I would like to know if its possible to have mysql generate a semi random string when a new entry is inserted into a table.
so if my table has a column called Code , when a new record is inserted can mysql generate a random string of numbers and add that onto the end of what was inserted into code.
eg if MCQ is inserted into code , mysql will do its thing and add 123 onto it giving MCQ123
It should be possible using TRIGGER. But why not inserting the random string with the insert data?

validating id coming back from client php [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I am using BIGINT in mysql server for id. There are some operation which needs for client side storage of id. So, I can't trust the id coming back from the user brower. I want to validate that data. so the question is
1) what is the exact range of BIGINT(255). The range of the BIGINT(255) is not easy to validate. please let me know how to validate it with regex.
2) should I do this check on id coming back from client, am I just over concerning the issue or should I validate the id to avoid sql injection?
From MySQL doc:
For signed BIGINT: -9223372036854775808 to 9223372036854775807
For unsigned BIGINT: 0 to 18446744073709551615
I think you just need to verify if the ID is a number, and within the range defined by BIGINT

What is the best user-Id Value for a MySql "users" table [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
It may sounds trivial. but I want to know the Secure way of generating user-IDs to be used in MySql table. This is because I feel that using pure Integer IDs can enable hacking?.
Everything can be hacked, the only difference is that if the ID is used as a parameter in the URL or any other input. Then a GUID could be better to use.
Example : url/?id=1.

Calling a field from database in MySQL [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
return(array($clientName,$salesPer,$prospectVal,$projID));
The projectID is dynamically added in database for each entry, now how can i return the ID. As i have not set any variable in PHP to map the database field.
Can anyone guide me on this.
If you're asking how to get back the ProjectID after it has been inserted into the database and automatically assigned, I suggest using something like the following:
$projID = mysql_insert_id();
immediately after running the insert statement.

Categories