Jump to content

Vikas Jayna

Members
  • Posts

    121
  • Joined

  • Last visited

About Vikas Jayna

  • Birthday 10/01/1981

Profile Information

  • Gender
    Male
  • Location
    Noida, Delhi, India

Vikas Jayna's Achievements

Member

Member (2/5)

0

Reputation

  1. You can convert the above string into date format by using the below query:- select str_to_date('August 2, 2010 11:04 pm','%M %e, %Y %h:%i %p'); output is 2010-08-02 23:04:00 Now you can apply other date functions on this to get the desired result. For eg. select Month(str_to_date('August 2, 2010 11:04 pm','%M %e, %Y %h:%i %p')), day(str_to_date('August 2, 2010 11:04 pm','%M %e, %Y %h:%i %p')), year(str_to_date('August 2, 2010 11:04 pm','%M %e, %Y %h:%i %p')) This will give the desired output of month=8, day=2 and year=2010
  2. You'll have to create a recursive procedure to find all the subcategories within a category and then use this list in the IN clause of the SQL query to find all the products within these categories
  3. Think this is the best solution possible. As such the difference between mediumtext and text is only the extra byte used by mediumtext to store the length of the string and hence there is hardly any overhead of declaring the column as mediumtext
  4. We'll need to know the encoding algorithm to be able to decode it. Look like hexadecimal codes - every couple of bytes have been picked and then changed to hexadecimal code. Just guessing!!
  5. I need a deployer that's easy to use and can deploy PHP applications on multiple servers simultaneously since the traffic of the website is getting distributed across all the servers using LVS. Any suggestions?
  6. Try using regexp - http://dev.mysql.com/doc/refman/5.0/en/regexp.html
  7. Issue is not related to PHP. Hotmail could be treating mails from your server as spam. Check the messages in your server maillogs or ask the system administrator to do the same, see if the mails are bouncing and if yes - check why the recipient server is rejecting them. Generally the bounced message will be containing a diagnostic message explaining the same.
  8. To restore the database the mysql command is to be used. mysqldump cannot restore.
  9. I've recently upgraded from PHP 4.3.2 (cgi) to PHP 5.2.4 (cli). As a result I'm facing the following issue while running php from the command line: I execute a file a.php in my home directory as php -q a.php the file a.php includes a php file like this include ("/var/www/html/b.php") the file b.php further has includes like include("c.php") now the file c.php is located within /var/www/html but the newer php version looks for the file in my home directory while the older version looks for it in /var/www/html A workaround for this that I've used is to change the current directory using the chdir function to /var/www/html and it works but this process becomes quite cumbersome if the script is having a number of includes this way from separate directories. Is there any configurational change that can be done in php to avoid these issues?
  10. I am trying to make a middle layer for interaction between the database and the applications Hence I created a function _db_query() that is to be called to execute any query throughout the application on our site. This function does some decision making about which server the query should go to. The function uses mysql_query() function then to execute the query on that server. The issue is that I need to restrict the use of mysql_query() function from anywhere else in the application and force them to use the function _db_query() so as to avoid mistakes in case a programmer forgets to call _db_query() and instead calls mysql_query() Any ideas about implementing this?
  11. A javascript file can be served through php also. The php file can simply process and decide what should be the javascript code and simple throw that code to the browser. The following line will have to be added to the top of the php file in order to tell the browser that the content is javascript: header("Content-type: application/x-javascript"); Also, the file extension can be kept .js and mod_rewrite can be used in apache to direct the file to a php file like this: RewriteRule ^abc.js$ abc.php [T=application/x-httpd-php] The above line cab be used in .htaccess. This way the browser will call file "abc.js" but actually "abc.php" will be executed on the server.
  12. There is no need of adding any php files. Here is the crontab code for executing the command at 00:00 hrs everyday 00 00 * * * /bin/rm -rf <foldername> And yes the complete path to the folder has to be given.
  13. You can use a two table structure wherein there is one table is used to store categories i.e. the table will contain exactly one record for each category. The second table will then be used to represent a parent-child relationship between the categories. For e.g. in the above case "software" is a parent of "computer games" and "computer games" is a parent of "strategy".
  14. How about using a simple linux command in cron: rm -rf <foldername>/*
  15. addslashes is used to put back slashes in front of quotes so as to avoid syntax errors in sql queries in case the query contains some values that are taken from a text field. Stripslashes would be used to remove the slashes in case we don't want them. For e.g. quite often magic_quotes_gpc is set to On in php.ini so that slashes are automatically added in from of quotes and there is no need to explicitly use addslashes. It is good to keep magic_quotes_gpc On so as to avoid SQL Injection attacks. But in this case if the values taken from the text field is to be displayed somewhere then the extra slash would appear in the output and hence stripslashes is used to remove the same.
×
×
  • 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.