![]() |
|
|
|||||||
| PHP - Code PHP programming - Ask questions and help people with PHP code. If you are stuck and need help, this is where you ask for help. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi this is Srinivas.
I am facing many problems in database(ms access 2003) connection and retrival please help me. I am also facing the problem to assign a value in the input tag I have attached the code below:- This is the form from where i will send the data SU.PHP <html> <body bgcolor="silver" > <form method="post" action="login1.php"> <h2> Create an Account</h2> <br><br> <<table cellpadding="30"> <p><tr><td> <font color="blue"><h2>First Name:</h2></td></font> <td><input type="text" name="fn"> </p></tr> <p><tr><td> <font color="blue"><h2>Last Name:</h2></td></font> <td><input type="text" name="ln"> </p></tr> <!-- This the part from where the data has to be sent--> <p><tr><td> <font color="blue"><h2>Desired User Name:</h2></td></font> <td><input type="text" name="un"> </p></tr> <!--This the end of it--> <p><tr><td> <font color="blue"><h2>Password:</h2></td></font> <td><input type="password" name="pa"> </p></tr> <p><tr><td> <font color="blue"><h2>Re-type Password:</h2></td></font> <td><input type="password" name="pa1"> </p></tr> <p><tr><td> <font color="blue"><h2>Security Question:</h2></td></font> <td><input type="text" name="sq" value="Type your question" size=50> </p></tr> <p><tr><td> <font color="blue"><h2>Answer:</h2></td></font> <td><input type="text" name="ans" size=75> </p></tr> <p><tr><td> <td><input type="submit" name="sub1" value="Create my Account." > </p></tr> </table> </form> </body> </html> This is the form to where i shpuld post the data <html> <HEAD BGCOLOR="GREEN"><font color="blue"> <H1><B>LOGIN</h1></font> <TITLE BGCOLOR="BLUE"> LOGIN</TITLE> </HEAD> <body bgcolor="silver" > <form method="post" action= "pc.php"> <h2>Enter Username and Password</h2></font> <table cellpadding="30"> <p><tr><td> <font color="blue"><h2>Username</h2></td></font> /*This is the code I have written for the post of the data*/ <?php $na=$_post['un']; ?> <td><input type="text" name="username" value="<? echo"$_post[na]";?>"> </p></tr> <p><tr><td> <font color="blue"><h2>Password</td></h2></font> <td><input type="password" name="pass"> </p></tr> <p><tr><td></td> <td> <input type="submit" name="sub" value="SUBMIT"></p></tr></td> </table> </form> <br><br><br><br> <left><a href="http:\\localhost\su.php"> <b><h3>Sign Up </h3></b></a> </br></br></br></br> <h5><font color="blue">for assistance contact your system administrator.</h5></font> </body> </html> The next is the database program <?php $conn = odbc_connect("$ap","",""); ?> <html> <head> <title></title> </head> <body> <tablee align= center width=90%> <tr><th>ID</th><th>First_name</th><th>Last_name</th><th>User_name</th><th>Password</th> <th>Password1</th><th>Security_question</th><th>Answer</th></tr> <?php if($conn) { $sql="select*from am"; $row=odbc_exec($conn,$sql); while(odbc_fetch_row($row)) { $ID=odbc_result($row,1); $First_name=odbc_result($row,2); $Last_name=odbc_result($row,3); $User_name=odbc_result($row,4); $Password=odbc_result($row,5); $password1=odbc_result($row,6); $Security_question=odbc_result($row,7); $Answer=odbc_result($row,8);?> <tr><td><?php echo $ID; ?></td><td><?php echo $First_name; ?></td><td><?php echo $Last_name; ?> </td><td><?php echo $User_name; ?></td><td><?php echo $Password; ?></td><td><?php echo $Password1; ?> </td><td><?php echo $Security_question; ?></td><td><?php echo $Answer; ?></td><td> } } </table> </body> </html> I don't know what the problem is????????? PLEASE HELP ME OUT WITH THIS Regards, Srinivas Rao.N Last edited by srinivas; 14th February 2009 at 07:06. Reason: appending |
| Sponsored Links |
|
|
|
|||
|
Thanks but any suggestions for the database problems. I browsed on net for this program for database have posted it below:-
<?php // Two versions of Microsoft Office. Choose one. //$db = 'C:\\Program Files\\Microsoft Office\\Office\\Samples\\Northwind.mdb'; $db = 'F:\\mn.mdb'; $conn = new COM('ADODB.Connection') or exit('Cannot start ADO.'); // Two ways to connect. Choose one. $conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db") or exit('Cannot open with Jet.'); //$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db") or exit('Cannot open with driver.'); $sql = 'SELECT First_name,Last_name,User_name,Password,Password1, Security_question,Answer FROM nm ORDER BY First_name'; $rs = $conn->Execute($sql); ?> <table> <tr> <th>First_name</th> <th>Last_name</th> <th>User_name</th> <th>Passowrd</th> <th>Password1</th> <th>Security_question</th> <th>Answer</th> </tr> <?php while (!$rs->EOF) { ?> <tr> <td><?php echo $rs->Fields['First_name']->Value ?></td> <td><?php echo $rs->Fields['Last_name']->Value ?></td> <td><?php echo $rs->Fields['User_name']->Value ?></td> <td><?php echo $rs->Fields['Password']->Value ?></td> <td><?php echo $rs->Fields['Passowrd1']->Value ?></td> <td><?php echo $rs->Fields['Security_question']->Value ?></td> <td><?php echo $rs->Fields['Answer']->Value ?></td> </tr> <?php $rs->MoveNext() ?> <?php } ?> </table> <?php $rs->Close(); $conn->Close(); $rs = null; $conn = null; ?> please check it as I am recieving a error:- Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `ADODB.Connection': The specified module could not be found. ' in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\access1.php:7 Stack trace: #0 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\access1.php(7): com->com('ADODB.Connectio...') #1 {main} thrown in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\access1.php on line 7 regards, Srinivas |
|
|||
|
this runs fine in d4php
create a new d4php app in the ide. then on the newly created form drop a label component. In the label component create a (php) event beforeshow. In this event paste the code below (u dont't have to use as function just copy and paste what u need). create a msacc (2003) mdb in the same folder as your project. it's runs fine. PHP Code:
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|