Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Posts posted by dreamwest

  1. You can raise this amount to 50M because your still checking the upload size with $_FILES["uploadedfile"]["size"]

     

    ini_set('memory_limit','50 M');

     

    Also what errors do you get, do you get this echo:

     

    The file you are trying to upload is too large! Your file can be up to 25 MB in size only. Please upload a smaller FLV file or encode your file with a lower bitrate

     

    You can add this :

     

    if($_FILES["uploadedfile"]["size"] > (25* 1024)){
    
    echo 'Too Large!'
    
    die();
    }
    

  2. Actually that wont work either, the only way is to split the string:

     

    table1:

    lady walks her dog

     

    to table2:

     

    lady

    walks

    her

    dog

     

    Store the keywords in another table and assign an id to each keyword, then ppl would search the keyword table2 and associate the rows in table1 with the search.....the benefit - its supa fast.

     

    This is how google must do it

  3. I tries this

     

    SELECT  * FROM table WHERE title like '".mysql_real_escape_string($search)."%' ORDER BY id DESC LIMIT 1, 15

     

    It brought the query down to (0.002217 Seconds) which is great but i dont get many results, there has to be a way around this.....maybe split the search query up into separate words, then order by how many times each word appears...ill work on it

  4. OK i made the title fulltext it brought the query down to 8 seconds. But the index only has 1 cardinality shouldnt it have over 2 million??

     

    Indexes:

    Keyname  Type            Cardinality  Field

    PRIMARY  PRIMARY 2335548      id

    title_2      FULLTEXT   1            title

  5. I have over 2 million rows in a table, it only has 2 fields but the queries are taking 25-30 seconds to execute

     

    Structure:

    Field:  Type:            Colllation:                Extra:

    id    int(11)                    auto_increment

    title   varchar(200)  latin1_swedish_ci

     

    Both fields have indexes on them, i have zero overhead on the table

     

    Heres my row statistics too:

     

    Row Statistics    Statements  Value

    Format dynamic

    Collation latin1_swedish_ci

    Rows 2,335,312

    Row length ø 130

    Row size ø 261 B

    Next Autoindex 2,336,209

    Creation Nov 04, 2009 at 12:52 AM

    Last update Nov 04, 2009 at 12:53 AM

    Last check Nov 04, 2009 at 12:53 AM

     

     

    When i search the database i use this:

     

    SELECT  * FROM table WHERE title like '%".mysql_real_escape_string($search)."%' ORDER BY id DESC LIMIT 1, 15

  6. function redirect( $url ){
        if (! headers_sent( ) ){
        
            header( "Location: ".$url );
            exit( 0 );
        }
        echo "<script language=Javascript>document.location.href='".$url."';</script>";
        exit( 0 );
    }
    
    
    redirect('/'); //path to redirect to

  7. How can i  create a query that selects (increments) the next row

     

    $next = $_GET['next']; 
    $next = $next +1; //increment to the next row
    "SELECT * FROM red WHERE approve='1' and id='{$next}' "

     

    This is ok if the are no missing ids in the table

     

    1

    2

    3

    4

    5

    6

     

    But will create a problem with this

     

    1

    2

    5

    6

  8. This is what I have???

     

    $testquery = "SELECT game.id, offense.id".

    "FROM game, offense".

    "WHERE game.sID = '$sid'";

     

    Is this correct? or close???

     

    Tell you the truth those joins are crap...theyll drive you insane. Here is the easiest join possible:

     

    mysql_query("SELECT * FROM game AS g, offense as o WHERE g.id=o.id ");

     

    Remember less code = Happiness

  9. If table1 doesnt have any BLOB fields, ill bet you any money it in the looping queries

     

    $query2="SELECT * FROM table2 WHERE condition2"; 
    $results2=mysql_query($query2);

     

    Do you have to select all from table2? Can you select only the fields you want eg. SELECT name,description FROM table2? And does the table have any BLOB or large fields in it?

  10. I just did an ajax image upload script and found it strange how $_FILES was treated.

     

    Form

    <form action="/red_upload.php" method="post" enctype="multipart/form-data">
    Nickname: <input type="text" name="nick" value='' />  
    <input type="file" name="file" />
    <input type="submit" name="submit" />
    </form></nobr>

     

    upload.php

    echo $_FILES['nick'];
    
    // heaps of code here....
    
    echo "Thankyou {$nick} your upload is completed";

     

    which outputs the value of the nickname...but ive already echoed the files value at the top of the script but its showing up at the bottom $nick variable

     

    "Thankyou Potter your upload is completed"

     

    Why is this??

  11. session_start();
    
    
    $Login=$_POST['Login'];
    if($Login){
         $username=mysql_real_escape_string($_POST['username']);
         $md5_password=md5($_POST['password']);
         $result = mysql_query("select * from admin where username='{$username}' and password='{$md5_password}' limit 1 ");
             if(mysql_num_rows($result)!=0){
    $row = mysql_fetch_assoc($result);          
    $_SESSION['user'] = $row['username']; 
    
                header("location:index.php");
                exit;
             } else {
                $message = "Incorrect Username or Password";
             }
         }

  12. This javascript works with text POST but it wont upload an image

     

    ajax.js

    	var object_busy= false;
    ShowLoading = 1 ; 
    var MyTimer = null;
    
    Myvar = "<table  align='center'><tr><td><img src='/ajax-loading.gif' ></td></tr></table>";
    
    function RequireAjaxData($Request, $Control) {
    	if ($Control == "" || $Control == null)	{alert ("No output specified !"); return;}
    	var ai = new AJAXInteraction($Request, GetServerData,  $Control );
      ai.doGet();
    }
    
       function RequireAjaxData_post($Request, $Control) {
          if ($Control == "" || $Control == null)   {alert ("No output specified !"); return;}
          var ai = new AJAXInteraction($Request, GetServerData,  $Control );
         ai.doPost("sendForm");
       }
    
    function GetServerData  ($TheData, $Control){
    	document.getElementById($Control).innerHTML = $TheData;
    }
    
    function AJAXInteraction(url, callback, $Control) {
       	var req = init();
        req.onreadystatechange = processRequest;
            
        	function init() {
    		if	(window.XMLHttpRequest)		{	return new XMLHttpRequest();					} 
    		else if (window.ActiveXObject)	{	return new ActiveXObject("Microsoft.XMLHTTP");  }
    		else {alert ("Your browser seems to be out of date, Please update!"); return;		}
        }
        
        	function processRequest () {
    		if (req.readyState == 4) {
    	        if (req.status == 200) callback(req.responseText, $Control);
    		}
    		else	callback(Myvar , $Control);
        }
    	this.doGet = function() {
          req.open("GET", url, true);
        	  req.send(null);
        }
        
         this.processForm = function (formID) {
         var tmp = new Array();
    	 var n, form;
    
    	 form = document.getElementById(formID);
    
    	 for (n=0;n<form.length;n++)
    	      tmp.push(encodeURI(form.elements[n].name) + "=" + encodeURI(form.elements[n].value));
             
    	 return tmp.join("&");
       }
       
         
           this.doPost = function(formID) {
             var body = this.processForm(formID);
             req.open("POST", url, true);
             req.setRequestHeader("Content-Type", "multipart/form-data");
             req.send(body);
    	 }
       }  

     

    form.htm:

    <form id="sendForm" action="" method="post" onsubmit='RequireAjaxData_post("/red_upload.php", "RED_UPLOAD"); return false;'>
    <nobr>
    Nickname: <INPUT type="text" maxLength=60 name="nick" value="" size="30" >
    <INPUT type="file" name="redhot" size="30">
    <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
    <input type="submit" name="upload" value="Upload" ><input type="reset" value="Reset">
    </form>
    </nobr>
    <div id='RED_UPLOAD'></div>

  13. *The key to success is laziness

    *Good thing im not intelligent - otherwise ill have a "good job" <-emphasis on good job HA!

    *The less you do the more you earn

    *Duplication is the key to success

     

    Mmm, perhaps the success you speak of is "how not to get a job and bum off the state all your life".

     

    I built my company on these principals. I have 1 supervisor and 6 guys working for me...there must be something to it. Read cashflow Quadrant to see what i mean about duplication and less work=more money

     

    And regarding a "good job" - My guys make good money but none will ever be free because they dont understand how to duplicate their time

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