Jump to content

gristoi

Members
  • Posts

    840
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by gristoi

  1. change :

    
    <td><? echo $rows['name']; ?></td>
    <td><? echo $rows['lastname']; ?></td>
    <td><? echo $rows['email']; ?></td>
    
    // link to update.php and send value of id 
    <td align="center"><a href="update.php?id=<? echo $rows['id']; ?>">update</a></td>

     

    to

    <td><?php echo $rows['name']; ?></td>
    <td><?php echo $rows['lastname']; ?></td>
    <td><?php echo $rows['email']; ?></td>
    
    
    <td align="center"><a href="update.php?id=<?php echo $rows['id']; ?>">update</a></td>
    

  2. try changing

    while($rows=mysql_fetch_array($result)){

    to

    while($rows=mysql_fetch_assoc($result)){

     

    also add

    echo mysql_num_rows($result);

     

    after your query to see if anything is actually being returned

     

  3. mysql_connect("xxx.xxx.com", "$username", "$password") or die( "Unable to connect to database");
    mysql_select_db("xxx") or die( "Unable to select database");
    mysql_query("INSERT INTO orderTable (ip, userId, userName, id, orderNum, orderDate, custEmail, firstName, lastName) 
    VALUES ('" . $REMOTE_ADDR . "', '" .  $_SESSION['user_id'] . "', '" .$_SESSION['user_name'] . "','', " . $order . ", '" . $today . "', '" . $b_email . "', '" . $b_first . "', '" . $b_last . "')");
    

  4.  
    
    <?php
    $filename = 'test.txt';
    $somecontent = "Add this to the file\n";
    
    // Let's make sure the file exists and is writable first.
    if (is_writable($filename)) {
    
        // In our example we're opening $filename in append mode.
        // The file pointer is at the bottom of the file hence
        // that's where $somecontent will go when we fwrite() it.
        if (!$handle = fopen($filename, 'a')) {
             echo "Cannot open file ($filename)";
             exit;
        }
    
        // Write $somecontent to our opened file.
        if (fwrite($handle, $somecontent) === FALSE) {
            echo "Cannot write to file ($filename)";
            exit;
        }
    
        echo "Success, wrote ($somecontent) to file ($filename)";
    
        fclose($handle);
    
    } else {
        echo "The file $filename is not writable";
    }
    ?>
    

     

    taken from php.net fwrite

  5. you need to know what the session variables are called. then it is just a matter of doing :

    <?php
    $user_id = $_SESSION['userId']; // given that the session is called userId
    $username =  $_SESSION['username']; // given that the session is called username
    ?>
    

    then use these variables to insert into the db

×
×
  • 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.