Delphi For PHP Forums       


Go Back   Delphi-PHP Forums > Programming > PHP - Code
Forum Jump Register FAQ Members List Downloads Search Today's Posts Mark Forums Read

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.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 14th February 2009, 07:02
D4PHP User
 
Join Date: Feb 2009
Posts: 33
srinivas is on a distinguished road
Unhappy database problems

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 14th February 2009, 16:23
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,268
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

Quote:
<p><tr><td>
<font color="blue"><h2>Desired User Name:</h2></td></font>
<td><input type="text" name="un">
</p></tr>
You aren't matching up your tags correctly
<p> = paragraph, and has to be outside everything else
I'm not sure you can even use it inside a table the way you are

<table>
<tr> = table row
<td> = table cell
text
</td> = stop cell
<td>
2nd text
</td>
</tr> end row
<tr>
<td>
</td>
<td>
</td>
</tr>
....
</table> = end table
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 15th February 2009, 00:54
D4PHP User
 
Join Date: Feb 2009
Posts: 33
srinivas is on a distinguished road
Default Thanks

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 15th February 2009, 01:16
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,268
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

I really know nothing about mssql.

Are you using a d4php form? If so try the database connection in the ide.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 15th February 2009, 01:54
D4PHP User
 
Join Date: Feb 2009
Posts: 33
srinivas is on a distinguished road
Default

Ok no problem thanks for your reply. The above problem is not mssql it is ms access do you know anything about that?

I am not able to create a dashboard in php can you help me with an example???
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 15th February 2009, 11:13
D4PHP User
 
Join Date: Nov 2008
Posts: 18
chiefclaudio is on a distinguished road
Default adodb and msacces

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:
function display_from_msactbl()
{
          
$db_conn = new COM("ADODB.Connection");
          
$connstr "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source =" realpath("Projects.mdb") ."";
          
//"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". "Projects.mdb".";";
          
$db_conn->open($connstr);
          
$rS $db_conn->execute("SELECT * FROM countrycodes");
          
$f1 =  $rS->Fields(0);
          
$f2 =  $rS->Fields(1);
          while (!
$rS->EOF)
          {
              echo 
"(" $f1->value.") ".$f2->value."<br />\n";
              
$rS->MoveNext();
          }
          
$rS->Close();
          
$db_conn->Close();
       } 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 16th February 2009, 02:33
D4PHP User
 
Join Date: Feb 2009
Posts: 33
srinivas is on a distinguished road
Default

Thankyou for your reply will check and will inform you later.

Thankyou very much it really worked.

Last edited by srinivas; 16th February 2009 at 15:02.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 10:37.




Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 ©2009, Crawlability, Inc.
Copyright © 2004 - 2009, G&J Solutions Ltd. All Rights Reserved. terms of use