Jump to content

Recommended Posts

Hi All, I facing a problem with Ms Access. When i set my datatype to "Short Text", the data display perfectly. just because of limitation of "Short Text", it can only handle 255. So i decided to change the datatype to "Long Text", but the text wont display our. 

 

FYI, im using for web base data and i am using PHP language.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/302400-microsoft-access-database/
Share on other sites

What's your code?

$sql = "SELECT * FROM 
    (requestorInfo i 
    LEFT JOIN requestStatus s ON i.RequestID = s.RequestID)
    INNER JOIN requestRoomInfo ri ON ri.RequestID = i.RequestID";
$rs = odbc_exec($conn, $sql);

PHP CODE

echo "<tbody>";
while (odbc_fetch_row($rs)) {
                $desc = odbc_result($rs, "Description");

                $tbody = '<tr><td>'.$desc.'</td>
                echo $tbody . '';
                echo '</tr>';
}
echo '</table>';


The $desc display out when the data type in Ms Acess is Short Text. Once i change to Long Text, it display empty.

Your code has quotes missing. Notice the color of the text in the code box above?

echo '<tbody>';
while (odbc_fetch_row($rs)) {
     $desc = odbc_result($rs, "Description");
     $tbody = '<tr><td>'.$desc.'</td>
     echo $tbody . ';
     echo '</tr>';
}
echo '</table>';
Edited by FooKelvin

Look at the output. It's not just empty text, the entire rows are missing. This means your script probably fails at some point, but you've not managed to set up proper error handling.

 

Turn your error reporting all the way up and either display the errors (during development) or log them (in production). Unless the ODBC throws exceptions automatically, you also need to do this manually. Don't just assume that every function call succeeds.

 

It also helps to run the query alone (in the console or in phpmyadmin). Does it yield the correct result set?

 

Finally, I'm irritated that each fragment of your alleged code contains syntax problems, even though you claimed it worked fine before the data type change. So did you change the code as well?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.