pan wrote:

> >Ah, sorry I didn't make it terribly clear. I meant that I only ever get
> >a maximum of 255 chars returned.
> 
> O.K. - then that makes it seem a truncation problem and not a
> data definition problem.
> 
> minor thing: in edit_exam_question.php  there is
> "  print '<a align="left">Select Correct Answer:<br>'; "
> 
> What's the <a tag? I don't know that one   :)

It's a new tag I just invented :-)

> You might want to add the 'readonly' attritbute to
> that textarea - lessens chance of unwanted post variables.
> You seem to be using that textarea only for displaying the
> retrieved question_text

These pages are for the "admin" user to be able to edit/delete any
question or possible answers, As such I left the text area rw so that
they could change it.

> Either one of the unknown queries in edit_exam_question.inc
> is truncating the data or the url parameter is truncated, or
> dbconn.inc is the culprit.

dbconn.inc only holds servername, username and password. I've attached
it and the other missing file to this message - with differing passwords
of course :-)

> Three chances at answering the problem, not enough data.
> Except for the url parameter passing - but only id and
> question_id get passed so no chance on the parameter formatting

Yes, I thought I'd keep url passing down to a minimum and only ever pass
record id's.

> ooops ... files attached only reiterate the problem and do not serve to
> further illuminate the path to happiness.

I've attached the two missing files, so this should help to diagnose
what I've stuffed up.

--
Rgds,
Chris MacKenzie

Windows: "Where do you want to go today ?"
 Mac OS: "Where do you want to be tomorrow ?"
  Linux: "Are you coming or what ?"
<?php

include('dbconn.inc');

$sql="SELECT * FROM tbl_exam_questions WHERE question_id=$question_id;";
$sql1="select * from tbl_exam_answers WHERE question_id=$question_id order by id;";

$result=mssql_query($sql,$conn1);
if(!$result) {
        print "No Records Found.<BR><BR>";
        mssql_close($conn1);
        exit;
}

$result1=mssql_query($sql1,$conn1);
if(!$result) {
        print "No Records Found.<BR><BR>";
        mssql_close($conn1);
        exit;
}

# Can't seem to find a good way to copy the returned array
# so I'll use a kludge and just re-submit the query.
# There must be a better way, but I'm pressed for time :-(

$result2=mssql_query($sql1,$conn1);
if(!$result) {
        print "No Records Found.<BR><BR>";
        mssql_close($conn1);
        exit;
}


$numrows = mssql_num_rows($result);
$numrows1 = mssql_num_rows($result1);
# $numrows2 = mssql_num_rows($result2);

#
# It doesn't matter if no rows are found as an empty table will be 
# presented to the web browser, which looks better than some
# ugly text based error message anyway.
#
#if(!$numrows) {
#       print "Cannot load data into array.<BR>";
#       mssql_close($conn1);
#       exit;
#}


## TODO
# I might add some code to alternate the background colour of the table cells
# from a light grey and white to make it easier to read the table when a large 
# amount of data is returned or the page is printed to a hardcopy.

$row = mssql_fetch_array($result);

?>
<?php
$dbservername = "blp008";
$dbname = "entry_exam";
$dbusername = "someuser";
$dbpassword = "somepasswd";

$conn1=mssql_pconnect($dbservername,$dbusername,$dbpassword);
if(!$conn1) {
        print "Cannot Connect to SQL Server. Please contact your system 
administrator.";
        exit;
}
$result=mssql_select_db($dbname,$conn1);
if(!$result) {
        print "Cannot Select SQL Database.<BR>";
        mssql_close($conn1);
        exit;
} 
?>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to