Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. gizmola

    Hey all

    Glad you found the site, and hopefully you'll become a regular.
  2. Excellent site. Eye catching professional design that matches the business model well. My only complaint is that it is exceedingly slow but with that said, I'm on the US West coast, so latency may be the problem, or this just may be on a low bandwidth test server. I would personally use some rewrite rules to have "seo friendly" urls that hide the php controllers, but that may also be something you are planning to add.
  3. It's probably because either your host doesn't allow direct mails or mails at all, or your emails are being put into the spam folder, or even rejected outright.
  4. Yes MySQL has an odbc driver. You might have to work with your hosting company to get mysql configured to accept connections directly from your workstation, but it is doable. http://dev.mysql.com/downloads/connector/odbc/
  5. No it doesn't matter. SQL databases are manipulated using the sql language. It doesn't matter what client is used to make those queries.
  6. $B should be a table name but instead it is: "with codes".
  7. Single character field should be char(1). Always use char or varchar if you can, rather than the text types. What is confirm_time? Mysql has date/datetime and timestamp types. Don't worry about the sizes, they are simply there to indicate when you are approaching limits to mysql internals for things like the maximum data that can be stored in a row or the size of the all the combined column names, but in neither case are those internal limits a concern for you.
  8. Please provide further information, your question uses the wrong words for things and is impossible to answer. -For example, you state: there are two row in database liked and hate. I'm guessing you mean there is a column named "liked" that is a varchar and has either "liked" or "hate" in it? -In order to run AVG() you need a numeric column, and it is a summary function, meaning it will be applied to an entire group. -Probably what you want is to us GROUP BY to get groups, but exactly what the GROUP BY needs to be I can only guess.
  9. mail is dependent on the local mail transfer agent program on the operating system. What OS are you running this on? You get variables from a form that uses the POST method in the $_POST[] superglobal. Read those variable values in at the top of your script.
  10. You have a script that sets some variables and mails them. Where is the form?
  11. What was it about adding the indexes you didn't understand? Look at the rows count.. It is equal to the number of rows in the table. Look at the TYPE showing "ALL". Look at the other columns showing you that no keys are bing used. The Extra column, when using an index will show you that. Also, I don't really need any of that to tell you that searching on a column that has no index on it will tablescan.
  12. Explain plan please. explain extended select count(*) from RandomNumbers where random1='XPHACFYG22422DXCCH155RE682AVEEZ2';
  13. That is a warning, which is not an error. If this is a production server you should not be displaying errors but rather logging them to a file. Bottom line, that script is really old and employs poor coding techniques and antiquated PHP. I would suggest finding a better one.
  14. No, the explain plan showed exactly what we stated... it is doing a full table scan of the table. The only way to stop this from happening is to add indexes to the columns. create index randomnumbers1_idx on RandomNumbers(random1); create index randomnumbers1_idx on RandomNumbers(random1); create index randomnumbers1_idx on RandomNumbers(random1);
  15. Yes you can do that, OR you can do SELECT count(*) from IP_Address where ip = ... One other thing -- you're needlessly wasting storage. You should use an integer in the database and convert the ip using [m]ip2long[/p].
  16. No there is something wrong. As requinix suggest, it is probably that your query is tablescanning the entire 3.5m rows. Here's a query against a table that has over a million rows in it, and as you can see it is subsecond to do this query against a varchar() column that is indexed. mysql> set profiling=1; Query OK, 0 rows affected (0.00 sec) mysql> select count(*) from ... where IP = '....'; +----------+ | count(*) | +----------+ | 1505 | +----------+ 1 row in set (0.01 sec) mysql> show profiles; +----------+------------+------------------------------------------------------------------+ | Query_ID | Duration | Query | +----------+------------+------------------------------------------------------------------+ | 1 | 0.00153400 | select count(*) from ... where IP = '...' | +----------+------------+------------------------------------------------------------------+ 1 row in set (0.00 sec)
  17. There's a substantial fault in the logic of what you are doing here. Does your IP_Address table have anything in it? Consider what happens when IP_Address is empty -- will you ever do an insert? This is not the way to solve this problem -- looking at every row in the table, to determine whether or not there is a row with the same IP address in there is a really bad idea. I'm not sure what the purpose of this table is, but you can determine in advance whether or not there is already a row in the table by using a WHERE clause.
  18. The way to look at it, is that the WHERE clause is used to attempt to find a match for *any single row* based on the criteria included. So when you say WHERE product_id = 1 OR product_id = 2, you're saying - check the product_id, Does it equal 1? If so then add the row to the result set. OR -check the product_id, Does it equal 2? If so, then add the row to the result set. When you have AND in the criteria, it means that for that one row, both criteria must be TRUE in order to add the row. So for a row, user_Id = 1 AND user_id = 2 is an impossibility. You would never get a row back where a column that has an atomic value could be equal to 2 different values. That is why you got an empty result set. And really exists for queries like: SELECT * from users WHERE gender = "Male" AND status = "Single" Which you can think of as ... get me all the Men who are also Single. We want only men in this result, but only if they are single.
  19. The names of your key columns are bizarre. Why didn't you just use tbbook_bookID as an example, as a foreign key to tbbook? There's numerous ways to do this, but this one is very simple: SELECT * from tblbook WHERE bookID NOT IN (SELECT book_user_bookID FROM tblbook_user WHERE book_user_userID = 1)
  20. Again, don't use $_REQUEST, use $_POST. Here's some code that should help you understand how to approach this: session_start(); $users = array("user1" =>"3202", "user2" =>"2002", "user3" =>"1061", "user4"=>"1400", "user5"=>"1001"); if (isset($_SESSION['username'])) { // already logged in. header('Location: home.php'); exit(); } elseif (isset($_POST['username']) && isset($_POST['password']) && array_key_exists($_POST['username'], $users) && $users[$_POST['username']] == $_POST['password']) { $_SESSION['username'] = $_POST['username']; $_SESSION['password'] = $users[$_SESSION['username']]; header('Location: home.php'); exit(); } else { // header() back to login form exit(); }
×
×
  • 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.