Call Total Number From MySQL Row
1 2 <? 3 // Query the database and get the count 4 $result = mysql_query("SELECT * FROM TABLE_NAME"); 5 $num_rows = mysql_num_rows($result); 6 7 // Display the results 8 echo $num_rows; 9 ?>
13376 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
1 2 <? 3 // Query the database and get the count 4 $result = mysql_query("SELECT * FROM TABLE_NAME"); 5 $num_rows = mysql_num_rows($result); 6 7 // Display the results 8 echo $num_rows; 9 ?>
1 2 //connect to your database ** EDIT REQUIRED HERE ** 3 mysql_connect("localhost","username","password"); //(host, username, password) 4 5 //specify database ** EDIT REQUIRED HERE ** 6 mysql_select_db("database") or die("Unable to select database"); //select which database we're using
1 2 <?php 3 $timezone = "the UK"; 4 $time_diff = "0"; 5 $alter = ($time_diff * 60 * 60); 6 $date_today = date ("l F jS Y", time () + $alter); 7 $time_now = date ("h:ia", time () + $alter); 8 9 echo "It's currently <strong>$time_now</strong> on <strong>$date_today</strong> in <strong>$timezone</strong>."; 10 ?>
1 2 <a href="#" onclick="window.scrollTo(0,0); return false">Back to Top</a>
1 2 <a href="javascript:history.back();">Back A Page</a> | <a href="#" onclick="window.scrollTo(0,0); return false">Back to Top</a> | <a href="javascript:history.forward();">Forward A Page</a>
1 2 <script type="text/javascript"> 3 <!-- 4 5 if (document.images) 6 { 7 preload_image_object = new Image(); 8 // set image url 9 image_url = new Array(); 10 image_url[0] = "http://mydomain.com/image0.gif"; 11 image_url[1] = "http://mydomain.com/image1.gif"; 12 image_url[2] = "http://mydomain.com/image2.gif"; 13 image_url[3] = "http://mydomain.com/image3.gif"; 14 15 var i = 0; 16 for(i=0; i<=3; i++) 17 preload_image_object.src = image_url[i]; 18 } 19 20 //--> 21 </script>
1 2 <? 3 $last_modified = filemtime("pagename.php"); 4 print("Last Modified"); 5 print(date("j/m/y h:i", $last_modified)); 6 ?>