Re: Dynamically update mysql field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think what you're asking is how can you have a form pull data from your
database, populate the form, but then have fields to the side so the user
and update the database based on the user input.

Kind of like a "Change my personal information" page.

I would do it like this:

1.  Write your query to pull all your current data from mysql.
2.  Assign the output into variables (my_value_1, my_value_2 etc..)
3.  Make your form objects have the value you just pulled.
4.  Put a submit button at the bottom of the page to save the changes.
5.  Upon submit have the page refresh itself to display the new values.

<TR  ALIGN="CENTER" HEIGHT="80" >
  <TD> data from mysql :<br><b>SAM <br><input type="submit" name="update"
value="update this   cell"><br><font color ="red">You can change the
information and submit it to mysql to update the original database.</font>
</TD>
  <TD> data from mysql :<input type="text" value="<?php echo $my_value_1;
?>" name="value_1"> </TD>
  <TD> data from mysql :<input type="text" value="<?php echo $my_value_2;
?>" name="value_2">  </TD>
  <TD> data from mysql :<input type="text" value="<?php echo $my_value_3;
?>" name="value_3">  </TD>
  <TD> data from mysql :<input type="text" value="<?php echo $my_value_4;
?>" name="value_4">  </TD>
</TR>





On 5/9/07, Aleksandar Vojnovic <muadib@xxxxxxxxxxxxxx> wrote:

Sorry I still don't understand. Do you wish to display/reload the data
on some timeout (ala AJAX) or you actually wish to update the data from
this form into the MySQL?

Aleksander

sam rumaizan wrote:
> *Copy and paste my code in your editor and run it then you will
> understand what I need*
>
> *<------------------------------------------------start code
> --------------------------------------->*
> *<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
> <HTML>
> <HEAD>
> <TITLE>data</TITLE>*
> *</HEAD>*
> *<BODY>*
> *<H1> <font color ="red">You can change the information in any cell
> and submit it to mysql to update the original database.*
> *Basically when the user views his/her information he/she should have
> the option to change the information.</font>
>  </H1>
> <form>
> <TABLE  BORDER=1 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
> <TR ALIGN="CENTER">
>  <TH>NAME</TH>
>  <TH>JOB TITLE</TH>
>  <TH> COLOR</TH>
>  <TH>ADDRESS</TH>
>  <TH>PHONE NO</TH>
> </TR>
> <TR  ALIGN="CENTER" HEIGHT="80" >
>  <TD> data form mysql :<br><b>SAM <br><input type="submit"
> name="update" value="update this cell"><br><font color ="red">You can
> change the information and submit it to mysql to update the original
> database.</font> </TD>
>  <TD> data form mysql :<br><b>ENGENEER </TD>
>  <TD> data form mysql :<br><b>RED </TD>
>  <TD> data form mysql :<br><b>OKLAHOMA </TD>
>  <TD> data form mysql :<br><b>405-12452 </TD>*
> *</TR>
> <TR  ALIGN="CENTER" HEIGHT="80" >
>  <TD> data form mysql :<br><b>JOHN </TD>
>  <TD> data form mysql :<br><b>DESIGNER <br><input type="submit"
> name="update" value="update this cell"><br><font color ="red">You can
> change the information and submit it to mysql to update the original
> database.</font> </TD>
>  <TD> data form mysql :<br><b>BLUE </TD>
>  <TD> data form mysql :<br><b>COLORADO </TD>
>  <TD> data form mysql :<br><b>303-5458 </TD>*
> *</TR>*
> *<TR  ALIGN="CENTER" HEIGHT="80" >
>  <TD> data form mysql :<br><b>MIKE</TD>
>  <TD> data form mysql :<br><b>STUDENT </TD>
>  <TD> data form mysql :<br><b>GREEN<br><input type="submit"
> name="update" value="update this cell"><br><font color ="red">You can
> change the information and submit it to mysql to update the original
> database. </font> </TD>
>  <TD> data form mysql :<br><b>UTAH </TD>
>  <TD> data form mysql :<br><b>504-5670 </TD>*
> *</TR>*
> *<TR  ALIGN="CENTER" HEIGHT="80" >
>  <TD> data form mysql :<br><b>JULI</TD>
>  <TD> data form mysql :<br><b>TEACHER</TD>
>  <TD> data form mysql :<br><b>PINK<br><input type="submit"
> name="update" value="update this cell"><br><font color ="red">You can
> change the information and submit it to mysql to update the original
> database.</font> </TD>
>  <TD> data form mysql :<br><b>TEXES </TD>
>  <TD> data form mysql :<br><b>405-6364 </TD>*
> *</TR>
> </TABLE>*
> **
> * *
> *
> </form>*
> * *
> *</BODY>
> </HTML>
> *
> *<------------------------------------------------End code
> --------------------------------------->*
> * *
> *
> /Aleksandar Vojnovic <muadib@xxxxxxxxxxxxxx>/* wrote:
>
>     Of course it can be done, but please be more specific about what you
>     wish to achieve.
>
>     Aleksander
>
>     sam rumaizan wrote:
>     > Dynamically update mysql field
>     >
>     > I have a function that will populate the table cells (TD) with
>     data (information) from mysql database.
>     > What I need to do is to allow the user to update the cell
>     information (information was pulled from mysql database) from the
>     table cells (TD) then the data get updated in mysql. So when I
>     pull the data again I can see the new information.
>     > Is there any way to do this using PHP?
>     >
>     >
>     >
>     >
>     >
>     >
>     > ---------------------------------
>     > Ahhh...imagining that irresistible "new car" smell?
>     > Check outnew cars at Yahoo! Autos.
>     >
>
>
>
>
>
>
> ------------------------------------------------------------------------
> Get your own web address.
> <
http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL
>
> Have a HUGE year through Yahoo! Small Business.
> <
http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL
>

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux