0

I have created form to add general information about daily work. When I submit this form it will give me following error. Please help me. I have checked my setting.php. There prefix is drup_

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'i1164525_drup1.drup_drup_Detailstable' doesn't exist: INSERT INTO {drup_Detailstable} (Username, Email_Id, Work_Location,Team_size,Total_hours,Date,Description,Verified) VALUES ('admin','[email protected]','abc','1','20','12/12/2014','Test','Not Verified'); Array ( ) in eval() (line 43 of /home/csrdiarycom/public_html/modules/php/php.module(80) : eval()'d code).

 <form name="form" method="post" action=''<?php echo $_SERVER['PHP_SELF']; ?>">
 <label>Work Location</label>
 <input type="Text" name="location" value=""/>
 <label>Individual/ Number of people</label>
 <input type="Text" name="numberofpeople" value=""/>
 <label>Date</label>
 <input type="Text" name="date" value=""/>
 <label>Total Time spend by You/Team(In Hours)</label>
 <input type="Text" name="Totalhours" value=""/>
 <label>Your Experience</label>
 <textarea row="5" maxlength="200" cols="30%" name="comment">Type here</textarea>
 <input type="Submit" name='Submit'/></form>
 <?php
 if(isset($_POST['Submit']))
 {
   $location=$_POST['location'];
   $numberofpeople=$_POST['numberofpeople'];
   $Totalhours=$_POST['Totalhours'];
   $date=$_POST['date'];
   $comment=$_POST['comment'];
   db_query("INSERT INTO {drup_Detailstable} (Username, Email_Id, Work_Location,Team_size,Total_hours,Date,Description,Verified) VALUES ('$e','$e','$location','$numberofpeople','$Totalhours','$date','$comment','Not Verified')")->execute();
  echo "<h2>Thank you for your Comment!</h2>";
  }}
  ?>  
2
  • Looks like the drup_ prefix is automaticly added to your query. Now it is looking for the table drup_drup_Detailstable
    – Akko
    Commented Feb 4, 2015 at 6:14
  • So can i replace drup_Detailstable to Detailstable Commented Feb 4, 2015 at 6:15

2 Answers 2

1

Remove the 'drup_' prefix from your db_query call. Since you define a prefix in settings.php, using {Detailstable} will automatically add the prefix on lookup.

0

This can be done from phpmyadmin or drush.

drush sql-cli

mysql> DELETE FROM field_config WHERE field_name = [‘field_DELETED_FIELD’];

mysql> DELETE FROM field_config_instance WHERE field_name = [‘field_DELETED_FIELD’];

Clear cache after deleting i.e. drush cc all

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.