Here are some examples of how to utilize mysql_error () mysql_connect(“your.hostaddress.com”, “username”, “password”) or die(mysql_error()) This will return an error if there is a problem connecting to your MySQL database $value = mysql_query($your_query) or die(“A MySQL error has occurred.<br />Your Query: ” . $your_query . “<br /> Error: (” . mysql_errno() . “) ” . …
Tag Archives: PHP
How to redirect browser to https (ssl) in php
How to redirect the browser to https when site is using http protocal in PHP? First of all, you should know that SSL must be installed in the server. To redirect the browser to “https” , we must know that the site is using SSL or not at the moment. And for this, there is …
Continue reading “How to redirect browser to https (ssl) in php”
Celebrating / eortologio GREEK
#Celebrating their name’s day: feedUrl = “http://eortologio.gr/rss/si_el.xml” #today #feedUrl = “http://eortologio.gr/rss/si_av_el.xml” #today – tomorrow #feedUrl = “http://eortologio.gr/rss/si_av_me_el.xml” #today – tomorrow – the day after tomorrow
Determine execution time in PHP
<!– put this at the top of the page –> <?php $mtime = microtime(); $mtime = explode(” “,$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; ;?> <!– put other code and html in here –> <!– put this code at the bottom of the page –> <?php $mtime = microtime(); $mtime = explode(” “,$mtime); …
.htaccess upload_max_filesize ini_set()
I m PHP 5.2.0 / Apache and I can’t access php.ini I try to update .htaccess and added php_value upload_max_filesize “25M” php_value post_max_size “25M” However it will give me “Internal Server Error”
PHP regular expressions examples
A simple method of validating an IP address using PHP and regular expressions <? $string = “255.255.255.255”; if (preg_match( ‘/^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/’, $string)) { echo “IP address is good.”; } ?>