Category Archives: PHP

PHP / MySql – Export Data to Excel

A PHP Script to export MySql data to Excel.



$select= "select user_id,email,fname,lname,bdate,fees from user order by fname";
$result = mysql_query($select);
$num_row = mysql_num_rows($result);
Continue reading


PHP : Resize embedded video

$video = stripslashes($embedded_video_code);

$video = preg_replace('~(]*width\s?=\s?["\'])[^"\']+(["\'])~i', '${1}300${2}', $video);

$video = preg_replace('~(]*height\s?=\s?["\'])[^"\']+(["\'])~i', '${1}200${2}', $video);

PHP : Create array from MySql recordset

This PHP code is to create array from MySql record set.

$sel=”SELECT * FROM table_name”;
while ($row = mysql_fetch_assoc($rs))
$array[$i] = $row;