+ Reply to Thread
Results 1 to 4 of 4

Thread: SQL EXPLAIN DON't WORK

  1. #1
    batman1's Avatar
    batman1 is offline x10Hosting Member batman1 is an unknown quantity at this point
    Join Date
    Aug 2008
    Location
    Jamaica
    Posts
    92

    SQL EXPLAIN DON't WORK

    I am trying to OPTIMIZE my sql queries.

    I am having a problem. The EXPLIAN query don't print any thing onto the screen. How does this statement wotk? Is it ENABLED?

    See example:

    Code:
    	$result = mysql_query("EXPLAIN SELECT * FROM buxscript_members WHERE username = '$uname' OR username = '$ref' OR email = '$email' OR alertpay = '$ap' OR paypal = '$pp' OR register_email = '$email' OR register_alertpay = '$ap' OR register_paypal = '$pp' OR register_ip = '$user_ip'");
    	while($row = mysql_fetch_array($result))
    	{
    		// Referral exists
    		if($row["username"]==$ref && strlen($ref)>2)
    			$ref_check = true;
    		else
    		{
    			if($row["username"]==$uname){
    				// username already exists
    				$error = "Username already registered.";
    				break;
    			}
    		}
    	}

  2. #2
    freecrm's Avatar
    freecrm is offline x10 Elder freecrm is an unknown quantity at this point
    Join Date
    May 2008
    Location
    UK
    Posts
    629

    Re: SQL EXPLAIN DON't WORK

    I can't see anything wrong with the syntax, but I don't see any output code!

    As far as I understand, the query builds a recordset in much same way as a standard mysql_query but returns only one $row.

    How are you outputting? These are the fields within the array to source.

    id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |

  3. #3
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228

    Re: SQL EXPLAIN DON't WORK

    explain doesn't output information about the table anyways.

    It's a synonym for DESCRIBE, which just explains how the query is executed.
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  4. #4
    batman1's Avatar
    batman1 is offline x10Hosting Member batman1 is an unknown quantity at this point
    Join Date
    Aug 2008
    Location
    Jamaica
    Posts
    92

    Re: SQL EXPLAIN DON't WORK

    thanks for your reply. It rely helped. rep +++++

+ Reply to Thread

Similar Threads

  1. Prison vs Work
    By John Klyne in forum Off Topic
    Replies: 10
    Last Post: 12-21-2008, 01:44 PM
  2. Php scripts don't work
    By Slicker in forum Free Hosting
    Replies: 4
    Last Post: 11-16-2008, 08:03 AM
  3. Need Help To Reset SQL Database to 3
    By shutlanz in forum Free Hosting
    Replies: 2
    Last Post: 11-09-2008, 12:40 PM
  4. SQL server down on Stoli? causing problems
    By tbp911 in forum Free Hosting
    Replies: 3
    Last Post: 08-28-2008, 03:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers