Jump to content

gizmola

Administrators
  • Posts

    5,878
  • Joined

  • Last visited

  • Days Won

    139

Everything posted by gizmola

  1. 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.
  2. 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.
  3. It sounds like you the user you are starting mysql with does not have the permissions to create the mysql.pid file.
  4. 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?
  5. 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\'
  6. The table may be corrupt. Take a look at running the fixisam or whatever the name of that mysql function is.
  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. Is it possible that permissions need to be set for that directory?
  9. 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
  10. 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.
  11. Probably need to run this as root, or su\'d as root.
  12. You can tunnel other protocols through SSH though. The biggest problem with ftp is usually the requirement that you use passive mode.
  13. That\'s definately a mysql error. You need to investigate your Mysql installation, because something is not right.
  14. 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?
  15. 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 %\';
  16. 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.
  17. 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.
  18. Dreamweaver doesn\'t understand php. You can do some partial coding in Dreamweaver, but then you would need to cut the HTML code and paste it into your .php script, and hand edit from there.
  19. 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.
  20. 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.
  21. It\'s your quotes. Switch to $where1 = \"County LIKE \'Derbyshire%\'\";
  22. Whatever device connects you to the internet (cablemodem or DSL router) is doing NAT, because you are using a non-routable IP for your internal lan, ie 192.168.0.1. the 192.168.0.1 network can not be seen from the internet... it is non routable. Thus, you will need to configure your router to map it\'s port 80 traffic to the internal machine that has the webserver. How you would do that depends on how your router works, but usually you set up a rule that allows port 80 from source * to 192.168.0.1.
  23. Mysql\'s limit feature is one of the really nice things it offers. That\'s definately the way to go. Hopefully you have a key to the table using auto_increment, or have a timestamp column. Then you would not have to bother with trying to get the count(*) and do a limit count(*)-20, and would instead simply do: SELECT * FROM Table ORDER BY Table_id DESC LIMIT 20; This will display the rows most recent first. May be what you want, and saves an extra query.
  24. Mysql stores this type of information in the mysql user table, which is in the mysql data dictionary. Typically, a user will be created like so: someuser@localhost. This will indicate to mysql that the user can only connect from localhost. If the host has indicated that you can\'t make a remote connection, then they have probably setup your database user in this fashion, and mysql will not allow you to connect to it from any network address other than localhost.
×
×
  • 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.