Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Everything posted by dreamwest

  1. Im trying to edit a file where some lines end the same way: .....line1..example/line .....line2..example/line How can i find and delete these specific lines from a file? All ive got so far is the file open: <?php $file = fopen("example.txt", "r") or exit("Unable to open file!"); //Output a line of the file until the end is reached while(!feof($file)) { echo fgets($file). "<br />"; } fclose($file); ?>
  2. Would be easier to use one column for 1st and last names As they are... COUNT(*) FROM USER WHERE name = 'John' AND l_name = 'kain' If you want it more dynamic youll have to join the columns first......simple
  3. Not sure if this is what your after... Just name each query with a different name and the rows consecutively $query = (blablabla); $row ['bla']; //new query with 1st query results $includes = $row ['bla']; $query2 = (blablabla $includes); $row2 ['blabla'];
  4. Are you using templates? index.php and displaying with index.tpl
  5. Thanks for this. I was using a crappy form for support. This is much more efficient Sweeeeeeeeett!!
  6. Mysql docs are crap compared to php docs, at least beginners can understand php docs. Personally i learnt mysql syntax through text books and not through mysql website
  7. 263 chars http://www.google.com/search?hl=en&lr=&c2coff=1&rls=GGLG%2CGGLG%3A2005-26%2CGGLG%3Aen&q=http%3A%2F%2Fwww.google.com%2Fsearch%3Fhl%3Den%26lr%3D%26c2coff%3D1%26rls%3DGGLG%252CGGLG%253A2005-26%252CGGLG%253Aen%26q%3Dhttp%253A%252F%252Fwww.google.com%252Fsearch%253Fhl%253Den%2526lr%253D%2526c2coff%253D1%2526rls%253DGGLG%25252CGGLG%25253A2005-26%25252CGGLG%25253Aen%2526q%253Dhttp%25253A%25252F%25252Fwww.google.com%25252Fsearch%25253Fsourceid%25253Dnavclient%252526ie%25253DUTF-8%252526rls%25253DGGLG%25252CGGLG%25253A2005-26%25252CGGLG%25253Aen%252526q%25253Dhttp%2525253A%2525252F%2525252Fwww%2525252Egoogle%2525252Ecom%2525252Fsearch%2525253Fsourceid%2525253Dnavclient%25252526ie%2525253DUTF%2525252D8%25252526rls%2525253DGGLG%2525252CGGLG%2525253A2005%2525252D26%2525252CGGLG%2525253Aen%25252526q%2525253Dhttp%252525253A%252525252F%252525252Fuk2%252525252Emultimap%252525252Ecom%252525252Fmap%252525252Fbrowse%252525252Ecgi%252525253Fclient%252525253Dpublic%2525252526GridE%252525253D%252525252D0%252525252E12640%2525252526GridN%252525253D51%252525252E50860%2525252526lon%252525253D%252525252D0%252525252E12640%2525252526lat%252525253D51%252525252E50860%2525252526search%252525255Fresult%252525253DLondon%25252525252CGreater%252525252520London%2525252526db%252525253Dfreegaz%2525252526cidr%252525255Fclient%252525253Dnone%2525252526lang%252525253D%2525252526place%252525253DLondon%252525252CGreater%252525252BLondon%2525252526pc%252525253D%2525252526advanced%252525253D%2525252526client%252525253Dpublic%2525252526addr2%252525253D%2525252526quicksearch%252525253DLondon%2525252526addr3%252525253D%2525252526scale%252525253D100000%2525252526addr1%252525253D%2526btnG%253DSearch%26btnG%3DSearch&btnG=Search
  8. Im using the free version of navcat. But is it worth buying the full version?
  9. Im using varchar(255) for my urls . You proberly wont need varchar(2000) for urls, Ive never seen a url with 2000 characters, besides itll slow down your query
  10. What would it take to set up my own server? Apart from security issues in doing it , i still want to give it a go. I have a couple of low traffic sites (300 - 400 visitors/day) that i can test it on I have alot of content on my pay sites and will be seriously pissed if the host shut down or deleted my account because of high traffic load or some other clause. Ive had this before even on a vps - their reason too much bandwidth within a 2 hour period
  11. $query = "SELECT table1.column, table2.column ". "FROM table1, table2 ". "WHERE table1.column = table2.column"; $result = mysql_query($query) or die(mysql_error());
  12. If 1) , 2) etc are rows, Dont use a <br> after $row $query = "SELECT * FROM example"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo $row['title']; }
  13. Your right it works. Didn't think you could divide to columns values against each other within a query
  14. I need to divide one column with another and sort a value of 5 DESC Original code: $sql = "SELECT * FROM rank ORDER BY total_value DESC "; Now i need to divide 2 columns - total_value and total_count, then ORDER by 5 DESC What ive come up with so far: $sql = "SELECT * FROM rank ORDER BY (total_value/total_count) DESC "; (total_value/total_count) will always produce 5 or less
  15. I want to add time() and mt_rand() together so when i rename a file to a number and insert the name into the database there wont be duplicate names, and it makes it harder for ppl to guess the file name and try and use a download manager or script to download the entire directory of files. Currently im embedding content: file=http://site.com/files/name_of_file.mpg But i want to ultimately us this system: file=http://site.com?video_key=random_key_here Maybe a htaccess config might do...
  16. But still a random number. Sweet! It was just an example...like an orange ad an apple - both are round. Simple logic really
  17. Ive seen this somewhere mt_rand( ) Will this do the same thing as say time()
  18. Ok thatll work....But how to create a random number??
  19. How can i create a random 10 digit number for a string Original string: $string = "She walks down the street"; String converted to number $string = "She walks down the street"; //Randomly generated string $new_string = 1234613401198208671; $file = str_replace($string,$new_string ,$string);
  20. No sure what you mean but theres always a simple answer Your hyperlinks should look like : http://site.com/Pretty_url/id number Not: http://site.com/display.php?id=$1 For forms use a redir.php instead of direct <form name="searchForm" action="/redir.php" method="GET"> <INPUT class=search_box tabIndex=1 maxLength=128 name="id" value="" size="31"> <input type="submit" value="Search"> </form> And in redir.php: *This will handle all your str replace stuff so you can add extras to the string $search=$_REQUEST['id']; if($id == '' ) { echo "ERROR!!"; //Or just redirect header("Location: index.php"); }else{ $search= str_replace("-"," ",$search); header("Location: Pretty_url/$search"); }
  21. Tried that but displays " instead of " Im outputing $search on the page
  22. RewriteRule ^Pretty_url/(.*) display.php?id=$1 Will show http://www.site.com/Pretty_url/23
  23. I have a search function that allows tags to be searched "<" and ">" etc Ive been using str_replace(): $search=$_REQUEST['search']; $search=str_replace("\'","'",$search); $search=str_replace("\"",""",$search); Is there a function to make all tags safe for form searches
  24. Works! Thanks Ive seen the concat operator around but assumed it was a joiner not a loop joiner (similar to while loop)
  25. Change: $test = (int)$_GET['test']; To: $test = $_GET['test'];
×
×
  • 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.