Jump to content

Mahngiel

Newly Registered
  • Posts

    1,068
  • Joined

  • Last visited

Posts posted by Mahngiel

  1. ;) Thank you! It works! Just what I needed. Something simple. How compatible is Ajax with browsers?

     

    You're welcome.

     

    AJAX is really just a bunch of javascript with a few exceptional calls.  It's pretty much supported by every browser, unless you're using IE 3 or something.  You can read up more on it and it's calls on just about as many places as you'll find PHP tuts.

  2. I suggest using AJAX.  I use it on my own site, to perform the same function. Here is some of the code:

     

    index page head

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="js/linkget.js"></script>
    </head>

     

    the first script is a global script, much like prototype.js.  The second is where you manage your links:

    $(document).ready(function(){
    // load about page when the page loads
    $("#response").load("about.php");
    // load another page
    $("#another").click(function(){
     	$("#response").load("another.php");
    });
    // load another page
    $("#another1").click(function(){
     	$("#response").load("another1.php");
    });
    });

    Where $(#another).click(function(){

    $"#response").load("another.php");

    id tag of the link, id tag of where you want it to go (this MUST stay as #response, as it's defined in the outside javascript), and page

     

    And on the page, call to the links as so:

    <a href="#" class="nav" id="about">About</a>
    <a href="#" class="nav" id="another">Another</a>
    <a href="#" class="nav" id="another1">Another1</a>
    
    <div id="#response">&nbsp</div>
    

     

    This is what you should be doing instead of trying to fuss with includes.

     

  3. Please post your current code between

    
    

    tags.

     

    Ken

    From what i'm gathering, he's only looking to create backups that are then viewable. 

     

    My skill is limited, however, I would imagine that you could do something similar to this:

    $tbl_backup = mysql_query("SELECT * FROM 'table");
    $myFile = "backup.xml";
    $fh = fopen($myFile, 'w') or die("can't open file");
    fwrite($fh, $tbl_backup);
    fclose($fh);
    

  4. So, to clarify what you're looking for help on:

     

    1) You have some pages on your server that displays database info

    2) You wish to make a script that takes that page,

    3) Parses it in an XML format, and

    4) Saves it accordingly, on the server

     

    I got that correctly?

  5. You never close the quoted string for the first href attribute, use this code instead:

    Beat me to it.

     

    BTW, when I use php and echo to form pages, i only use a single apostrophe, so that I can clearly see quotations for values. ie:

    echo '<input type="text" name="'.$var.'" />';

  6. wow. that post got completely ruined by the forum somehow.  luckily i copied it first:

    ok, let's do this:

     

    I'm not sure which row is the meat of the data, but you said you have ID field.  I am implying that your ID field is an auto-incrementing integer, which does no good in identifying it from a stand-alone page.  Let us augment the ID field as I've described, and give the row ID a name.  So your insert query would be like such

    " INSERT INTO 'mytable' (IDname, due_ge, due_rk, due_ny) VALUES ( ...);

    Naming the ID allows us to have a singular page where you can update from.

    On your edit page, I would put a dropdown menu that can have an option for each row.

     

    <?php 
    include ('connection.php');
    echo'
    <form method="POST" name="due_update" action="due_update.php">
    <select name="IDname">
            $list = mysql_query("SELECT * FROM 'mytable' ")
    while($row = mysql_fetch_array($list)){
    echo '<option value="'.$row['IDname'].'">'.$row['IDname'].'</option></select>';
            echo '<input type="text" name="'.$row['due_ge'].'" value="'.$row['due_ge'].'" />
                     <input type="text" name="'.$row['due_rk'].'" value="'.$row['due_rk'].'" />
                      <input type="text" name="'.$row['due_ny'].'" value="'.$row['due_ny'].'" />';
             }
            echo '<input type="submit" value="Update!" />';
    

    What this should do is populate a dropdown menu given by the ID of the row (so it can be identified), then auto-fill the text boxes with the values.  So all you have to do is update what you want to, then hit submit.

    Tip: You should move your connection information to  standalone php file so you can just call on it instead of repeating it.  (that's the file i included at the top).

     

    From there, all you need to do is write the update script which basically consists of:

    <?php
    include('connection.php');
    
    mysql_query("UPDATE mytable SET due_re = '$_POST['due_re']' AND due_rk = '$_POST['due_rk'] AND due_ny = '$_POST['due_ny'] WHERE IDname = '$_POST['IDname'] ");
    header("Location: xxx");
    ?>
    

     

    Where location is where u wanna go after the script is compiled, or omit it and echo out some verifications or what not.  Be advise, this code is pretty generic and shouldn't be used exactly as is, but should work to give you a feel for what's going on.

  7. ok, let's do this:

     

    I'm not sure which row is the meat of the data, but you said you have ID field.  I am implying that your ID field is an auto-incrementing integer, which does no good in identifying it from a stand-alone page.  Let us augment the ID field as I've described, and give the row ID a name.  So your insert query would be like such

    " INSERT INTO 'mytable' (IDname, due_ge, due_rk, due_ny) VALUES ( ...);

    Naming the ID allows us to have a singular page where you can update from.

    On your edit page, I would put a dropdown menu that can have an option for each row.

     

    <?php

    ;

    echo'

    <form method="POST" name="due_update" action="due_update.php">

    <select name="IDname">

            $list = mysql_query("SELECT * FROM 'mytable' ")

    while($row = mysql_fetch_array($list)){

    echo '<option value="'.$row['IDname'].'">'.$row['IDname'].'</option></select>';

    }

     

    <input type="text" name="

  8. I have no clue where to start as I know very little about PHP.

    First thing, I would recommend going to www.w3schools.com and viewing their PHP tutorial.

    The mysql database name is flow & the table name is info.

    The fields in the database that you see in the photo is due_ge, due_ny, and due_rk.

    The page I go to view the data in the mysql database is named view.php & the file I use to enter a new record is named add.php. If I could click the "edit" button to somehow edit these date fields that would be great!! Could someone start me in the right direction?

    What you would be doing is UPDATE(ing) the the columns. First, you need a form on the linked edit page.  I would make 3 text areas and assign each of them a name based on the column you wish to edit.  Then create the script that edits the chosen material. An example would be:

    <form name="table_edit" actoin="editing_script.php"><input type="text" name="due_ge" />

    <?php $ch_ge = $_POST['due_ge'];
    mysql_query(" UPDATE 'table name' SET due_ge = '$ch_ge' WHERE id = 'parameter you need to define' ");
    

    Of course, you need to know which row to change the column data for, so do a little bit of research on how to it works and decide how to wish to edit your data.  Good Luck!

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.