Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL






SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Formatting Data From Input Form


I have a form on my website and it's imperative that regardless of the way users enter their information into the form, I need the data to be stored in the database in a certain way.

For example:

john smith needs to be displayed as John Smith
JOHN SMITH needs to be displayed as John Smith

Can I do this at the database level after the fact or do I have to do it via PHP at the form level?




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Data Input
Is the only way to input data to our database in MySql is using DOS, and typing the data in DOS environment?

View Replies !   View Related
Help CHECKING FORM DATA AGAINST MYSQL TABLE DATA
PHP

// See if relevant fields have been set.

$submitted = IsSet($_REQUEST['Submit'])? TRUE : FALSE;
$user= IsSet($_REQUEST['username']) ?
cleanValue($_REQUEST['username']) : ''
$pswd= IsSet($_REQUEST['password']) ?
cleanValue($_REQUEST['password']) : ''

if($submitted) {// Form submitted yet?

if (empty($user) || empty($pswd)) {// Are Form fields empty?

// Display error message when fields are not filled in.

$message = 'Make sure you enter both a username and password.'

}

else {

/* THIS IS MY HUMBLE EFFORT BELOWAND IT DONT WORK HELP */

//CONVERT PASSWORD FROM FORM INTO MD5

$pswd = md5($pswd);

//CONNECT TO DATABASE

$connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd")
or die ("Couldn't connect to server.");

$db = mysql_select_db("$database_name", $connection)
or die("Couldn't select database.");

//SELCT TABLE AND DATA

$sql = @mysql_query("SELECT * FROM users WHERE username='$user' AND password='$pswd' AND activated=Ƈ' ");
if (!$sql) {
exit('<br /><br /><h3>Error retrieving Art members from database!<br />'.
'Error: ' . mysql_error() . '</h3><br /><hr /><br />');
}

//MAKE VARIABLES FOR CHECKING FORM DATA AGAINSTIS THIS RIGHT!!

while ($login_check = mysql_fetch_array($sql)) {
$user = htmlspecialchars($login_check['username']);
$pswd = $login_check['password'];

//NOT SURE FROM HERE

// ORIGINAL SCRIPT BELOW

// Authenticate username and password (i.e. match against a database).
// Start a session only after username and password have been verified.

THIS IS THE EXAMPLE LOGIN CHECK THAT CAME WITH THE CLASS

if ((!strcmp($user, 'empl')) &&// Does username match 'empl'?
(!strcmp($pswd,'demo'))) {// Does password match 'demo'?

$sess_param['new_sid'] = TRUE;// Create new session ID to be safe.
$sess_param['security_level'] = 100;// Security level for Employees area
$sess_param['gc_maxlifetime'] = 300;// Inactivity timeout of 300 seconds (5 minutes)
$sess = new DB_eSession(&$sess_param);// session_start() done.
$sess->setSessVar('authenticated', TRUE);// Set that authentication occurred.

// Save the username for displaying and encrypt
$sess->setSessVar('username', $user, ENCRYPT_VALUE, EXTRA_FIELD);

$URI = $sess->setSessURI('employees.php');// Optional - pass session ID in URI. Not as safe.

header("Location: $URI");// Go to members area.
exit;
}


REGARDS Bill007

View Replies !   View Related
Formatting Date During LOAD DATA INFILE
I have a CSV file of data I wish to import using LOAD DATA INFILE and one of the columns is date. I have that column set to a date field type in the database but in the CSV file the date is in the format:

DD-MMM-YY, i.e. 09-DEC-07

I can't change the format in the CSV file and when I currently load the data using the LOAD DATA INFILE all the dates get set to 0000-00-00. Is there a way to tell MySQL the formatting of the date in the LOAD DATA INFILE statement so it converts it to the correct format for MySQL to understand and there import.

View Replies !   View Related
Handle Replacing ' In Data Already Input
I have recently been given a project that belonged to another programmer.
The issue I'm having is that no data validation was put in place of the program and so now I have data that has characters that are not allowed by MySQL, specifically apostrophes.
I now how to do it in PHP to replace the character, but what I need to do now is to replace the data already in the table. I'm specifically talking about a user's login name.
Can I escape it inside the database and not have the user's login name change?
For example I have a username that is O'LearyDM.
I haven't been able to comb through all the code to figure out just how the original programmer was able to even allow insertion of apostrophes, but now I need to fix it.

View Replies !   View Related
Fast Input Of Binary Data
We are considering MySQL as an alternative to the Sybase databases that we have now. One thing we need to be able to do is insert tens of millions of rows of data quickly. Each row may have 10 to 20 columns. The source of these data are binary data files. Is there a way to do this quickly? Currently we are using Sybase's bulk copy utility bcp. Is there something comparable in MySQL?

We also need to be able to extract large amounts of data from the database and put them into binary data files. Again we are currently doing this with Sybase's bcp utility. Can we do this in MySQL?

View Replies !   View Related
Mysql Data Input Tool
i was wondering if there were any free data input tools for mysql instead of using the command line client?

View Replies !   View Related
Counting Columns That Match Input Data
Is it possible to count the number of columns that match certain conditions
and return a single value?

For example in the database we have a record where:

Column 1 = Male
Column 2 = A
Column 3 = B
Column 4 = D
Column 5 = M

And the data to be used for the query is:

Column 1 = Male
Column 2 = D
Column 3 = B
Column 4 = Z
Column 5 = M

I would like to be able to return all records where Column 1 = Male and also
return how many columns (from Column 2 through 5) match the data input. In
this case the number would be 2 since Column 3 and Column 5 in the database
match the data used for the query. If no columns match the input data, the
number returned would be 0.

View Replies !   View Related
How Do I Extract All My Text Data Input From A Php Forum?
I manage a small website using phpbb on a Solaris platform, using mysql 4.x. After being repeatedly hacked, I'd like to migrate to a less singled out forum bb, but without losing my data--most of which is in Chinese characters (so doing string searches is definitely out).

I have direct file access via ftp to the server, and i've also downloaded the corrupted files, only two of which have been modified by the hacker, namely,

phpbb_config.ISD
phpbb_forums.ISD

Unfortunately, the last previous backup the hosting company performed was some 8 months before...

View Replies !   View Related
LOAD DATA Gives Problem When Last Column In Input Is Empty!!
I had created a table with 20 fields, setting most of them to DEFAULT to NULL.
(partially shown bellow).

I populated the table with LOAD DATA. Last column in most of my input rows are empty, yet separated by a tab from the previous column. So most of the rows typically ends with a tab (and a newline, ofcourse).

Load data works fine with out any warning. But, when query the database, i do NOT see NULL value in last column(lab here). This column just looks empty. Where as I expected NULL to be there.

Is there something i miss here.
NOTE: If a column does not have the data in the middle of the row (say for 4th field), then I get the NULL value set to that filed. Which is perfect. Code:

View Replies !   View Related
Passing Search Data To D/b Via A Hyperlink And Without Input Fields
How can I pass hard-coded search data to a MySQL results.php page with a hyperlink and without input fields?

These are the details:

I have a simple online database which can be searched by classification (business type) and/or company name (it does an 'or' search).

There is an index.php (search) page and a results.php page. (The results page also has a search, which leads back to the same results page.)

What my client wants to do is this:

If some records are returned, it gives a list on the results page of companies found to match the criteria (this works just fine).

But if no records are found, he wants a list of classifications, each of which is clickable, and will do a search for all companies with that classification.

It doesn't matter whether this would be on the same results.php page or another page.

View Replies !   View Related
On Submission Of Form Data To Db
I have a php form for personnel, when someone fills it out and hits "submit", I want an email sent to me saying that someone has submitted an entry into the database.

View Replies !   View Related
Retrieving Data Through A Form.
I'm setting up a database and I want to retrieve data from the db through a form.

I currently have:

$sql = "SELECT * FROM Tasks WHERE t_id = '$_POST[t_id]'";

$result = mysql_query($sql, $conn) or die(mysql_error());

while ($newArray = mysql_fetch_array($result)){
$id = $newArray['t_id'];

echo "ID: $id <br>";

I don't think that the 'WHERE t_id = '$_POST...' part is correct, as the code seems to do what it is supposed to when I take that part out, it just doesn't do what I want it to do.

So.. to clarify; I insert a task id (t_id) into the form, hit the submit button, and it is supposed to show the results (echo "ID: $id <br>";). I hope this makes sense to someone. Code:

View Replies !   View Related
Web Form Data To Database
I have a root access to a virtual server running UNIX and SQL.I would like to have data from a web form go to a database and perhaps be emailed to me also.Typically some one would complete a form and attach a file and that is emailed to me using a cgi script.
I would like to have this data populate a database.

where to start.If someone could give me a basic list of what needs to be done,I can tackle those and then fine tune my questions.

View Replies !   View Related
How Do I Put Form Data Into A Database?
I would like to take the form data submitted on a web page and put it into a database besides having the data emailed to me like is currently the case. I don't know where to start on this. I've never set up a database. Once in the database how do I get that data to my computer?

View Replies !   View Related
How Do I Sort Data Fro A Bad Form Into Something Useful?
I made a bad form with a form creation app in a hurry. Now I have a table that is nearly useless.

The form was meant to record teams for an upcoming volleyball tournament. I provided inputs for the school name, mascot, student, etc. The form app allows me to copy form elements, so I did.

The table now shows about 120 student, and grade, position, sorted by a form id (one for each team) but they are sorted by the record id.

Instead of:

Team | Student | Grade | Position | etc.....

I have:

record | name | value | etc...

I have tried some queries that just basically remove some superfluous column and GROUP BY record (that is the form id, so the third team to register has "3" under record.

Can I salvage this data by a clever query or am I looking at making a page via php to display the results?

Sample Data:

student name1 Curtis Geurts
student name1Tom Glasbergen
student name1Bill Lammers
student name1Marc Brouwer
student name1Kurt fledderus
student name1Nate Brink
student name1James Brouwer
student name1Scott Denbak
student name1Dave Stares
grade12
grade12
grade11
grade11
grade11
grade11
grade11
grade12
Player positionpower
Player positionsetter
Player positionmiddle
Player positionmiddle
Player positionpower
Player positionoffside
Player positionsetter
Player positionsetter

View Replies !   View Related
HTLM Form Link To Data In Mysql
I have a form that puts data into MySql and then in my website I have a table to display the Data. Everything works just fine at this point. The only thing left for me to do is that when the data is put into the table I want it so that one of the cells has a link, when the user clicks on it he can either see all the details from the data submited on the form in the same page or it is transfered to a new page with all the data submited in the form.

View Replies !   View Related
Import Data Form Txt Or Cvs File Format
I have a fully installed version of MySql Server 5.0 including MySql Administration, MIGRATION Tool, Query Browser and System Tray Monitor.

I have lots of Data stored in a txt File. I do not want to type them all in. How do I import Data from a txt or cvs File format? They are standardizes.

View Replies !   View Related
Inserting Data Into A Mysql Database Using A Form
I have been looking for a couple of days now trying to figure out how I can add data into a mysql database using a form. I know html but I am a total newbie at php and mysql. I really need some help on this.

View Replies !   View Related
Entering Form Data Into Multiple Tables
I've got a two tables in my database: "customers" and "orders."

I want to insert information from a form into both of them - in some cases identical information will need to be inserted into both.

The other twist is that I'd like to insert the automatically generated id customer 'id' value into the orders table.

I've tried using joins. Something like:

PHP Code:

INSERT INTO orders,customers (customers.id, customers.first_name, orders.del_address   .....)

View Replies !   View Related
Passing A Variable Form A Form To A Mysql Query In A Php Script
I have a form set up with a dropdown list of values for a field "Genre" in my database

I can pass the variable to my php script. I know this because I use:

$Genre = $_POST['Genre'];

echo "<h1> Query result for Genre = ","$Genre", "</h1>";

And the page prints the appropriate value chosen from the form.

I'm trying to use the $Genre variable in a mysql query to select records which match.

My mysql query works when I use the following code:

View Replies !   View Related
Data Insertion/Update Form Different Tables Into On Table
I have 3 tables say Employees, Benefits, Employee_Benefit_Mapping. These tables are something like this:

Employee:
========
Employee_Id
Name
Dept_Id
.
.

Benefits:
=========
Benefit_Id
Benefit Name
.
.

Employee_Benefit_Mapping:
=========================
Mapping_Id
Employee_Id
Benefit_Id

Its a many to many relation. Hence the mapping table.

Now the situation and question is:
====================================
Every employee "In a certain Dept" is eligible for some benefits by default. How can add these records with one (or minimum) insert statement(s) rather than going employee by employee?

Insert into Employee_Benefit_Mapping ((Select Employee_Id from Employee where Dept_Id = xx), (Select Benefits_Id from Benefits where Benefit_Id in(xx, yy)))

Will this work to insert all the data into the mapping table?

View Replies !   View Related
Enctype=multipart/form-data Wont Pass File Name
when i add enctype="multipart/form-data" to the form i cant get the file name into the databass... but if i leave that part out of the form then the files dont upload into my upload folder. so its either one or the other. is there a way to upload the file to my uploads folder and pass the data (filename) to the databass at the same time?
. . .
<form action="insert.php" method="post" enctype="multipart/form-data"> .....

View Replies !   View Related
“best-practice” Approach For Storing Form Structures And Their Data
I’m looking for a “best-practice” approach to creating a db structure that will handle form creation and storage dynamically.

FORM CREATION
The idea is to allow the client to create forms for their products by specifying attributes and values that belong to a product category.

The client will:
1.Enter a category # and name.
2.Enter the attributes available to the category.
3.Enter the values available for those attributes.

The application will:
4.Deduce the form based on what the client enters.

FORM STORAGE
What’s the best approach for then storing the form attribute/value pairs?

Is this a “wise” approach or is better to "hard-code" the forms with html and/or use a look-up table for the allowed attribute values of the fields? Do any of you have experience with this concept? Do you have any thoughts on it or a link to further reading?

View Replies !   View Related
Converting MS Access Dates To MySQL Dates During LOAD DATA INPUT ?
My insert code is below. The MySQL server is on my local machine and is version 4.1.22. I am exporting from an access table with 6 fields to a mysql table with those 6 plus 5 more fields. The main problem I am having SO FAR, is converting dates. The data file dates are formated like:
2/2/2006 0:00:00, 12/20/2006 9:22:05

Any ideas how to format those into mysql friendly dates?

Also, how do I convert currency fields in the load data process? I know you use SET by what kind of formula?

===========================================

LOAD DATA INFILE 'C:Documents and Settingspath_to_filedata.txt'
INTO TABLE auto
(field2, field3, field4, field5, currency_field6, field7, date_field8, date_field9)
SET id = MD5(UUID())
FIELDS TERMINATED BY ','
LINES TERMINATED BY '
'

View Replies !   View Related
Selecting Data Form One Table That Is Based On An Entry In Another Table
This is the code I am using:

***********
SELECT co_name,city,country,logo_small FROM $info WHERE $info.co_name=$categories.co_name AND WHERE $categories.everyday_wear='y' ORDER BY co_name ASC
***********

I am using a while loop in php to loop through all of the records but no records are being displayed. What am I missing? Do I need to use a JOIN statement?

View Replies !   View Related
Select Lastest Input To Data Base And Select Ordering From Last Member To First Member, Limiting Output Diplay To A Specific Number
how to display the latest members that signup to website, a query that that can select ordering them base on the last registered member to the first... then limiting output by say 50 members.

a sql statement that can select lastest input to data base and select ordering from last member to first member, limiting output diplay to a specific number

View Replies !   View Related
Formatting
I know this issue is very simple, but how can I format a numeric value returning a string with leading zeros?

Ex: 2 ---> 02
55 ---> 055

View Replies !   View Related
Column Formatting
Being new to mysql I have some queries about formatting a date column

1. Can I use dd-mm-yy, my website is Australian

2. Can I leave the date field in one row empty if the date is unknown.

3. If I only know the year an event took place, can I enter just the
year.

4. Would it be best if I used varchar for the column

View Replies !   View Related
Formatting Date
i've been trying to convert a user entered date string (dd-mm-yyyy) before entering it in the database.
i need to convert it to a mysql friendly format (yyyy-mm-dd).
i tried date_format and STR_TO_DATE, but they mess up the date.
i figure these cannot be used to that, therefore my question to this honorable audience is: "is there a mysql function that allows to convert the date format upon insert or update ?"

(of course i could do it in php, but i like to keep this in mysql)

View Replies !   View Related
Row Type To Keep Formatting
I am writing an app for our school newspaper to be posted online. I want to store everything in my MySQL db, but also want to keep the formatting when we put the articles in the DB. What should the row type be for this in order to keep the formatting (paragraphs mainly). Text puts it all together.Basically articles will be copied out of word into a <textarea> field and I would like to eliminate the need to build in a WYSIWYG editor if possible

View Replies !   View Related
Formatting The Time
Is there a function to convert a time like '1:30pm' to '13:30:00'?
I am taking a time input from a user using a HTML <select> tag. I want to take this change it two the TIME datatype.

View Replies !   View Related
Formatting Results
I want my results to be displayed in a table with 4 columns accross then repeat down the page. I've figured out how repeat them either across continually or down, but not 4 across then down. What code do I need to format the results the way I'm wanting?

View Replies !   View Related
Database Formatting
I've been able to create my stat database, and all is well. What I want to do now is color code the table, highlighting the hi values, by coloring that cell. I've created css styles for these.
How do I go about applying them. What do I need to do to make this happen?

View Replies !   View Related
Count Formatting In 4.1
I am having a really odd problem, I just upgraded from MySQL 4.0 to MySQL 4.1 and suddenly all my ASP code that is performing math against Counts is failing with a type mismatch, I have to assume for some reason that the data being returned by the count is formatted as text instead of integer now.

I could use some suggestions, either a way to force the output to be numeric, or something. Was this an intended change? It may be something completely unrelated but all my troubleshooting points to that count function, any pages where I am performing math on counts is now failing.

View Replies !   View Related
Formatting Dates
I've got a script that is designed to print entries in a table. This script uses a query:

$query="SELECT * FROM entries
ORDER BY time";
$result=mysql_query($query);entries: table
time: datetime field in table

And then a row count to print every entry:
$num=mysql_numrows($result);
$i=$num - 1;
while ($i > -1) {

$title=mysql_result($result,$i,"title");
$entry=mysql_result($result,$i,"entry");

echo "$title<br>$entry";

$i=$i-1;
}

Now, I would like to have the datetime field associated with every row printed as well, but I don't want it just printed as is, I can achieve that with:
$time=mysql_result($result,$i,"time");

echo "$title<br>$time<br>$entry";
But what I get looks something like:
2006-15-06 20:56:34

I'd like to get that more readable, and I understand the different symbols for each different way to display the date, but I don't know how to make this apply to the printing of the datetime field from each entry.

View Replies !   View Related
Formatting Localtime()
this is the normal format of the localtime()
yyy-ddd-mm hh:nn:ss
*n=minutes

that is the format i need
dd/mm/yyyy hh:nn:ss

i need to format into the following format and use it inside of query
select ... from... where time < newformat( localtime() )

how can i achieve the format i need?

View Replies !   View Related
Date Formatting:
If I have pulled the date from my MySQL datebase and $mydate displays as 2007-04-01 How do I format it with PHP to something more readable/


View Replies !   View Related
Set Formatting For Prices
I'm not entirely sure how to best achieve what I want to do here.

I have a mySQL backend on a PHP driven site. I want my client to be able to set the price of a product which is stored in said database. I'm wondering what the best way to format my sql table (or php code) to ensure that a price is always in the format of 0.00 (just 2 decimal places).

View Replies !   View Related
Formatting The Select Float
How to I get the results from selecting a float coloum to display as such?

xxxx.xx Just as you would any monitary value?

Tried TO_CHAR(float, "00.00")

View Replies !   View Related
Date Formatting For UNIX_TIMESTAMP
i've got such values in the table: 1157012562.

how to extract rows say for current month and current year?

PS i always dealt with ISO date format before and really stuck with NULL results i'm heaving using UNIX_TIMESTAMP() and YEAR() functions...

View Replies !   View Related
Formatting Airport Code
I have a string of airport codes formatted like this

KWIMAACCJTRZ

Every 3 letters is a complete airport code. i would like to know how I might format this so that I can query the database with one airport code at a time and return the result. The strings vary in length from one code to over 200 airport codes so I cant put them in a field each. so how might I do this also i need it so that I can creatte a dropdown menu with the results (just formatted in a way that I can do this via php as i already know how to do the dropddown menu). This is really complicated for me and I cant find any help on the internet for this so you are my last hope.

View Replies !   View Related
Date Formatting Using Str_to_date
I am having to read a field that is a varchar(20) that stores dates in the following format:

01-APR-2005 06:48:19

Is there anyway to select this field and have it output in the this format:

2005-04-01

I tried this sql query, but it only returned nulls:

SELECT str_to_date(
dateFieldToConvert, '%d.%m.%Y %H.%i')
FROM myTable


View Replies !   View Related
Text Field Formatting
I am on OS X, Apache, using MYSQL and PHP developing a database for my community theatre that includes a table for Board meeting minutes with the minutes being stored in a Text Field. I don’t need a whole lot of fancy formatting, but I would like to include a blank line between paragraphs. This does not seem to be a problem when the text is displayed within a text field within a form. I can include any number of lines between paragraphs and MySQL stores them and redisplays within the form.

The problem occurs when I bind the field to a page to display the minutes without a form field (and scroll bars) for printing. All the lines will run together with no breaks unless I use the php nl2br formatting command. Even then, only one <br > is inserted, regardless of how many blank lines are in the text field. Any suggestion on how I can maintain a blank line between paragraphs?

I know...the best way is to store the text as html and then display it via echo, but this is being designed for people who do not know html and will be typing up the minutes on their home computer.

View Replies !   View Related
Formatting HTML In A MySQL DB
I am placing formatted HTML data in a MySQL database. When I read the output of the database using PHP, I need to have the output formatted HTML (Bold, Italics, underlines, Paragraphs, etc...)

View Replies !   View Related
Formatting Phone Numbers
I am storing phone numbers as integers (1234567890) in my MySQL database. I was wondering how I could format the phone numbers as (999) 999-9999 when pulling them from the database in Query Browser (I'm actually using Coldfusion with MySQL and was hoping to get back the phone number already-formatted).

View Replies !   View Related
Formatting 'group By' Output
i would like to display a group of events based on time like so...

6:00pm
event 1
event 2
event 3

6:30pm
event 4

7:00pm
event 5
event 6

9:00pm
event 7
event 8

know the query for this?

View Replies !   View Related
How To Turn 5 Into May (date Formatting)
i have this:

SELECT MONTH(NOW())

which gives me 5

i need it to be in this format since i will be adding or subracting from this number
so i cant JUST use monthname (unless May + 1 = june!)

anyway.....

monthname needs a whole date ie xx-05-xxxx

so how to i turn this 5 into May?

View Replies !   View Related
Formatting Query Results?
I have a shell script (sh) that queries a MySQL database and then formats the results to an html page. I realize shell is probably not the best choice for this but it's all I know. My problem is that I need to do a mysql query for every field in every record in order to put it into the html page. This is obviously very slow. This is an example of what I'm doing now:

ProductLine=`mysql -u www -s support <<EOF
SELECT ProductLine FROM Documents WHERE ID = '$ID';
EOF`

DocType=`mysql -u www -s support <<EOF
SELECT DocType FROM Documents WHERE ID = '$ID';
EOF`

DocName=`mysql -u www -s support <<EOF
SELECT DocName FROM Documents WHERE ID = '$ID';
EOF`

FileName=`mysql -u www -s support <<EOF
SELECT FileName FROM Documents WHERE ID = '$ID';
EOF`

Like I said, I am doing this for every field in every record. It works but it is VERY slow. I thought if there was a way to tell the query to insert a special charater between each field then I could use awk to pick out the fields and only do one query per record... something like this:

SELECT ProductLine, DocType, DocName, FileName FROM Documents WHERE ID = '$ID';

I don't know how to take that output and put it into my shell variables.

View Replies !   View Related
Getting Info Out Of A Table, And Formatting It.
i have a table containing a bunch of rows.

Format of the table is

id name

and in the table i have things like:

1 Photoshop
2 Flash
3 PHP
4 CSS
5 HTML

etc, what i want to do, is get them out of the table, and format them to be like this:

<li class="brdmenulinks">Photoshop</li>
<li class="brdmenulinks">Flash</li>
etc...

in the order of there id.

View Replies !   View Related

Copyright 2005-08 www.BigResource.com, All rights reserved