Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Everything posted by dreamwest

  1. You poor little boys n girls - I cant believe most of you live on less than $4000 AU a month ....and "they" say money dosent buy happiness HA!....theyre right! - It buys incredible happiness Remember, 98% why 2% how = Success
  2. 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: You can add this : if($_FILES["uploadedfile"]["size"] > (25* 1024)){ echo 'Too Large!' die(); }
  3. yes. Just add it to the top of the upload script 200 M is how many MB you want to allow
  4. 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
  5. 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
  6. 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
  7. 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
  8. $myarray[0]="first"; $myarray[1]="second"; $myarray[2]="new"; $myarray[3]="wow!"; foreach($myarray as $step){ echo $step."<br>"; }
  9. $arr = array(your array here) foreach($arr as $var){ $all .= $var; } echo $all;
  10. 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
  11. 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
  12. 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
  13. 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?
  14. 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??
  15. 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"; } }
  16. 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>
  17. I have a local image im trying to send to the browser but nothing happens $path = "/home/user/public_html/ajax/test.jpg"; header('Content-type: image/jpg'); header("Content-Disposition: attachment; filename='{$path}'");
  18. I dont think ill ever sell any scripts - This is a hobby for me
  19. 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.