Jump to content

gizmola

Administrators
  • Posts

    5,882
  • Joined

  • Last visited

  • Days Won

    139

Posts posted by gizmola

  1. When I attempted one of your solutions I got this

    C:Documents and SettingsMario> C:mysqlbin>mysqldump database > \"C:myfolderexport.sql

    The system cannot find the path specified.

     

    If this is what you did then it\'s clear what the problem is:

     

    This line: C:mysqlbin>mysqldump

     

    Should be

     

    C:mysqlbinmysqldump

     

    You are simply trying to specify the path to the mysqldump command here.

     

    So the correct full line should be:

     

    C:mysqlbinmysqldump database > C:myfolderexport.sql

     

    This calls mysqldump and redirects output to the file c:myfolderexport.sql

  2. I can\'t guarantee this is your problem, but you should not use spaces in the names of your columns. You might try to substitute the name gender instead of \'Male or Female\'. Keep in mind that column names in your table are for your use only... nobody sees these, so keeping them simple and descriptive enough for your use is all that\'s necessary.

  3. All the primery key is for is to tell the database which Field for it to sort on. The database can be sorted using various fields but the primiary key is the first field to sort.

     

    I don\'t agree with this. A Primary key by definition must be able to uniquely identify any one row in the table.

     

    As for NULL, it is often seen as being a property that exists independent of normal SQL rules. When a column is NULL, a value is unknown. Thus even a column guaranteed to be UNIQUE will allow for NULLs if the NULL property is set. For this reason, many SQL purists recommend that NULL be avoided.

     

    As for having NULL in a primary key column... that is not allowed. A primary key must have a value and that value is guaranteed unique across the entire series of columns which comprise the primary key.

  4. I think your approach is a bit flawed. There is no value in you having the password on the form as an admin. The reason you encrypt the password is to secure it... even from yourself as an admin.

     

    The only function you should reserve for yourself as an admin, is the ability to reset the password for the user manually. You should just have a function of your system that lets you supply a new password, and have that stored as the user\'s new password. I don\'t expect that this is something that should be needed very often, if you have adequate self-help functions allowing a user to set a new password for themselves, using some combination of their registered email, or password hints they provide when they set the account up.

  5. select papername, IF(personid is null,\'False\', \'True\') as subscribed
    
    from paper
    
    left outer join subscription on paper.paperid=subscription.paperid
    
    and subscription.personid =1
    
    order by papername

     

    The important things:

     

    -use left outer join to get a row whether or not Jacque is subscribed

    -use AND to only get rows from subscription that are Jacque (personid =1). Since a person can only be subscribed to a paper once, this means that we either get a personid of 1, or NULL in the personid column.

    -use IF on personid to test for NULL (ie a paper that Jacque is not a subscriber to)

     

     

    Don\'t say I never did anything for ya :wink:

    Now if you get the job, will I be getting a kickback from you?

  6. Okay, I am making a membership system, and there are two tables for the members. One is tbl_users (has username, password, email, and rank), and the other is tbl_userinfo (has 10+ columns of other information). So, I split it up into two different tables so it wouldn\'t get to be a ginormous table.

     

    The rank that I mentioned in tbl_users can be admin, user, or unset. \\\"Unset\\\" means that the account hasn\'t been verified yet, and it doesn\'t let you log in if your account is \\\"unset.\\\"

     

    Now, on the page where it lists the users (but doesn\'t have the whole profile) it uses information only from the tbl_userinfo, and doesn\'t draw anything from tbl_users. However, I need it to only select users information from tbl_userinfo where their rank in tbl_users is not \\\"unset.\\\"

     

    I\'m not sure exactly how I could do this with my current table setup. Would I just have to move the rank over to tbl_userinfo?

     

    I you are able to understand what I mean. Thanks.

     

    PS: I have an id_key in the tbl_users, and a parent_id_key in the tbl_userinfo that are identical for each account.

     

    You simply need to join the tables together. In SQL you are always returned a \"set\" ie. a table. Joining two or more tables together creates what you could think of as a temporary table. If I understand you correctly you have two tables that you can join by id_key and parent_id_key.

     

     

    So something like:

     

    SELECT * FROM

    table a, table b

    WHERE a.id_key = b.parent_id_key AND

    rank \'unset\'

  7. You need to be a lot more specific, if you expect to get any help. We are not mind readers. Read the posting guidelines document that\'s linked in my sig. It should help you understand the type of information you need to supply. Also this should go in the Mysql forum.

  8. It could be many things. Some suggestions to try: run myisamchk on your table to make sure it\'s not corrupt.

     

    Make sure you\'ve not run out of space.

     

    Check the mysql log.

     

    Execute an insert from the command line.

     

    Are you out of keys?

     

    Is it trying to insert a duplicate into a column(s) where a unique index exists?

     

    What error is returned on the insert?

  9. The sql standard way of doing this would be approximately this:

     

    update lyrics

    set artist = SUBSTRING(artist, 5)

    where UPPER(artist) like \'THE %\';

     

    Make sure you do a select first just to make sure that the substring replacement is working right:

     

    select SUBSTRING(artist, 5)

    from lyrics

    where UPPER(artist) like \'THE %\';

  10. Is there a web design program that will allow you to integrate your php scripts like what he was talking about easier then dreamweaver can?

     

    -Ermer

     

    Not that I know of. The reason Dreamweaver or frontpage can do what they do, is that html is processed clientside, so it\'s feasible to include a full fledged html parser. If you think about what Dreamweaver and Frontpage do: they\'re basically HTML code generators, that provide a wysiwig interface.

     

    PHP is an interpreted server side include language. A function that for example, reads information from a database, fills variables, opens a template and does search and replace, and finally runs the result through evaluate() has no corresponding visual counterpart. In order for that to make any sense to a visual design tool. In the client server world, there are Fourth generation languages like visual basic, Gupta SQLWindows or Delphi, that do for those languages what Dreamweaver does for html.

     

    However those products do something that is non-trivial: they create client server enabled windows applications. In regards to php, creating an html application just isn\'t that complicated to warrant the lengths someone would have to go to to create a wysiwig php generator, nor would I guess is the market sufficient to support the price one would have to charge to recoup the substantial development investment. The LAMP environment isn\'t that popular in the fortune 500.

  11. Yes it would work. But you could also just execute the query again, with a mysql_query call. You need a query to get a result set. Once the result set has been fetched, as was stated, it\'s basically useless.

     

    If this is any static value, the advice of loading it into an array is a very good one. If you can avoid doing a requery you\'re keeping load off the database, and it should also perform better. If you are changing the database, or have an expectation that it might have changed then the re-query is understandable.

  12. You did fairly well. The only thing I see you missing is a column for the actual amount of the transaction in transaction. Transaction should be your \"actual\" table, where the amount is stored.

     

    In that way, one time transactions and subscriptions can co-exist. If pricing changes over time, this won\'t matter, because the history of what was paid in the past will still be in The Transaction table. For one-time payments you can leave subscribe_id empty or better yet have a special Subscribe row (id 1 perhaps) that you use for all one time transactions.

  13. It\'s actually not strange at all. When you specify 3 tables in a query, and do not relate (ie join) those tables, the result is what\'s called a \"cartesian product\" or in other words, you will get a row for table1*table2*table3.

     

    To correct this you simply need to provide the required joins between the tables.

×
×
  • 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.