0

I'm using PHP in combination with an Oracle database. What I want is the following: On the first form I want to select a name out of a table in the database and when you push the button open I want the users to see a html form where the fields are filled in with the information from the person you've selected on the first screen. You can edit this information and when you push the update button the table has to be updated. I don't know who to do this whole process in PHP in combination with Oracle. Can someone please help me? This is an important part of a project I'm doing and I can't find any information anywhere! I really hope someone can help me.
PHP & Oracle database edit/update data. geting error Undefined variable: objResult on <<<-----here

<?
    $objConnect = oci_connect("myuser", "mypassword", "TCDB");
    $strSQL     = "SELECT * FROM CUSTOMER";
    $objParse   = oci_parse($objConnect, $strSQL);
    oci_execute($objParse, OCI_DEFAULT);
?>  
            <table width="600" border="1">  
            <tr>  
            <th width="91"> <div align="center">CustomerID  </div></th>  
            <th width="98"> <div align="center">Name  </div></th>  
            <th width="198"> <div align="center">Email  </div></th>  
            <th width="97"> <div align="center">CountryCode  </div></th>  
            <th width="59"> <div align="center">Budget  </div></th>  
            <th width="71"> <div align="center">Used  </div></th>  
            <th width="30"> <div align="center">Edit  </div></th>  
            </tr>  
<?
    while ($objResult = oci_fetch_array($objParse, OCI_BOTH))
    {
?>  
             <tr>  
             <td><div  align="center"><?= $objResult["CUSTOMERID"]; ?></div></td>  <<---here
             <td><?= $objResult["NAME"]; ?></td>  <<---here
              <td><?= $objResult["EMAIL"]; ?></td>  <<---here
              <td><div  align="center"><?= $objResult["COUNTRYCODE"]; ?></div></td>  
                 <td align="right"><?= $objResult["BUDGET"]; ?></td>  <<---here
                    <td align="right"><?= $objResult["USED"]; ?></td>  

             <td align="center"><a  href="php_oracle_update2.php?CusID=                                                                                  <?=$objResult["CUSTOMERID"];?>">Edit</a></td>    
               </tr> 
               <?
                }
               ?> 
                </table>  
<?
    oci_close($objConnect);
?>      

2 Answers 2

1

Your while loop will probably only work for the first line. Make sure you use { } for every loop, be it one line or many.

Sign up to request clarification or add additional context in comments.

Comments

0

This error could mean that short_open_tag isn't enabled in your php.ini, and due to that PHP actually sees no code in your template. Only the <?= ... ?> tags are working, while the <? ... ?> are not.

Your options:

  1. Set short_open_tag = On in your php.ini. Or,
  2. use full <?php ... ?> tags instead

Also, the while loop isn't complete. Try:

<?
    while ($objResult = oci_fetch_array($objParse, OCI_BOTH)):
?>  

    // ...

<?
    endwhile;
?>  

2 Comments

i can't see to set short_open_tag = On in php.ini plz help
You should be using <?php ... ?> it's best practice. Anyhow, just add the line at the bottom (anywhere) in php.ini, restart server. Maybe try this for troubleshoot stackoverflow.com/questions/12579448/… Also check out php.net/short-open-tag

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.