Search Results

Search found 31606 results on 1265 pages for 'generate table'.

Page 29/1265 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • Two n x m relationships with the same table in mysql

    - by Christian
    I want to create a database in which there's an n x m relationship between the table drug and the table article and an n x m relationship between the table target and the table article. I get the error: Cannot delete or update a parent row: a foreign key constraint fails What do I have to change in my code? DROP TABLE IF EXISTS `textmine`.`article`; CREATE TABLE `textmine`.`article` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Pubmed ID', `abstract` blob NOT NULL, `authors` blob NOT NULL, `journal` varchar(256) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `textmine`.`drugs`; CREATE TABLE `textmine`.`drugs` ( `id` int(10) unsigned NOT NULL COMMENT 'This ID is taken from the biosemantics dictionary', `primaryName` varchar(256) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `textmine`.`targets`; CREATE TABLE `textmine`.`targets` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `primaryName` varchar(256) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `textmine`.`containstarget`; CREATE TABLE `textmine`.`containstarget` ( `targetid` int(10) unsigned NOT NULL, `articleid` int(10) unsigned NOT NULL, KEY `target` (`targetid`), KEY `article` (`articleid`), CONSTRAINT `article` FOREIGN KEY (`articleid`) REFERENCES `article` (`id`), CONSTRAINT `target` FOREIGN KEY (`targetid`) REFERENCES `targets` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `textmine`.`contiansdrug`; CREATE TABLE `textmine`.`contiansdrug` ( `drugid` int(10) unsigned NOT NULL, `articleid` int(10) unsigned NOT NULL, KEY `drug` (`drugid`), KEY `article` (`articleid`), CONSTRAINT `article` FOREIGN KEY (`articleid`) REFERENCES `article` (`id`), CONSTRAINT `drug` FOREIGN KEY (`drugid`) REFERENCES `drugs` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

    Read the article

  • Netlogo: error when putting variable in table, only constants allowe??

    - by Chantal
    Hello, Currently I am working on a Netlogo program where I need to use nodes and links for vehicle routing problem. (links are called streets in the program) Here I have some practical problems of how to input variable linkspeed in a table with another node. Constants like 200 etc are fine. Online I found some examples where variables are used, but I do not know why I keep getting the following error: Expected a constant. (or why netlogo expects a constant) Here is the relevant piece of code: extensions [table] streets-own [linkspeed linktoll] nodes-own [netw] ;; In another piece of code linkspeed is assigned successfully to the links to cheapcalc ;; start conditions set costs very high 300000 ;; state 3 unsearched state 2 searching state 1 searched (for later purposes) ask nodes [ set i 0 set j count nodes set netw table:make while [i < j][ table:put netw (i) [3000000 3] set i (i + 1)]] set i 0 let k 0 ask node 35 ;; here i use node 35 as an example. ;; node 35 is connected to node 34, 36, 20 and 50 [table:put netw (35) [0 1] ;; node need to search costs to travel to itself ;; putting constants is ok. while [i < j] [ask my-links [ask both-ends [if (who != 35) [set color blue ;; set temp ([linkspeed] of street 35 who) ;; here my real goal is to put this in stat of i. but i is easier than linkspeed. table:put netw (who) [ i 2 ] ] ] ] set i (i + 1)] ] ;; next node for later, no it is just repetition of the same. end I hope somebody knows what is going on... Kind regards, Chantal

    Read the article

  • Problem in Fetching Table contents when adding rows in same table

    - by jasmine
    Im trying to write a function for adding category: function addCategory() { $cname = mysql_fix_string($_POST['cname']); $kabst = mysql_fix_string($_POST['kabst']); $kselect = $_POST['kselect']; $kradio = $_POST['kradio']; $ksubmit = $_POST['ksubmit']; $id = $_POST['id']; if($ksubmit){ $query = "INSERT INTO category VALUES (' ', '{$cname}', '{$kabst}', {$kselect}, {$kradio}, ' ') "; $result = mysql_query($query); if ($result) { echo "ok"; } else{ echo $query ; } } $text .= '<div class="form"> <h2>ADD new category</h2> <form action="?page=addCategory" method="post"> <ul> <li><label>Category</label></li> <li><input name="cname" type="text" class="inp" /></li> <li><label>Description</label></li> <li><textarea name="kabst" cols="40" rows="10" class="inx"></textarea></li> <li>Published:</li> <li> <select name="kselect" class="ins"> <option value="1">Active</option> <option value="0">Passive</option> </select> </li> <li>Show in home page:</li> <li> <input type="radio" name="kradio" value="1" /> yes <input type="radio" name="kradio" value="0" /> no </li> <li>Subcategory of</li> <li> <select>'; while ($row = mysql_fetch_assoc(mysql_query("SELECT * FROM category"))){ $text .= '<option>'.$row['name'].'</option>'; } $text .= '</select> </li> <li><input name="ksubmit" type="submit" value="ekle" class="int"/></li> </ul> </form> '; return $text;} And the error: Fatal error: Maximum execution time of 30 seconds exceeded What is wrong in my function?

    Read the article

  • SQL Query Help - Return row in table which relates to another table row with max(column)

    - by Seth
    I have two tables: Table1 = Schools Columns: id(PK), state(nvchar(100)), schoolname Table2 = Grades Columns: id(PK), id_schools(FK), Year, Reading, Writing... I would like to develop a query to find the schoolname which has the highest grade for Reading. So far I have the following and need help to fill in the blanks: SELECT Schools.schoolname, Grades.Reading FROM Schools, Grades WHERE Schools.id = (* need id_schools for max(Grades.Reading)*)

    Read the article

  • Nested query to find details in table B for maximum value in table A

    - by jpatokal
    I've got a huge bunch of flights travelling between airports. Each airport has an ID and (x,y) coordinates. For a given list of flights, I want to find the northernmost (highest x) airport visited. Here's the query I'm currently using: SELECT name,iata,icao,apid,x,y FROM airports WHERE y=(SELECT MAX(y) FROM airports AS a , flights AS f WHERE (f.src_apid=a.apid OR f.dst_apid=a.apid) ) This works beautifully and reasonably fast as long as y is unique, but fails once it isn't. What I'd want to do instead is find the MAX(y) in the subquery, but return the unique apid for the airport with the highest y. Any suggestions?

    Read the article

  • php / mysql - select id from one table excepting ids which are in second table

    - by John
    hello. for example i have 2 tables: 1 . users: id Name 1 Mike 2 Adam 3 Tom 4 John 5 Andy 6 Ray 2 . visits: userID date 1 ... 3 ... 6 ... i want to make a page which can be visited once in 12 hours, when user visits that page his id is included in database ( visits ), how i can select all users ( from database users) excepting users who visited page in <= 12 hours ( users from database visits )?

    Read the article

  • Creating new table entry when updating another entry of another table - Ruby on Rails

    - by Michaël
    Hi, I have written this code in my "show" view of estimates and I want that, when submitting (update), it creates a new repairs (Repair.new(???)) with some parameters. I don't know where to write the "new repairs" code, in this view or the controller (in update part). I need that the Repair is created one time, not each time the @estimate is updated. <% form_for @estimate, :url => {:controller => "estimates", :action => "update"} do |f| %> <%= f.error_messages %> <select id="estimate_accept" name="estimate[accept]"> <option value="1" selected="selected">accept</option> <option value="2">refuse</option> </select> <%= f.submit "Update" %> <% end %> Thank you for your help, I hope my explanations are clear!

    Read the article

  • Select 2 Rows from Table when COUNT of another table

    - by Marcus
    Here is the code that I currently have: SELECT `A`.* FROM `A` LEFT JOIN `B` ON `A`.`A_id` = `B`.`value_1` WHERE `B`.`value_2` IS NULL AND `B`.`userid` IS NULL ORDER BY RAND() LIMIT 2 What it currently is supposed to do is select 2 rows from A when the 2 rows A_id being selected are not in value_1 or value_2 in B. And the rows in B are specific to individual users with userid. What I need to do is make it also so that also checks if there are already N rows in B matching a A_id (either in value_1, or value_2) and userid, and if there are more than N rows, it doesn't select the A row.

    Read the article

  • Generate .sql files using rake task

    - by Prasanna
    Hi, I have a table called 'choices' in this table i am storing static data for my site like Blood Groups , qualification, job types etc., I have to create rake tasks one is for to create backup choices.sql file from choices table data, second one is dump the data from .sql file to choice table. How can I create the rake tasks. Any other best way to take backup data from a table and load data into the table Thanks

    Read the article

  • Inserting new argument to table through search form of another table

    - by owca
    In my database I have a form for searching products (fields : id, name, manufacturer_id[set to display manufacturer's name], category_id, price). I would like to have the ability of adding manufacturers through this form. So I've created vba script but it does not work. Still when I enter new name it gives me prompt to "Select element from the list". What am I doing wrong ? Private Sub manufacturer_id_NotInTheList(NewData As String, Response As Integer) Dim strSQL As String, strInfo As String strInfo = "Manufacturer " & NewData & " is not on the list." & vbCrLf & "Add?" If MsgBox(strInfo, vbYesNo + vbQuestion, "Element not on the list") = vbYes Then strSQL = "INSERT INTO manufacturer (name, country, id_distributor) VALUES ('" & NewData & "','Undefined', '0');" DoCmd.SetWarnings (False) DoCmd.RunSQL strSQL Response = acDataErrAdded Else Response = acDataErrContinue NewData = "" Me.manufacturer_id.Text = "" End If End Sub

    Read the article

  • solution for updating table based on data from another table

    - by I__
    i have 2 tables in access this is what i need: 1. if the PK from table1 exists in table2, then delete the entire record with that PK from table2 and add the entire record from table1 into table2 2. if the PK does not exist then add the record i need help with both the sql statement and the VBA i guess the VBA should be a loop, going through every record in table1. inside the loop i should have the select statement

    Read the article

  • How to display how many times each records in a table used by other table

    - by Fredy
    I have a problem with my query, below are two tables that tbl_tag and tbl_tag_usedby. I want to show how much of each record in tbl_tag used by record in tbl_tag_usedby. Here is a query that I use: SELECT t.*, COUNT(u.tagid) AS totale FROM tbl_tag t LEFT JOIN tbl_tag_usedby u ON u.tagid = t.id AND t.status =1 GROUP BY u.tagid and the results are as below: In this case the record id from 2 to 6 do not appear in the query results, I want record id from 2 to 6 are also shown and on the field "totale" its value is 0. Can anyone help me?

    Read the article

  • Html, table, img & css - how to get text to wrap correctly?

    - by Michael Pasqualone
    I've got the following code; however it's not given me the desired result - what I am after is as per the image below, what am I doing wrong? <style> table.control_grid tr { text-align: center; width: 200px; } table.control_grid td { width: 120px; height: 48px; } table.control_grid a { text-decoration: none; } table.control_grid img { vertical-align: text-top; } </style> <table class="control_grid"> <tr> <td><img width="48" height="48" src="icon1.gif">My text & stuff, overflow??</td> <td><img width="48" height="48" src="icon1.gif">Icon1</td> <td><img width="48" height="48" src="icon1.gif">Icon2</td> <td></td> <td></td> </tr> </table> Desired result:

    Read the article

  • Multisite Enabling a Table

    - by Joe Fitzgibbons
    I am creating a table (table A) that will have a number of columns(of course) and there will be another table (table B) that holds metadata associated to rows in table A. I am working with a multi site implementation that has one database for the whole shabang. Rows in table A could belong to any number of sites but must belong to at least one. The problem I have is I am not sure what the best practice is for defining what site each row in table A belongs to. I want performance and scalability. There is no finite number of sites going forward. Rows in table A could belong to any number of sites in the future. Right now there are only 3. My initial thoughts are to have a primary site ID in Table A and then metadata in table B will have rows defining additional sites as needed. Another thought is to have a column in Table A for each site and it is a boolean as to wether it belongs to that site. Lastly I have thought about having another table to map rows in Table A to each site. What is the best way to associate rows in a table with any number of sites with performance and scalability in mind?

    Read the article

  • Taglist: Failed to generate tags for macvim [migrated]

    - by Mohit Jain
    When ever I am trying to open a file in my rails project using macVim. I am geting an error Taglist: Failed to generate tags for ....... But it works perfectly in terminal vim. Why its happening? I am a new bie and just installed everything using this dotvim repo. I installed ctags using these commands that I got from this git $ ctags -R --exclude=.git --exclude=log * ctags: illegal option -- R usage: ctags [-BFadtuwvx] [-f tagsfile] file ... #you need to get new ctags, i recommend homebrew but anything will work $ brew install ctags #alias ctags if you used homebrew $ alias ctags="`brew --prefix`/bin/ctags" #try again! ctags -R --exclude=.git --exclude=log * which ctags on terminal returning, same if i do from vim or gvim using ! (bang): /usr/bin/ctags Can anyone help me?

    Read the article

  • New Wordpress posts generate 404 error.

    - by Steve
    I had a working installation of WordPress, and I recently encountered an issue where when I tried to login to the back-end, the browser would redirect to the login URL of the previous domain WordPress was installed on. I fixed this by reinstalling WordPress, and I can now login to the backend, but any new posts I make, or old posts I have generate 404 errors. Additionally, if I try to navigate to any category page, I again receive a 404 error. I have looked at the wp_posts table of my database, and the GUID field each contains the correct domain name and URL structure. What should I be checking here? Site in question.

    Read the article

  • Generate Multiple Choice Questions [closed]

    - by Daniel
    I'm working on a quiz application that will have a number of multiple choice questions. I'm waiting on the content from the client, but I'm hoping to start testing with some placeholder data for the time being. In order for the tests to be worthwhile, I probably need at least 100 multiple choice questions. I wanted to see if anyone knows of a resource or tool that can generate questions/multiple choice answers or propose another creative way to fill my quiz application with placeholder content. Ultimately the data will be in a MySQL database, but I don't really care what format the sample data is in (Excel, Word, JSON, etc.).

    Read the article

  • PHPForm Generate PDF Send to Email

    - by tom
    I'm a beginner in PHP I was wondering if this is easy to do or if i'd have to outsource this to a programmer - Basically when a user fills in the PHP Form and submits it I need this to generate as a PDF which will then email/attach to MY email and NOT the user who submitted this form. I have looked at tcpdf, fpdi but i dont think any of those scripts allow me to do this specifically as from what i heard it generates a download link for the user, and that is not what i need. If anyone can help me it would be greatly appreciated. Regards Tom

    Read the article

  • How do I generate a level randomly?

    - by Charlton Santana
    I am currently hard coding 10 different instances like the code below, but but I'd like to create many more. Instead of having the same layout for the new level, I was wondering if there is anyway to generate a random X value for each block (this will be how far into the level it is). A level 100,000 pixels wide would be good enough but if anyone knows a system to make the level go on and on, I'd like to know that too. This is basically how I define a block now (with irrelevant code removed): block = new Block(R.drawable.block, 400, platformheight); block2 = new Block(R.drawable.block, 600, platformheight); block3 = new Block(R.drawable.block, 750, platformheight); The 400 is the X position, which I'd like to place randomly through the level, the platformheight variable defines the Y position which I don't want to change.

    Read the article

  • How to prevent system to generate log file

    - by shantanu
    My Question is little bit surprising, but i need it. I am using a slow processor laptop, now i found that HDD has some bad sectors and HDD response becomes slow. But disk health is ok(according to smart tools). I can not change my HDD right now. So decide to reduce disk operation. How do i prevent system to generate log file or any other file which are used to keep history? I know LOG file is very important but i don't care it right now. Please help.

    Read the article

  • PHPForm Data Generate PDF & Send to Email?

    - by tom
    I'm a beginner in PHP I was wondering if this is easy to do or if i'd have to outsource this to a programmer - Basically when a user fills in the PHP Form and submits it I need this to generate as a PDF (with all the labels etc) which will then email/attach to MY email and NOT the user who submitted this form. I have looked at tcpdf, fpdi but i dont think any of those scripts allow me to do this specifically as from what i heard it generates a download link for the user, and that is not what i need. If anyone can help me it would be greatly appreciated. Regards Tom

    Read the article

  • How can I generate Sudoku puzzles?

    - by user223150
    I'm trying to make a Sudoku puzzle generator. It's a lot harder than I expected and the more I get into it, the harder it gets! My current approach is to split the problem into 2 steps: Generate a complete (solved) Sudoku puzzle. Remove numbers until it's solveable and has only 1 solution. In step 1, since I'm using a brute force methods, I'm facing some run time issues. Is there an optimal way of filling in a complete Sudoku puzzle? In step 2, what kind of algorithm should I use to "puzzlize" a solved sudoku?

    Read the article

  • How to generate `AllowDeactivateGrabs` in command line ?

    - by boffin
    I am using XFCE-Ubuntu and do a lot of my development work there. In my case, when I sometimes use Xilinx ISE, the mouse cursor hangs as a Grab pointer and then stops responding. The entire X environment becomes unusable and I have to kill it and restart. This is becoming a serious annoyance. I saw this bug: AllowDeactivateGrabs is broken I see that sending AllowDeactivateGrabs in command line can kill the Grab. In my case, I am doing this on a remote server, so it is the application in the remote server (over X2GO) getting messed up. I am able to login in command line and kill X. Is there a way to generate AllowDeactivateGrabs in command line ? So I dont mess up my other applications and potentially lose data.

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >