Hi there guys,
I am making an admin script with a few functions to "add" data to a db.
For some of the fields, I have set a default value, bu i dunno how to pull this value from the database, and display it in a <input type=text> box, for the user to change it if he wants to. I have searched the forum for ages, and come up with one thread about the same thing, it was from 2000 and didn't have a reply to it, so i thought i might as well ask again 🙂
Cheers, anders
You want something like:
<input type=text value="<?php print "$variable_containing_result_from_databse";?>">
cheers for your reply, but it wasn't quite what I wanted :/
The problems is that I dont know which mysql query to use to get the DEFAULT value from a colums in a database. when I create the table, I set a few default values (i.e language has default "english"). If there is a way of getting the defaults, I would be a very happy man. And It should be, because if I use myphpadmin, It does print the default values in the fields there...
Thanks again, /anders
Execute the query "SHOW FIELDS FROM tablename"
You'll get a row of results back, just as in a regular query, with the following columns
'Field', 'Type', 'Null', 'Key', 'Default','Extra'
This enough info?
This is assuming you're using MySQL btw 🙂