cybernetic
Programmer
Im trying to write a fnction which automatically completes the address details in a web form, by reloading the page with the values in it. can anyone help me?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<?
$db_host
=
'localhost'
;
$db_user
=
'me'
;
$db_pass
=
'password'
;
MYSQL_CONNECT
(
$db_host
,
$db_user
,
$db_pass
);
MYSQL_SELECT_DB
(
'MyDB'
);
$results
=
MYSQL_QUERY
(
'SELECT id FROM MyTable'
);
while
(
$row
=
MYSQL_FETCH_ARRAY
(
$results
))
{
echo
'<HR>'
.
$row[0]
.
'<BR>'
;
}
MYSQL_CLOSE
();
?>
/*
* Statements.java
*
* Created on September 11, 2001, 7:41 AM
*/
package testsuite;
import java.sql.*;
/**
*
* @author Administrator
*/
public class Statements {
static String DBUrl = "jdbc:mysql:///test";
/** Creates new Statements */
private Statements()
{
}
public static void main(String[] args) throws Exception
{
Connection conn = null;
Statement stmt = null;
PreparedStatement pStmt = null;
try
{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
conn = DriverManager.getConnection(DBUrl);
stmt = conn.createStatement();
try {
stmt.executeUpdate("DROP TABLE statement_test");
}
catch (SQLException sqlEx) { /* ignore */}
stmt.executeUpdate("CREATE TABLE statement_test (id int not null primary key, strdata1 varchar(255), strdata2 varchar(255))");
for (int i = 0; i < 10; i++)
{
stmt.executeUpdate("INSERT INTO statement_test (id, strdata1,strdata2) values (" + i + ", 'abcdefg', 'poi')");
}
pStmt = conn.prepareStatement("UPDATE statement_test SET strdata1=?, strdata2=? where id=?");
pStmt.setString(1, "iop");
pStmt.setString(2, "higjklmn");
pStmt.setInt(3, 1);
pStmt.executeUpdate();
PreparedStatement pStmtBad = conn.prepareStatement("SELECT * from statement_test");
pStmtBad.executeQuery().close();
pStmtBad.close();
PreparedStatement pStmtBatch =
conn.prepareStatement("INSERT INTO "
+ "statement_test (id, strdata1, strdata2) VALUES (?,?,?)");
for (int i = 0; i < 10; i++) {
pStmtBatch.setInt(1, 100 + i);
pStmtBatch.setString(2, "batch_" + i);
pStmtBatch.setString(3, "batch_" + i);
pStmtBatch.addBatch();
}
int [] updateCounts = pStmtBatch.executeBatch();
System.out.println("Batch update counts: ");
for (int i = 0; i < updateCounts.length; i++) {
System.out.println(" " + updateCounts[i]);
}
ResultSet rs = stmt.executeQuery("SELECT * from statement_test");
while (rs.next())
{
System.out.println("isAfterLast() = " + rs.isAfterLast());
}
System.out.println("isAfterLast() ends at " + rs.isAfterLast());
}
finally
{
if (pStmt != null)
{
try
{
pStmt.close();
}
catch (SQLException sqlEx) { /* ignore */ }
}
if (stmt != null)
{
try
{
stmt.close();
}
catch (SQLException sqlEx) { /* ignore */ }
}
if (conn != null)
{
try
{
conn.close();
}
catch (SQLException sqlEx) { /* ignore */ }
}
}
}
}