Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Posts posted by wildteen88

  1. @wildteen; If i use mysql_affected_rows() function it generates following error message.

     

    Warning: mysql_affected_rows() expects parameter 1 to be resource, string given in C:\wamp\www\MySite\php files\approve_page.php on line 36

    What variable are you passing mysql_affected_rows? You should be giving it the $result variable not the $query variable.

  2. You should only add the session keys to $session_array not the session values

    $session_array = array('userid', 'username', 'email', 'user_level', 'encrypted_id', 'encrypted_name', 'encrypted_email', 'encrypted_user');

     

    Then your foreach loop should be

    foreach($session_array as $key) {
    	if(strcmp($_SESSION[$key], $items[$key]) != 0) {
    		return false;
    	}
    }

  3. To insert the latest post so it at the top you'll need to change the way your script adds the comments to messages.txt. As it is now your appending the latest comment to the file, which means the latest comment will always be added to the end of file.

     

    In order to add the latest comment so it at the top of the file you'll first need to get all the comments that is in messages.txt and then prepend the latest comment. Which will be like this:

    // add the newest comment to the start of the file
    $comments  = "<div id=\"comments_box\"><div id=\"comment_name\"><p>$message <em>Says:</em></div><br />$message2</p></div>"; // this is the new comment to be added
    $comments .=  file_get_contents('messages.txt'); // now we get all the existing comments and append it to the $comments variable.
    
    // write all the comments back to the file with the newest comment first
    $fp = fopen('messages.txt', 'w');
    fwrite($fp, $comments);
    fclose($fp);

     

    To add the date look into using the date function.

  4. The sid is being passed as an hidden input field

    <td><input name="id" type="hidden" id="id" value="<? echo $rows['sid']; ?>"></td>

    The hidden input field name is called id to get the sid you'd use $sid = $_POST['id'];

  5. This is your form input fields.

    <td><input name="stitle"     type="text" id="stitle"     value="<? echo $rows['stitle']; ?>" size="15"></td>
    <td><input name="datepicker" type="text" id="datepicker" value="<? echo $rows['datepicker']; ?>"></td>
    <td><input name="sbody"      type="text" id="sbody"      value="<? echo $rows['sbody']; ?>" size="15"></td>
    <td><input name="ipaddress"  type="text" id="ipaddress"  value="<? echo $rows['ipaddress']; ?>" size="15"></td>
    <td><input name="date"       type="text" id="date"       value="<? echo $rows['date']; ?>" size="15"></td>

    Each fields value is stored within the $_POST superglobal array when the form is submitted.

     

    The form is submitted to update_ac.php. In this file before line 17 you need to extract these values from the $_POST superglobal array. Here is an example of getting the first two values from your form

    $stitle = $_POST['stitle']; // get the value from the form field named "stitle"
    $datepicker = $_POST['datepicker']; // get the value from the form field named "datepicker"
    // etc 

    See if you can work out how to get the remaining values from your form.

  6. The variables $stitle, $datepicker, $sbody and $sid are not defined in update_ac.php. Variables need to be defined before you can use them.

     

    Line 17 in update_ac.php is where you using these undefined variables

    $sql="UPDATE $tbl_name SET stitle='$stitle', datepicker='$datepicker', sbody='$sbody' WHERE sid='$sid'";

     

    I suspect these variable are from your form. In which case you need to get them from the $_POST superglobal variable first. Example

    $stitle = $_POST['stitle'];
    $datepicker = $_POST['datepicker'];
    // etc 

  7. That SSD is fine, it is one of the best 1st generation SSDs. I have the 64GB version and I have no issues with it. To get the maximum speed make sure you connect it to a SATA 3 6Gb/s port. If you don't have a 6Gb/s port it still work fine on a standard SATA 2 3Gb/s port at reduced speed which you will hardly notice.

  8. And is this the following code  executed within the while loop?

    <div id="google_map">
    <div align="right" style="padding:4px; background-color:#D2F0D3;"><a href="#" onclick="return false" onmousedown="javascript:toggleViewMap('google_map');">close map</a></div>
    <?php echo'<iframe width="550" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/api/staticmap?center='. $lat .',' . $lon . '&zoom=12&markers=color:red|label:B|' .$lat . ',' . $lon . '&size=550x300&sensor=false">">';?></iframe>
    <div align="left" style="padding:4px; background-color:#D2F0D3;"><a href="#" onclick="return false" onmousedown="javascript:toggleViewMap('google_map');">close map</a></div>
        </div>

    If you place it after the while loop then only last $lat and $lon values will be used.

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