|
Posted by Ian Davies on 11/06/05 17:26
Hello
I have the following code which changes directory, creates a file and then
writes rows to it. It works fine except the file is created in the folder
the php script is in instead of the download directory specified in the
scrip. Can anyone see where I have gone wrong
Also I want to show the question Index and Question on screen as a list.
Ive put
echo $nt['QuestionIndex'], $nt['Question'];
here <<<<<<<<<<<<<<<< in the script
but it doesnt work, any ideas?
Ian
******************************
$query= "SELECT * FROM Questions WHERE NCIndex='".$_SESSION['NCI']."' AND
QuestionIndex IN (".join(",", $_SESSION['questions']).") ORDER BY
QuestionIndex";
$rt=mysql_query($query)
or die(mysql_error());
echo mysql_error();
if (ftp_chdir($conn_id, "../htdocs/Downloads")) {
echo "Current directory is now: " . ftp_pwd($conn_id) . "\n";
}else {
echo "Couldn't change directory\n";
}
$fp = fopen('ptq'.$_SESSION['username'].time().'.txt', 'w')
or die('Could not open the text file for writing');
while ($nt = mysql_fetch_array($rt, MYSQL_NUM)){
$line = "INSERT INTO tQuestions VALUES ('', '" .
implode("', '", $nt) .
"');\r\n";
fwrite($fp, $line);
echo $nt['QuestionIndex'], $nt['Question']; <<<<<<<<<<<<<<<
}
fclose($fp);
***************************
[Back to original message]
|