Wat wr0ng with thiz c0de

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Wat wr0ng with thiz c0de

    Pleaze c0derz check this c0de and c0rrect, it d0ez n0t insert data into database.
    PHP Code:
     <?php

    error_reporting
    (1);
     
    require(
    "include/init.php");
     
    include(
    'top.php'); include('header.php'); include('navbar.php'); include('shoutbox.php'); 

    $mem=mysql_real_escape_string($_POST['member']); 
    $visitor=mysql_real_escape_string($_POST['visitor']); 
    $fin=mysql_real_escape_string($_POST['footerin']); 
    $fout=mysql_real_escape_string($_POST['footerout']); 
    $css=mysql_real_escape_string($_POST['style']); 


    if(
    $_POST)
     {
    $time=time(); 
    $db->update_data("UPDATE b_forum SET member='$mem', visitor='$visitor', footerin='$fin', footerout='$fout', style='$css', time='$time'"); 
    echo
    "SITE UPDATED"; }

    ?>
     <form name="uform" action="admin.php" method="POST">
     <table>

    <div class="advert">WELCOME MESSAGE FOR VISITOR <br>
    <textarea rows="5" cols="50" name="visitor" value="<?php echo $forum->visitor;?>"></textarea>
    </div><br/>

    <div class="advert">WELCOME MESSAGE FOR MEMBERS <br>
    <textarea rows="5" cols="50" name="member" value="<?php echo $forum->member;?>"></textarea>
    </div><br/>

    <div class="advert">FOOTER MESSAGE FOR MEMBERS <br>
    <textarea rows="5" cols="30" name="footerin" value="<?php echo $forum->footerin;?>"></textarea>
    </div><br/>

    <div class="advert">FOOTER MESSAGE FOR VISITOR <br>
    <textarea rows="5" cols="30" name="footerin" value="<?php echo $forum->footerout;?>"></textarea>
    </div><br/>

    <div class="advert">SITE STYLE <br>
    <textarea rows="18" cols="50" name="css" value="<?php echo $forum->style;?>"></textarea>
    </div><br/>

    <input type="submit" name="comment" value="comment"/>
    </form><br/><br/> </table>
     </form>

    #2
    try:
    PHP Code:
    "UPDATE b_forum SET member='".$mem."', visitor='".$visitor."', footerin='".$fin."', footerout='".$fout."', style='".$css."', time='".$time."'" 

    Comment


      #3
      Originally posted by something else View Post
      try:
      PHP Code:
      "UPDATE b_forum SET member='".$mem."', visitor='".$visitor."', footerin='".$fin."', footerout='".$fout."', style='".$css."', time='".$time."'" 
      thanx, but ztill n0t w0rking. C0uld da pr0blems be fr0m databaze? CREATE TABLE `b_forum` (
      `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
      `member` text NOT NULL,
      `visitor` text NOT NULL,
      `footerin` text NOT NULL,
      `footerout` text NOT NULL,
      `style` text NOT NULL,
      `time` bigint(20) unsigned NOT NULL,
      PRIMARY KEY (`id`)
      ) ENGINE=InnoDB;

      Comment


        #4
        you forgot "WHERE id=something" if you update something,
        and if you want to insert something you have to do it this way:

        PHP Code:
        "INSERT INTO b_forum SET member='".$mem."', visitor='".$visitor."', footerin='".$fin."', footerout='".$fout."', style='".$css."', time='".$time."'" 
        also probably the db class has a different function, instead
        $db->update_data(
        it should be $db->insert_data(
        Advertise your mobile site for FREE with AdTwirl

        Comment


          #5
          Originally posted by GumSlone View Post
          you forgot "WHERE id=something" if you update something,
          and if you want to insert something you have to do it this way:

          PHP Code:
          "INSERT INTO b_forum SET member='".$mem."', visitor='".$visitor."', footerin='".$fin."', footerout='".$fout."', style='".$css."', time='".$time."'" 
          also probably the db class has a different function, instead
          $db->update_data(
          it should be $db->insert_data(
          Thanx itz n0w w0rkin with inserting data. I think i have to delete the 'id' in database to be able to Update, coz i wanted to update...

          Comment

          Working...
          X