Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. While Dylan\'s way would work, the better way is to use the min() and max() summary functions. Although it\'s unclear, you seem to suggest you have a table with at least these columns: Table TableA ------------------------ id | INT somedate | DATE ... etc What\'s confusing is you state you could have multiple rows which have the same id, only the somedate would be different... or in other words, you have \"groups\" of the same id in TableA. If that is true, then this would get you the earliest date for each id SELECT MIN(somedate) as mindate, MAX(somedate) as maxdate FROM TableA GROUP BY id
  2. drop the index and then do a create index.
  3. DylanBlitz had some good thinking but he didn\'t really make clear that either you need a seperate provider table (and this would be where the provider would indicate their location (state/zip etc), or you could use Users for that, and have an attribute of that table that would indicate whether the user was a a user or a provider. I would recommend that you might want to retain the services of an experienced developer who understands data modelling and can help you make sure you have the right database structure.
  4. Try something like: SELECT *, DATE(ts) as tsdate, TIME(ts) as tstime FROM table
  5. I think it matters if someone found your phpmyadmin page, and was able to go into mysql as root because you had no password. From there it\'s quite easy to do a lot of nasty things to not only your database but to the system itself since mysql has the ability to read/write file system files.
  6. You managed to pack in quite a few questions here, I\'ll try and answer them: Already you have lost me. The purpose of having a product table is that there should be a row for every product. You indicate that you are creating products that are really \"clients\". This is confusing and my kneejerk reaction is that your design needs work. This requirement would indicate there should be some relationship between the two tables, probably where one has a foreign key, but again exactly what is not clear from your description of the requirements of the application. In RDBMS parlance, what you\'re referring to would be called declarative referential integrity. Mysql does not support this. DRI is good for a few types of things: data driven constraints (table A has TableB.id as a foreign key, database will disallow if you attempt to insert a row where the value of TableB.id does not exist in a row in TableB) or cascading deletes (TableB is a child table of TableA, you delete a row in TableA and all the child rows in TableB would automatically be deleted). It\'s also useful to some tools in being able to reverse engineer the design of an existing database into a database design tool. One product that I\'ve recommended in the past (Dezign for databases) has an importer capability that will create a database design from an existing mysql database, however, it may not be able to actually create the relationships that were intended. While I have used Dezign for databases to design databases and generate the DDL sql to create the tables and indexes, I don\'t have the reverse engineering script so I can\'t really vouch for it\'s capabilities. If your structure is as simple as you describe you might benefit from using somethign like Dezign and simply starting over by creating a design based on what you currently have, and then dropping and recreating it from the Dezign generated scripts. Having designed databases for years, I always use this methodology for my projects, since it guarantees that my database structure is what I think it is, not to mention the benefits of having design diagrams and table and attribute notes to refer to when I am developing. Yes Oracle supports a host of features that you will not find in Mysql, but then again, Oracle costs many thousands of dollars. In my opinion Oracle is the best RDBMS product available, and it\'s list of capabilities is unmatched by any competing product, however lack of DRI is not something that will prevent you from creating a functional reliable application so long as your database design is sound. My phpfreaks tutorial has several diagrams I created with Dezign for databases that illustrate the type of thinking that should go into figuring out what your database design should be. I can see that you have done some thinking about it, and have a grasp of some of the concepts of normalization, but without knowing more about the purpose of the application, I can\'t really help you further unfortunately.
  7. It\'s also a good thing to create one or more users and associate them with individual databases for the purposes of developing scripts or using your own script. This command let\'s you create a new user and give that user permissions to use a database called test_db you created with the command CREATE DATABASE test_db: GRANT ALL ON test_db.* TO testusr@localhost IDENTIFIED BY \"testusrpw\";
  8. Well you either have a mysql password for the root account or you don\'t. If you don\'t you need to set one, which is what the phpmyadmin message is warning you about. Once you login to mysqladmin you should use the mysql database. Then issue this query to change your root password (in the phpmyadmin sql window): UPDATE user SET Password=PASSWORD(\'somenewpw\') WHERE user=\'root\' Once that query completes, issue this command: FLUSH PRIVILEGES;
  9. 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
  10. Why would you need a database of databases? Please describe what you\'re trying to do.
  11. 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.
  12. 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.
  13. 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.
  14. It sounds like you the user you are starting mysql with does not have the permissions to create the mysql.pid file.
  15. 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?
  16. 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\'
  17. The table may be corrupt. Take a look at running the fixisam or whatever the name of that mysql function is.
  18. 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.
  19. Is it possible that permissions need to be set for that directory?
  20. Yeah you can\'t get this to work unless the subdomain can be resolved via DNS. What you *could* get working with mod_rewrite would be support for: http://www.yoursite.com/username
  21. All I can tell you is that I have vhost statements in my httpd.conf. You should not have to move them into a seperate file or set of files for it to work. It sounds like you have a syntax problem. Post the vhosts section of your httpd.conf.
  22. Probably need to run this as root, or su\'d as root.
  23. You can tunnel other protocols through SSH though. The biggest problem with ftp is usually the requirement that you use passive mode.
  24. That\'s definately a mysql error. You need to investigate your Mysql installation, because something is not right.
×
×
  • 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.