Read And Write Image PHP

July 17th, 2008

function save_image($url,$filename){
$ch = curl_init ($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$rawdata=curl_exec ($ch);
curl_close ($ch);

$fp = fopen($filename,’w');
fwrite($fp, $rawdata);
fclose($fp);
}

When you run this function and get error  call undefined function curl_init  you must enable curl php extension  in php.ini file.

How to restore database SQLServer 2005

July 8th, 2008

Yesterday I attempt to backup and restore my database I use sql server 2005 version developer . I want to copy database “DataTest” to new database name “MyDB” I try two ways first I backup “DataTest” then restore to “MyDB” but when restore sql server have error . Second restore database “DataTest” to “MyDb” and but not work I attempt about 4 hours I google then found answer then I can restore.

How I solve problem ?

When I backup sql server backup two files are:


C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataDataTest.mdf

C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataDataTest_log.ldf
C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataMyDB.mdf C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataMyDB_log.ldf

Cannot modify header information

July 7th, 2008

I’m have php error when  I user header(”Location:index.php”);  I’m google to take amswer

Originally Posted by kenmcd

The “headers already sent” error is usually caused by having white space before or after the opening and closing PHP tags (<?php . . . ?>).

Have you recently edited any files?

 

Is good.

Source : http://forum.mamboserver.com/showpost.php?p=265568&postcount=10

Comment multi line T-SQL Server

May 29th, 2008

CREATE TABLE Students
/* A table named Students
with Primary Key as Id
will be created */
(
Id INT PRIMARY KEY,
Name VARCHAR(50) NOT NULL,
Address VARCHAR(40) NOT NULL,
/*Only the phone number accepts null value */
Phone INT
)

Stored Procedure varchar (8000) limitation.

May 29th, 2008

SELECT @qry = CAST(@qry1 AS VARCHAR(MAX)) + CAST(@qry2 AS VARCHAR(MAX))

– ————————————————————–

– You would expect the length of @qry to be 10,000 at this point

– But that is not true. The length will be 8000.

– ————————————————————–

SELECT

LEN(@qry) AS sqlLength,

LEN(@qry1) AS sql1Length ,

LEN(@qry2) AS sql2Length

/*

sqlLength            sql1Length  sql2Length

——————– ———– ———–

10000                5000        5000

*/

 For SQL Server 2005 or higher