Outputting A Table Or Form Using SHOW FIELDS FROM Table
In the code the MySQL database was queried using "SHOW FIELDS FROM table" which and the returned results of column names was then use to build an output for a form and a table with php using a series of if statements along the lines of if the returned field name matches something echo a text input field.
I have never seen this done this way before, so I want to get the opinion of the devshed user. Does it seem like an unsual long process to build up a form. Is there a security advantage doing it this way? Has anyone ever done it this way before?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Returning Table Name As Well As Fields From That Table
I am returning all fields from news and from regional, however I want to determine where the fields have come from when I ouput the data, therefore I need to return the table name with the fields. Is this possible? Code:
Show Table Only If There Is Data To Show?
I have a table that shows specific data (via a while loop) however, when you first log in as a new user, you see the table column headers but there is obviously no data, and it looks a bit unsightly. How could i take this code:
How To Get The Fields From A Table
Because the fields i make in the table are very subject to change and i want to know them without to have written in the php code. So i want to know all fields names from a table in a mysql database.
How To Show Table Based On Variable?
I want to display a table on a page based on whether a button is pressed or not. I'm new at php so I'm sure I'm making a basic mistake. Here's what I am trying. My thought was that $show_summary would switch states with each click but it is coming up always true. So I'm guessing that is the default setting when the page loads. Can someone please point out where I am going wrong? if(isset($_POST['summary'])) { $show_summary = true; } else { $show_summary = false; } <FORM method="POST" action="testpage.php"> <INPUT type="submit" name="summary" value="Show Summary"> </FORM> <?php if ($show_summary == true) { ?> <table border="1" cellpadding="3"> <tr> <td class="smallText" align="center" width="80%"><?php echo "URL"; ?></td> </tr> </table> <?php } ?>
Problem Sorting By 2 Fields From Table
As part of a rating system on my site, data for the total rating and also the number of votes gets added into a table. I am currently trying to query this table to get the highest rated row of data. This worked fine when I only had "ORDER BY rating DESC LIMIT 1" at the end of my query - It would select the row where the rating was 5 out of 5. I realised that if 2 rows had the same rating, I could not determine which one to select. So i tried changing the code to: "ORDER BY rating, num_votes DESC LIMIT 1". For some reason, this now selects a row where both the rating and num_votes values are 0. Just in case you need to see the entire query, here it is:
Merging Mysql Table Fields
How can I merge multiple fields of a table for my query. suppose I have 2 table table1 ============= field1 field1 ============= Lam 20 Ld 9 Auz 3 so I want to check where does keyword "Ld9" Exisit so what will me my query for select * from table1 where field1+field2=$keyword
Two Auto Incrementing Fields In One Table?
I have been trying to get two different rows to auto increment in the same table? If so how do i do it? it says u can only have one primary (obviously) and that is the auto incrementing field. Is there any way around this? here is the mysql error form phpmyadmin... #1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
Search 2 Fields In A Mysql Table Using Only 1 Input Box
I would like to search 2 fields in a table using only 1 input box in php, at the moment I have 2 input boxes one for the Town search and one for the County searh, I would like 1 input box that would search the 2 fields. Here is my PHP Code:
Change Values Of All Fields In Table In PhpMyAdmin
I would like to be able to change certain values in every row of a table. There are about 1000 or so row, and I need to change the values of certain fields to all the same value, and wondered if that was possible easily (and not having to do each row individually) in phpMyAdmin?
Combining Data From Two Fields, Displaying With Another Table
What I am trying to do is pull data from two tables and display it on one page. The code below doesn't display any errors, but all it prints is the results from the first query. Ideas? Thanks. (I also need to somehow put a variable in for the warranty table data so it is tied to the product_status table data. You can see there is a WHERE in the first query of pid, but no WHERE in the second query. That is a seperate question, though. It would make this way too long, so I will post it separately). PHP Code:
Grab Content From HTML Table And Place Into MySQL Table?
I am in the process of helping a co-worker upgrade some of his old static html pages into dynamic MySQL driven pages. He currently has a lot of pages with huge tables displaying data. Does anyone know if there is a script or class that can convert a table to a .sql file for upload?
Table Background Color Based On Results From MySQL Table
I am trying to get the "Did User Agree" field on a database query to be colored Green for "Agreed" Red for "Disagreed" and Blue for "Agreed (2nd Time)" .. I have my PHP setup to do the query just fine as of right now with alternating column colors, just can't seem to get the colors to work as I am hoping for. Can anyone help me get the Agreed? table's background color to the colors above? Code:
Finding Matches In A Table And Then Moving That Match To Another Table?
Ok, I have a database that has a table called critiera in this table is to fields on is ID and the other is critiera. Now I want to filter out all the one that don't apple to the list and move the one that match to a different database. I know how to open a connection, close, select but I don't know how I would inside of a database use another one as the way to create the list of critieras....
Mysql Fetch_field Gets Table Alias, Not Real Table Name
After a SQL 'select .... from tablename alias' the mysql_fetch_field function returns a value $result=>table which will contain the alias, not the actual table name. Is there a way to get the actual table name ? I am running mysql 4.1 and php 4.4
Using PHP To Sort Data In MySQL Table 1 By Values In Table 2
I have a MySQL database with 2 tables in it. products and prices.. Products has a field in it called 'prodno'. Prices has a field in it called 'prodid'. There is one of each item in products and each product has it's own unique 'prodno' There are multiple instances of each product's pricing in prices.. One for each price.. So if a product had multiple prices depending on quantity it would have an entry for each price.. Example: id = 1 prodid = 7001 qty = 300 price = 12.5 id = 2 prodid = 7001 qty = 400 price = 15.5 I was wondering if I could query the database getting info from the products table but sort it according to the prices in the prices table. Kinda like doing a "SELECT * FROM products" ordering it by the lowest price value from each item.. This is all very confusing to me, and I'm the one writing it. Let's try one last time.. Query the database selecting * from products (I plan on using all the info in products) and ordering them by the lowest price for each item in the prices table. I've tried sorting the results of just a basic SELECT * FROM products using Javascript and PHP but with pagination in the results it makes it a bit hard.
Update Table While Insert Data To Another Table
it seem like mine coding din work. [php]<? include("checkin.html"); $conn=mysql_connect('localhost','root','') or die ('Could not connect to server'); $today = date("Y.m.d"); mysql_select_db('hms', $conn); $ok = mysql_query("INSERT INTO check_in(ID,room_no,datein)values ('$ID','$room','$today')", $conn); if( $ok ){ $up = mysql_query("UPDATE studtable SET checked = 'checkin' where [ID] = '%ID'); if(mysql_affected_rows( $up ) == 1) { echo'Checked IN!' }else { echo'No such student to check in' }} else { echo'Check In FAILED, please check again'}?>[php]
Form / Table Classes
Do any of you guys know of a good form/table class combination to easily throw forms with embedded tables up to the screen? I've been trying to write one and it's a little more complicated than I originally thought.
SELECT * Form Table WHERE Function(??) BETWEEN ?? & ??
I have a CHAR(50) field in my table. This field stores datetimes in this format (i have no options to modify this stuff). 2001-02-16 00:00:00 Does anyone have an idea about how to make a function which allow me to: - The user inputs two dates in 2 input boxes...like these: 2001/02/16 & 2001/06/14 (or maybe user inputs data like 2001-02-16 & 2001-06-14) (i must check with javascript how the data is entered and then parse the 2 input boxes). Then i must list all data between 2001/02/16 & 2001/06/14 querying the table i told before.Does anyone have a good idea to do this?
Can't Update Mysql Table Via Php Form
I have a form that updates an item pulled from a database, but after the form is posted, it does not update the mysql database with the new info, here's what I am using: Code:
How Can I Find A Name From One Table In A Text From Another Table?
I have one table with a description field and other info, and I also have another table with a list of names and picture url:s. When I display the text description on my site I'd like to know if there are a match with a name from the 'names' table in the text. Code:
Form Data Array - Need To Update Table
I have a form that is dynamically generated by the fields I have in a table. This table generates the navigation for my site, and I want to create a page that will allow me to reorder and hide/show and activate/deactivate the links. The form is working and I have the form generating an array based on the data collected on submit. I need to know how to break this data apart so I can update my site navigation table with the correct values. The table looks like this:
Adding Thumbnails In A Table With Php From A Form And Opening....
I have an image uploader that works and i then want to use the images uploaded in a form which adds stock. i already have an add stock form but i want to add a new field and state the path of the image and then display the image as a small thumbnail in a table on another page and then wen the thumbnail is clicked on i would like it to enlarge in a small popup window. it seems like quite a mission to me and no matter what i do i cant get it to worhelp. Code:
PHP Form Overwrites MySQL Table Data
I have a PHP form sending data to a MySQL table, and I am wondering if I can add some sort of code to the PHP page that will make the form data overwrite any potentially old data already in the table.
Display Values Of The Form Inside The Table On The New Page
I am generating data from database and displaying it inside input text boxes (for users to make some changes). What I need to do is when user presses "submit" button display all of the results inside the table on the new opened page. How can I do it?
Create A Data Entry HTML Form For Given Table
I am working on a simple web site updating utility for a web site. Rather than hard code the data entry forms, I would like to automactically generate them based upon the table a user selects to update or insert into. What is the best way to approach this? for "insert" should I use the MySQL DESCRIBE table command and build a form element for each field according to its data type? for "update" should I use the DESCRIBE command to build the form as above and SELECT statement to populate each element with data, or should I just use a SELECT statement to retrieve the data and use php to determine the field type and choose an appropriate form element?
A Tool For Form Generation Based On A Mysql Table.
I'm looking for a tool that auto generates forms based on a mysql table. I need an interface that will allow: 1. picking a list of columns from the table (so a form that inputs only part of the table's columns is possible to generate). 2. picking a set of validation rules out of a predefined set of possible validators. An example usage of the tool will allow a webmaster to alter the details required for users sign up in two steps: 1. altering the mysql table adding some new columns. 2. picking which of the new columns should be requested in the signup form and how to validate each. After the second step the signup form will be automatically updated. Before starting to write such a tool I want to make sure that it doesn't already exist. Searching the web I found two similar projects: phpMyEdit(http:// www.phpmyedit.org/), and PHP Form Generator(http:// www.phpformgen.com). But both don't allow what I described above.
Generate An Html Form, To Be Submitted For Insertion To A 3rd Table
1. display a form consisting of radio buttons and check boxes. multiple selection of check boxes per radio button basically. I got this part done, it displays the data in the form which is being pulled from two separate tables. 2. Insert for each check box a record into a third table of the check box and radio button. this is what i have thus far and I'm not really sure why it's not working from what i can see step by step it should be inserting the records, these arrays are the most terrible thing i can think of having to do. Code:
Table Based Order Form That Can Email Text Entered?
I have a custom order form that I collaborated on with a friend who knows php. The form needs updated and the code we put together is hard for me to read and update. I think the form can be refined or rewritten in a more OOP way and hopefully as sematic as possible. The Form is for entering ready made frames. The Choices are color and size. Here is what I need to do: Enter Name, Email, Store Number, Comments Etc.Create a table based form where users can only enter numbers in each text field.Upon completion, agreement, and submission of the order an html email is kicked to our inbox. The table remains as it was on the website due to html and a separate print css file. Code:
How To Show Only Entered Fields ?
I am getting lost in showing data entered in a form to a confirm page. I have a form with as many list/menu as the categories existing in the database. DONE when user choose the items from the list/menus they are passed on to a second page where he can check if all data are correct and then send it. DONE However on the confirm page the script returns also empty lines of text for the missing fields. I would like to just have the fields entered by the user one after each other and not as they were on the first form. How can I get rid of the empty fields ? ( of course just removing the <BR> tag is not a solution ) I post the code of both pages below ( only the part of interest ) <form name="form1" method="post" action="send.php"> <p>Please check the data u entered</p> <p> <input name="hiddenField" type="hidden" value="<?php foreach ($_POST['field'] as $name=>$value) { echo nl2br("$value"); } ?>"> <?php foreach ($_POST['field'] as $name=>$value) { $split = split("=", $value); $pieces = explode("=", $value); echo nl2br("$pieces[1]<BR>"); } ?> </p>.....
Move Table Row To A New Table
I have a database of some information and it is in a table row by row. I have a page that displays these in a table row by row, however I want to have a link to the side of each row allowing me to transfer that row to a new table. How would I do this? I've tried a few ways but that was a random guess and didn't work.
Outputting Form Data Into Array..
how would I retrieve all values sent by a form with post method and put it in an array? I'm trying to do this because I have a form which has different inputs and textarea etc depending on some other variables. I'm then trying to read the data and pu it into a mysql command. I want to collect all the data from the form (regardless of what it is) and save it as an array which I can use.
Dynamic Form Fields/multiple Page Form?
It is for a friends out of print booksite, where visitors can request multiple books to be searched by adding one at a time to a cart (javascript), then once all added they submit to another form where they enter their personal details and all is sent through. The problem is at the moment they cannot change whats in the cart without refreshing the browser window and losing everything. 1) present for asking how many books they want to search for 2) display multiple rows of the same input fields depending on how many books they say they want to have searched for?i.e title|author|publisher|etc title|author|publisher|etc title|author|publisher|etc 3) when these are submitted they could see these above the next part of the form where they enter their details with the option to go back and delete/amend. 4) send all the info to my colleague. if so has anyone seen a similar script that I could take a look @ to see if I can hack it to suit my needs?
Could Someone Show Me How To Make A Form Handler?
I have tried and tried, but I can't seem to make a php form handler. I would love it to be able to check for required fields, and to be able to show the viewer their information before it is submitted, so they can make changes before it is submitted.
Show If Form Varible Not Empty
I need an alteration to my code to show region only if the form varible from the previous file is not empty. I have a list of properties in a table called employees, database name gcproperty. Some properties dont have full records in the fields (photo1, photo2, etc..........to photo9. and are empty. On the show all details page some images are blank as there is no record in the database or where drawn from the form varibles browse page that where also empty. Does this make sense? Code:
Form Doesnt Show Due To Php Conflict
I decided to load some of my form via php as it was needed to generate a combo box with infomation from a query.. this is what i have yet it doesn't load up on my browser.. Code:
Popup Window Show When Php Form Is Validated.
I am using a HTML/PHP form on a website I am doing. The form works and it even redirects to the correct page. However, instead of redirecting to a new page I would like it to call a popup window (600px x 400px)but leave the page that the form is on open so when they close the popup window the page is still there.
Process Form Fields
Hi, I need to process a generic html-form. Is there any way to access to the form elemts as an array?
Trying To Duplicate Form Fields.
What I would like is to when someone writes in one field. The same text is written in a seperate field. But without sending anything. all internally. Anyone have a clue?
Form Validation- One Of Three Fields
I've been looking for a PHP script to accept a search form for either the name or town or postcode fields to search a MySQL db. I would like the user to put in any one search field but not none. Also I am trying to figure out a select statment to select one item on a drop down form list or any item on the list eg the list would be dog, cat, horse, fish or all, the column would be pets. The search would pull out any single pet or all pets.
Populate In To The Form Fields
i worked on some programs that gets the datas from the user and insert them in to the database.now i want to retrieve the data from the database and i want them to populate in to the form fields.
|