Showing posts with label php. Show all posts
Showing posts with label php. Show all posts

Monday, August 15, 2011

mysqli tutorial

moving from procedural coding style to OOP this article telling basic information and maybe helpfull


Getting some info on the result from the mysql database:
 
 $mysqli = new mysqli('localhost','db_user','my_password','mysql'); // Get all the MySQL users and their hosts $sql = "SELECT user, host FROM user"; // If the query goes through if ($result = $mysqli->query($sql)) { // If there are some results if ($result->num_rows > 0) { // Let's show some info echo 'There were '.$result->num_rows.' rows returned. '; echo 'We selected '.$result->field_count.' fields in our query. '; echo 'Our thread ID is '.$mysqli->thread_id.' '; // Ok, let's show the data while ($row = $result->fetch_object()) { echo 'Username: '.$row->user.' :: Host: '.$row->host.' '; } // end while loop } else { echo 'There are no results to display. Odd how we connected to this database and there are no users.'; } // end else } else { // Notice the error would be within the mysqli class, rather than mysql_result printf("There has been an error from MySQL: %s",$mysqli->error); } // end else // Close the DB connection $mysqli->close(); ?>

also read mysql performance

Sunday, August 14, 2011

php tutorials

http://www.askaboutphp.com/

recently browsing about date and time manipulation


this website was bookmark here and there are another new thing to explore like codeigniter and jquery. nice step by step tutorial.

Monday, June 13, 2011

@ in front prevent display error [PHP]

http://www.webcheatsheet.com/PHP/variables.php

why joomla using @ in front of joomla variables?

for example use @$var1 = "AA";

this will prevent php from showing error when defining variables

thanks to Joshua

@ in front of a variable prevents the output of error and warning messages
# Posted by Joshua Reynolds | 26 Jan 2007 04:46:16
Related Posts Plugin for WordPress, Blogger...