Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by nigelcohen

  1. nigelcohen

    What setting displays script commands to screen?

    If there is no proper solution, you could always add a "dummy" command before each real command you want, outputing the relevant data. eg. within the source file, precede each command with something like select "Command1" from table1 where ref=1;
  2. nigelcohen

    auto-increment problem

    Another cludge, but one which works well, is to avoid deleting the records, but instead update the records so they can be identified as inactive. (eg. Add a column to the table called something like "IsActive integer default 1" and set a record to 0 when inactive.) This requires...
  3. nigelcohen

    Whether there's a record or not

    Try this(assuming, say, a sales table with dates and a stock table without) select * from sales s, stock t where s.StockRef = t.Ref and (s.Date = '2003-05-20' or s.Date = '')
  4. nigelcohen

    Getting input from a browser to a python script

    Python does not use a "file" model for a browser. Instead, it has two modules, "os" and "cgi", with most of the functionality. To read an URL request from a browser and to write a response, try something like this: import cgi import os...
  5. nigelcohen

    Problem importing text file into database

    Jer The code looks right except for the "ESCAPED BY" clause. There is already a default escape character of '\'. So your statement of ESCAPED BY '\' will cause MySQL problems understanding the first time it encounters a '\'. If this is the problem, the solution is : ESCAPED BY '\\'...
  6. nigelcohen

    tailoring result display from multitable select

    Firstly, you need to set up a table called "category" (or something similar). In the category table, you need to have a unique reference field called ID (or something like this). In the table Restaurant, you would need to set up a field called CategoryID (or something similar). In...
  7. nigelcohen

    More than 1 matches for regular expression

    Patrick I have not tried this specifically in Python, but it works for general RegEx searches: like '^CEO.ages$' The character '^' means the following string should be returned only if it comes at the start of the line. The character '$' means the preceding string should be returned only if...
  8. nigelcohen

    MySQL query problem

    Ivan Your query is perhaps too ambitious. I don't think it can be done with one query. The problem is trying to use only the last 10 games points for a player, and not all. One possible solution is to use a program to drive the multiple MySQL queries. (We use Python which would work easily. I...
  9. nigelcohen

    Insert statment

    To "insert" a field, you use the "update" command, since the record is already in the database. eg. update NamesTable set FirstName = 'H' where UserID = '12' If you don't already have a record in the database (in the above example, the record can be identified from its...
  10. nigelcohen

    Think it a JOIN problem?!

    Try this: select msgTable.msgID, userTable.userID from msgTable, userTable where userTable.userID = msgTable.userID order by msgTable.userID There are many variants (eg. select * from ... when you want to select everything) and simplifications (eg. select.m.msgID .... from msgID m ....)
  11. nigelcohen

    cgi parameter

    Try this: ************************ import cgi import os RegisterForm = cgi.FieldStorage(keep_blank_values=1) if os.environ.has_key('PATH_INFO'): PathInfo = os.environ['PATH_INFO'] # This routine finds out if you have selected # the "print" path if PathInfo == '/print': print...
  12. nigelcohen

    Problems with basic Join

    Anders You are selecting records from two tables, without giving a statement about how to link the two tables. Try something like this ( I am guessing which fields link the two tables): SELECT company.companyName, myaccounts.activelead FROM company,myaccounts WHERE company.Ref =...
  13. nigelcohen

    find rows that don't match

    Wouter I tried the following with a similar issue, which worked: select a.Ref, b.Ref from ATable a left outer join BTable b on a.Ref = b.Ref where a.Ref is null (If I had tried b.Ref, the response would have been a failure because there would have been no null records. In this case, I would...
  14. nigelcohen

    How to: Synchronize 2 MySQL server

    There is a clumsy (but effective) way to get the data from an internet database to a local machine: 1. Backup the internet database - on the Linux command line, type: mysqldump -u (yourusername) -p(password) -all-databases > (/path/filenameforbackup) 2. Retrieve the file to your local...

Part and Inventory Search

Back
Top