Jump to content

shaddf

Members
  • Posts

    102
  • Joined

  • Last visited

Everything posted by shaddf

  1. how can I rewrite localhost/base/stage/Major.php to main-shop my htaccess file is located in folder base together with the index file and has this in it RewriteRule ^my-shop/?$ /stage/Major.php [R=301,L]
  2. I have such a directory structure: httpdocs/ .htaccess index.phpmain/ splash.php home.php app/ app.php images/ hello.png images1/ hello2.png js/ jquery.js css/ style.css how can i do urlrewriting to all files in sub folders,so that my app can be seo friendly.I have tried this: <IfModule mod_rewrite.c> # Enable mod_rewrite RewriteEngine On # Specify the folder in which the application resides. # Use / if the application is in the root. RewriteBase /httpdocs # Rewrite to correct domain to avoid canonicalization problems # RewriteCond %{HTTP_HOST} !^www\.yyy\.com # RewriteRule ^(.*)$ http://www.yyy.com/$1 [R=301,L] # Rewrite URLs ending in /index.php or /index.html to / RewriteCond %{THE_REQUEST} ^GET\ .*/index\.(php|html?)\ HTTP RewriteRule ^(.*)index\.(php|html?)$ $1 [R=301,L] # Rewrite category pages RewriteRule ^.*-d([0-9]+)/.*-c([0-9]+)/page-([0-9]+)/?$ home.php?Depart mentId=$1&CategoryId=$2&Page=$3 [L] RewriteRule ^.*-d([0-9]+)/.*-c([0-9]+)/?$ home.php?DepartmentId=$1&Cate goryId=$2 [L] But it returns me to the: localhost Index of /httpdocs/main Name Last modified Size Description Parent Directory - what can I do to clear this?? note relative links to home.php are in splash.php which take me to home.php -the activity page
  3. how can I get the code of a function to a text file in mysql?how can i dump database with the stored functions too?
  4. is it possible to insert and delete from the same table using the same transaction in mysql. something like: START TRANSACTION; DELETE FROM Al where vc='frdehy' ; INSERT INTO Al(vc,zzz ,subj_id) VALUES('bgo' ,'mij','rey'); commit;
  5. Is this allowed in mysql transactions;Can i insert conditionally into different tables by different users to insert data : i have tried this inside a stored procedure,but can someone correct me if it is good approach: START TRANSACTION; INSERT INTO minderstbl(m_date,m_notes )VALUES(in_date,in_remindernotes); SELECT Rm_id INTO l_rem_id FROM minderstbl where m_date=in_date and m_notes=in_remindernotes limit 1; IF in_status = 1 THEN INSERT INTO i_ndertbl(id,Doc_id,frq_no,eq_text )VALUES(l_rem_id,in_doctitleid,in_freq_no,in_freq_text); ELSEIF in_status = 2 THEN INSERT INTO nderstbl(ct_id,em_id,eq_no,q_text )VALUES(in_compid,l_rem_id ,in_freq_no,in_freq_text); ELSEIF in_status = 3 THEN INSERT INTO rstbl(m_id,q_no,q_text )VALUES(l_rem_id ,in_freq_no,in_freq_text); END IF; if l_rem_id !='' then SELECT l_rem_id ; end if; COMMIT;
  6. Thanks for the back up folder option.I'll consider it next time i try out things. but in a system with very limited resources and the fact that I only want this file not to be overwritten incase of another upload to the source folder and I only need it to be inside the database for a limited period and must be deleted if indeed a back up has been successfully made in the back up folder(intended destination). task:delete attributes about the file from table that stores them,insert these in backuptable ,get the file from source,temporarilty store it in db as blob .If copy to destination is done ,delete ffrom temp table .
  7. save files as blobs from folder into database. is this code safer- am I on right track?? how can I apply rename() and test if it has succeeded: $temp_file=file_get_contents("./jaen/pierre.pdf"); if(is_uploaded_file($temp_file)) and file_put_contents("./jonah/pierre.pdf",$temp_file)){//mysql to insert here insert into base(data)values($temp_file); }
  8. but it turns it to a string and in my database i have a blob field should i use text for it: Also incase i had a pdf file, how am I supposed to save it back to the destination folder in its original form after I have put it as string in my database
  9. Is there a way to move the file contents to Mysql database and sae as blob without using the fileInput. I have read through the uploading way . but now here is a situation where The script it'self has to copy the file to a database before it can be deleted from source folder. Why ? incase of power failure and file has failed to be copied using rename(), an original copy is in the database waiting to replace it in the intended destination folder later. you realise in this case I cannot show the fileInput form. How can I go about this?? can file_get_contents() be used to upload the file to mysql as blob?
  10. Is there a way of moving a file from one directory to another with out using the file input in php. say if the file has already been uploded to directory a before and now is being archived to directory b.
  11. in my case, what is the document root here:/home/mary on the cpanel structure? and is that possible on shared hosting(Place it outside of the document root and make sure it's not readable by anybody but the webserver.)
  12. where can I put my db login details on a shared web server if this is my directory structure: /home/mary/ it is on cpanel framework so etc folder,,publichtml folder are in mary. wht is the best possible way to have them secured ?
  13. at the end of a sentence, just like in literature i.e period,comma,semicolon,colon,hyphen and question mark
  14. how can I make this regex allow punction marks "/^([a-zA-Z\s ]){4,30}$/" At the moment it doesn't.
  15. I chose that because it works for my scenario right now and I got the feel of how to do it using strings instead of going to use temporary tables
  16. could you please verify "real". Is it because that is the way it has been done and will always be?Is it faster query ?Is it best for sql optimization and server overload? why do you really recommend it.I know it is feasible option but why?
  17. thanks for the idea.Ithought there could be a way of working with the strings direct.I thought it would be faster
  18. i have a table with these fields: table:_projecttbl fields(P_id,PrT_id,Other_id) I have a string like so: 'HG||Fxg|||ergx||xx' at every '|||' marks the begining of PrT_id and Other_id respectively. and it can have more than 64 records. I would like to write a query to delete from table where not exists in the string and P_id="known value" DELETE FROM _projecttbl WHERE NOT EXISTS (SELECT * FROM _projecttbl AS T1 WHERE T1.Project_id='1'); that is what i have tried but removes all.
  19. $cars = array ( array("goat",22,18), array("pig",15,13), array("rabbit",5,2), array("doe",17,15) ); i have that array. and i would like it to be imploded like so: Result: goat||22||18~pig||15||13~rabbit||5||2~doe||17||15 how can I adjust this function to do the work; function r_implode( $glue, $pieces ) { foreach( $pieces as $r_pieces ) { if( is_array( $r_pieces ) ) { $retVal[] = r_implode( $glue, $r_pieces ); } else { $retVal[] = $r_pieces; } } return implode( $glue, $retVal );
  20. the data is coming from a user input,user enters details about cars,these are put togetherinto an array that is imploded into string. create database cars; uuse cars; CREATE TABLE cars ( id Int Unsigned Not Null Auto_Increment, Cname VarChar(255) Not Null Default 'Untitled.txt', Esize int, Fsize int, PRIMARY KEY (id) )ENGINE=InnoDB DEFAULT CHARSET=utf8; the data iam working with is the cars details.and is coming from the array.
  21. this works well on the php side: $cars = array ( array("Volvo",22,18), array("BMW",15,13), array("Saab",5,2), array("Land Rover",17,15) ); function r_implode( $glue, $pieces ) { foreach( $pieces as $r_pieces ) { if( is_array( $r_pieces ) ) { $retVal[] = r_implode( $glue, $r_pieces ); } else { $retVal[] = $r_pieces; } } return implode( $glue, $retVal ); } echo r_implode( '||', $cars ) it does turn the array into a string: Result: Volvo||22||18||BMW||15||13||Saab||5||2||Land Rover||17||15 now iam using a stored procedure to insert into database and the code here works well for a single dimension array that has been imploded.now I would like to make it work for the multi deimensional array that has been imploded too.. set v_counter=1 while v_counter <=length do set child = SPLIT_STRING($cars, '||', v_counter); select child ; set v_counter=v_counter+1; end while; where length =no of items in array. so if i have the main array with 2 child arrays inside, length=2.this is where i was requesting for different separators as glue for tho main and child arrays inside it. such that i have something like: Result: Volvo||22||18|||BMW||15||13|||Saab||5||2|||Land Rover||17||15
  22. At the end of the day i need to loop through the main array(knowing its length from count($cars)),get each child array string,split it up one by one and save each as a single value in the same database table.I have tried this: set length=count($cars)#gotfrom php while v_counter <=length do set child = SPLIT_STRING($cars, '||', v_counter); select child ; set v_counter=v_counter+1; end while; but it gets only the first value in the array (volvo) i.e if the parent array has only one child: Volvo||22||18 it does not give me the whole string
  23. thanks this looks the right direction.but in my case each child array is a record,can't I specify a different glue in each of the children say ',' and '||'remains for the main parent
  24. how can i use implode() on a multi dimensional array? say I have: $cars = array ( array("Volvo",22,18), array("BMW",15,13), array("Saab",5,2), array("Land Rover",17,15) ); And i say: implode('||',$cars); what will it be like in the string ?what effect will it have on the inner child arrays of $cars?will they also have the '||' as separator?
×
×
  • 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.