Prime Number generation using php
PHP code for generating prime number.IF a number is divisible by 1 and the number itself it is a prime number.in the below code $number_of_time_divide is greater than
PHP code for generating prime number.IF a number is divisible by 1 and the number itself it is a prime number.in the below code $number_of_time_divide is greater than
Using select statement we can fetch the data from mysql table. here we will use 2 function to fetch the data .first is mysql_query() to execute query and mysql_fetch_array() to return the data. this will return data as associative,numeric,or as both. if you use second parameter/argument in mysql_fetch_array() as MYSQL_ASSOC- it will return array as… Read More »
using the below function to select a database Syntax —– bool mysql_select_db($databasename,$connection); $databasename- Name of the Database you want to select $connection– connection string you are getting after executing mysql_connect Example ——-
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<?php $databsehost = 'localhost'; $databasebuser = 'root'; $databasebpassword = ''; $conn = mysql_connect$databsehost,$databasebuser, $databasebpassword); if(! $connection ) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_select_db( 'mydoubts' ); mysql_close($connection); ?> |
This function will return the trailing name component of path Syntax —— string basename( string $path[, string $suffix]) example ——–
1 2 3 4 5 6 7 |
<?php echo "1) ".basename("/vasanthan/mydoubts.in", ".in").PHP_EOL; echo "2) ".basename("/vasanthan/hello").PHP_EOL; echo "3) ".basename("/vasanthan/").PHP_EOL; echo "4) ".basename(".").PHP_EOL; echo "5) ".basename("/"); ?> |
output as below 1) mydoubts 2) hello 3) vasanthan 4) . 5)