We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion
Good Day Experts,,can anyone help me,,i have a codes for inserting,selecting and deleting row data from original table into archieve table: this is the original table `Username password fullname year course breakzzz breakzzzz romel first year prog.` and this is my archieve table: `username password fullnae year course` my plan…

It looks as though you're using single quotes instead of backticks. 'this' is not the same as `this`. If this is the case, the backtick key is usually the one before '1' on the keyboard. Press this once followed by another key.

diafol
Keep Smiling
Moderator
10,842 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,537
Skill Endorsements: 61
<?php
include('config2.php');
if(ctype_digit($_GET['id'])){
    $id = $_GET['id'];
}
$insert_result = mysql_query("INSERT INTO archieve (username, password, fullname, course, year, status) SELECT `username`, `password`, `fullname`, `course`, `year`, `status` From `account_student` WHERE id = '$id'") or die (mysql_error());

$select_result = mysql_query("SELECT `id`,`username`, `password`, `fullname`, `course`, `year`, `status` From `account_student` WHERE id = '$id'") or die (mysql_error());


while ($row = mysql_fetch_array($select_result))
{
     echo '<td><center><a href="write_message.php?id=' . $row['id'] . '">' . $row['fullname'] . '</a></center></td>';
                echo '<td><center>' . $row['username'] . '</center></td>';
                 echo '<td><center>' . $row['password'] . '</center></td>';
                 echo '<td><center>' . $row['fullname'] . '</center></td>';
                  echo '<td><center>' . $row['course'] . '</center></td>';
                    echo '<td><center>' . $row['year'] . '</center></td>';
}
?>

Also for back referencing you might want to store the id too:

$insert_result = mysql_query("INSERT INTO archieve (id, username, password, fullname, course, year, status) SELECT `id`,`username`, `password`, `fullname`, `course`, `year`, `status` From `account_student` WHERE id = '$id'") or die (mysql_error());
Biiim
Posting Pro
504 posts since Oct 2011
Reputation Points: 104
Solved Threads: 83
Skill Endorsements: 7

,,soory,,first time to heard the backticked..:}

wew,,,,you all great here sir ardav,vedeoo,and biim,,very,very,appreciated your help,,i have now the complete working codes..

<?php
include('config2.php');
if(ctype_digit($_GET['id'])){
    $id = $_GET['id'];
}
$insert_result = mysql_query("INSERT INTO archieve (username, password, fullname, course, year, status) SELECT `username`, `password`, `fullname`, `course`, `year`, `status` From `account_student` WHERE id = '$id'") or die (mysql_error());

$select_result = mysql_query("SELECT `id`,`username`, `password`, `fullname`, `course`, `year`, `status` From `account_student` WHERE id = '$id'") or die (mysql_error());

$delete_result = mysql_query("DELETE FROM account_student WHERE id = '$id'") or die (mysql_error());
while ($row = mysql_fetch_array($select_result))
{
     echo '<td><center><a href="write_message.php?id=' . $row['id'] . '">' . $row['fullname'] . '</a></center></td>';
                echo '<td><center>' . $row['username'] . '</center></td>';
                 echo '<td><center>' . $row['password'] . '</center></td>';
                 echo '<td><center>' . $row['fullname'] . '</center></td>';
                  echo '<td><center>' . $row['course'] . '</center></td>';
                    echo '<td><center>' . $row['year'] . '</center></td>';
}
?>
breakzzzz20
Junior Poster in Training
60 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 1 Year Ago by veedeoo, Biiim, diafol and 1 other

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
 
© 2013 DaniWeb® LLC
Page generated in 0.3196 seconds using 2.69MB