Jump to content

chelsea7

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

chelsea7's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yes, the second field is valid. I\'m going to try the example DylanBliz gave me. I\'ll let you all kno of the outcome. I had this problem similar to this one. The \'Insert\' command would work in direct mode at the mysql prompt but would not work in the php code. I really didn\'t do anything to correct it. But the following day it worked in the php code. Thanks Chelsea7
  2. O.K., yes I did not include the ID field. The record copies into the second table and the auto increment gives the next available ID/record number. But I then noticed something strange. Take a look at this code; $sql = \"INSERT INTO oldtable (`imagefilepath`) select (`imagefilepath`) from newtable where ID=$count\"; The above works fine. However, if I add another column see below; $sql = \"INSERT INTO oldtable (`imagefilepath`,`v5`) select (`imagefilepath`,`v5`) from newtable where ID=$count\"; Nothing happens. That is the records will not copy to the oldtable. If I just use one column or \'Select *from new table\', that\'s not a problem. Is there any reason why it won\'t take more than one column? It works with the regular \'Insert\' commands I have in php. Thanks Chelsea
  3. Yes, the primary key is also auto increment. But if I remove the auto increment, wouldn\'t that allow for duplicates in the table? In this situation, the ID\'s must be unique because they are updated by the user . So let\'s say record ID 5 is to be updated or deleted, there can only be one record ID 5 otherwise two records will be deleted. If I\'m understanding the solution correctly. Is there a way perhaps that I can have php find the last record in the second table and add the next record to it? ie the first table record is 2 the last record in the second table is 68. Can I simply insert the record into the second table to be the 69th record? This way I won\'t have to worry about that error previously stated. Thanks Chelsea
  4. I would like to use php code to do this. Sorry that I wasn\'t clear. Thanks Chelsea
  5. Hello everyone, I have a question about copying data from one table to another. Well actually, I would like to move the data from one table into another. ie. I have a php page when the user can view one image at a time. If the user wishes to keep the image, he/she clicks a button and the image is copied to another database and removed from the current then the next image is displayed and so forth. I tried to do this from the mysql prompt. However, I recieve a duplicate entry \'1\' for key 1. Obviously, I have a unique primary index. Is there a way I could work around this? Thanks Chelsea
  6. If you know the path of the data you want to retrieve, you could do something like to one below; $uploaddir = \'c:/mysql/data/login/images/\'.$yourfield; mysql_select_db(\"mylogin\",$connect); $sql = \"INSERT INTO `your table` ( `imagefilepath`,`objTxtArea`,) VALUES (\'\" . $uploaddir. \"\',\'\".$synop.\"\',curdate())\"; This is part of a code I did. I wanted the user to upload a file which is stored in a directory. Then the path for that file would be stored in the mysql table. This way when reading the table, it will point to that path and display the file. Chelsea
×
×
  • 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.