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?
Related
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 2 years ago.
Improve this question
What I'm trying to achieve is whenever this column is updated, it shouldn't remove the previous data that has been filled, instead, it should just enter data in the next line with the previous data too.
For example
Author 1
Author 2
This is my code
$booktb = $db->update("books", "author" => $author);
I've looked into this question but it didn't work for me
Update data in mysql column field without removing previous value
pseudo code
$b = $db->select("books","author" => "kafka");
$b["title"] = "another book"
$db->insert("books",$b);
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());
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 created a HTML form wich is sending the data to a MYSQL/PHPmyAdmin page through a PHP section. That works fine. Every record in the DB gets a unique field (reparationID)
Based on the ReparationID I want to create a barcode and print it on a management page. Is this possible in PHP?
I have created a big button that must do the action, but i don't know how yet..
you should get id from DB and create 12 digit number with this code :
$s_number0 = str_pad( $id, 12, "0", STR_PAD_LEFT );
this code create 12 digit number
then save this code to DB and create Barcode whith this class :
http://www.shayanderson.com/php/php-barcode-generator-class-code-39.htm
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 8 years ago.
Improve this question
I am currently getting data from a database using PHP and echoing the data out using:
$data[0]
This displays a full list of account numbers, I am wanting to put a href around this so that when I click on each one of the account numbers it runs another MYSQL query which breaks down to more information based on the account number that has been clicked.
How can this be done?
The href could point to another script which evaluates the $_GET parameters and builds a query from it, like in
12345
and
<?php // details.php
...
mysql_query( "select * from mydata where id=$_GET['id']" );
This is just a pointer, and the example is prone to SQL injection etc.
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.