★ wanayoo — archive 1999 http://www.devshed.com/Server_Side/PHP/Introduction/comments.html/c2832/Nouvelle recherche | Portail wanayoo

Developer Shed
Thursday, 08.17.2000  
Introduction to PHP and web database interfacing with MySQL. PHP3 is an HTML-embedded scripting language allowing web developers to create dynamic, database-driven websites.

HOME > SERVER SIDE > PHP > ARTICLE > COMMENTS    PHP SOURCE

Power Search
Free Newsletter:


Client Side
DHTML
Flash
Graphics
JavaScript
XML

Server Side
Administration
JServ
MySQL
Perl
PHP
Python
Roxen
Zend
Zope

Tools
HTML Editors
Graphic Editors
FTP Programs

Dev Talk
Forums
Mailing List
Book Samples
Brain Dump
Developer News
Feedback

ClipScripts
Add script
Edit script

Other Stuff
DevShed RDF
Propaganda!


Advertise
on DevShed
.
PHP3 Introduction
Introduction to PHP and web database interfacing with MySQL. PHP3 is an HTML-embedded scripting language allowing web developers to create dynamic, database-driven websites.

Name: Vinnie
Subject: Any current dynamic table update scripts available?
Date: 01-27-2000 02:47PM

I have put together a code using functions to: 1) Authenticate user based on the user table in mysql 2) Take the authenticated user to a display of a certain table, that I have formatted in HTML. Now what i'm trying to do is: 1) In the same step #2, give the user the option to delete or modify a row. But i have formatted the mysql row in HTML format to be as such: Example of SQL row #1 in table "em_table" customer, router_login, router_password, switch_login, switch_password How i have formatted it to display the "em_table" in an HTML form:


$customer |     Login    |    Password

Router:   $router_login   $router_password

Switch:   $switch_login   $switch_password

How can i offer the user a "button" that is besides each row that lets the user "delete" that specific row? Also, Now a bit more complicated, is how can i offer the user to "modify" a row? When he/she clicks on this "modify" button, he/she will be taken to another php3 form, where the form above will appear just as it is, but instead the "$" fields can be modified and having the original values as the standard "em_table row1" values? The code i'm using for adding an entry is below. That's the only code i have, and it still doesnt work(doesnt seem to pass the data to the database). I appreciate for any help guys... Vinnie


function addData() {
 global $mysqlHandle, $dbname, $tablename, $PHP_SELF;

    echo  "
<center><h2>Add a new entry</h2></center>

<div align=left>
<table cellspacing=0 cellpadding=8>
<form>
<form action='/old?u=http%3A%2F%2Fwww.devshed.com%2FServer_Side%2FPHP%2FIntroduction%2Fcomments.html%2Fc2832%2F%24PHP_SELF&y=1999' method=post>
<input type=hidden name=action value=addData_submit>
<input type=hidden name=dbname value=$dbname>
<input type=hidden name=tablename value=$tablename>
<input type=hidden name=id>
<font face=Arial>
  <tr>
    <td><b><font face=Arial>Customer: <input type=text name='customer' size=10></font></b>
</td>
    <td><font face=Arial color=red>Login</font></td>
    <td><font face=Arial color=red>Password</font></td>
    <td><font face=Arial color=red>Priv. Password</font></td>
  </tr>
<tr>
<td><font face=Arial color=red>Router:</font></td>
  <td><input type=text name='router_login'></td>
<td><input type=text name='router_password'></td>
    <td><input type=text name='router_priv_password'></td>
  </tr>
  <tr>
    <td><font face=Arial color=red>Firewall:</font></td>
    <td><input type=text name='firewall_login'></td>
    <td><input type=text name='firewall_password'></td>
    <td><input type=text name='firewall_priv_password'></td>
  </tr>
  <tr>
    <td><font face=Arial color=red>Gateway:</font></td>
    <td><input type=text name='gateway_login'></td>
    <td><input type=text name='gateway_password'></td>
    <td><input type=text name='gateway_priv_password'></td>
  </tr>
  <tr>
<td><font face=Arial color=red>Monitoring Server:</font>
</td>
    <td><input type=text name='monitoring_server_login'></td>
    <td><input type=text name='monitoring_server_password'></td>
    <td><input type=text name='monitoring_server_priv_pwd'></td>
  </tr>
  <tr>
    <td><font face=Arial color=red>Hubs+Switches</font></td>
    <td><input type=text name='hub_switch_login'></td>
    <td><input type=text name='hub_switch_password'></td>
    <td><input type=text name='hub_switch_priv_password'></td>
 </tr>
  <tr>
<td><font face=Arial color=red>Server</font></td>
    <td><input type=text name='server_login'></td>
    <td><input type=text name='server_password'></td>
    <td><input type=text name='server_priv_password'></td>
  </tr>
  <tr>
    <td><font face=Arial color=red>ADNX</font></td>
    <td><input type=text name='adnx_login'></td>
    <td><input type=text name='adnx_password'></td>
    <td><input type=text name='adnx_priv_password'></td>
  </tr>
  <tr>
    <td><font face=Arial color=red>IDNX</font></td>
    <td><input type=text name='idnx_login'></td>
    <td><input type=text name='idnx_password'></td>
    <td><input type=text name='idnx_priv_password'></td>
  </tr>
  <tr>
    <td><font face=Arial color=red>CSU/DSU</font></td>
    <td><input type=text name='csu_dsu_login'></td>
    <td><input type=text name='csu_dsu_password'></td>
    <td><input type=text name='csu_dsu_priv_password'></td>
  </tr>
  <tr>
    <td><font face=Arial color=red>Dial-in</font></td>
    <td><input type=text name='dial_in_login'></td>
    <td><input type=text name='dial_in_password'></td>
    <td><input type=text name='dial_in_priv_password'</td>
  </tr>
  <tr>
    <td><font face=Arial color=red>Dial-out</font></td>
    <td><input type=text name='dial_out_login'></td>
    <td><input type=text name='dial_out_password'></td>
    <td><input type=text name='dial_out_priv_password'></td>
  </tr>
</font></table>
</div>
<center><input type=submit value='Add this entry'></center>
</form>";

}

function addData_submit () {
        global $mysqlHandle, $dbname, $tablename, $fieldname, $PHP_SELF;

        mysql_select_db( mysql, $mysqlHandle );
        $query = "INSERT INTO em_table VALUES ('$id','$customer','$router_login','$router_
priv_password')";
        print $query;
        $result =  mysql_db_query("mysql",$query);

    listDatabases(  "" );
}
 

*Where listDatabases is another function to display the em_table, and it does work*




Other posts in this thread:
 Top
 • Any current dynamic table update scripts available?  Vinnie  01-27-2000 02:47PM 


Reply to this post:
Name:

Preview Comment.
Notify me of replies to this message.
Email:
Subject:
Tip: Put any source code between [code][/code] tags to increase readability


Visit the PHP Forum!

New On DevShed:
• MySQL Developer Contests PostgreSQL Benchmarks
• PHP 101 (part 3) - Chocolate Fudge And Time Machines
• MaxSQL Announced
•  PHP 101 (Part 2) - Shakespeare's Rose
• PHP 101 (Part 1) - Secret Agent Man
• The Search For The Perfect Web Host
• Perl 101 (Part 5) - Sub-Zero Code
•  Submit Your News..

Hot Forum Topics:
• Installing old IE browsers
• Auction Site
• Have anyone games written in php?
• open new window
• Calling a C program
• Problem with refersh...


Adsmart Network ad
Copyright © 1997-2000 ngenuity. All rights reserved. Privacy Policy.