bilis_money Posted August 19, 2006 Share Posted August 19, 2006 hi peoplei'm trying to copy all the records that is related to my search.my first table is 'topics',and the 2nd table is 'topics_tmp'.and the codes that producing an error is here below,[code]//Empty temporary table topics_tmp then fill again with contents from topic_rel[] for($x=0; $x<=$total_rec; $x++){ //select records from table TOPICS first $query = "SELECT * FROM topics WHERE id='$topic_rel[$x]'"; $result = mysql_query($query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $id_tmp = $row['id']; $title_tmp = $row['title']; $descrip_tmp = $row['description']; $url_tmp = $row['url']; //then insert selected data into TOPICS_TMP temporary table $query = "INSERT INTO topics_tmp (id, title, description, url) VALUES ('$id_tmp', '$title_tmp', '$descrip_tmp', '$url_tmp')"; mysql_query($query) or die('Error, insert query failed'); }[/code]when i execute it the error message is showing up -->'Error, insert query failed'.now what was my mistake here? am i doing the right copying from 1st tableand inserting the records into 2nd table?Or do i have syntax error here?Thank you very much in advance... for your kind help. Quote Link to comment Share on other sites More sharing options...
bilis_money Posted August 19, 2006 Author Share Posted August 19, 2006 and by the way i am using 'topic_rel[]' an array as my temporary storage of all related topics. am i using it the right way?thanks again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.