I am trying to learn php, mysql and html with css around and trying to build a web site for seeing my skills
had the Iframe problem but as the solution is not there do i have moved on and choose to let the login page to open in new windows and admin can work there.
so now the next problem i am facing is the edit or update mysql table data with an php webpage.
here are the codes :
<code>
<?php
$hostname = "localhost";//host name
$dbname = "a_test";//database name
$username = "root";//username you use to login to php my admin
$password = "";//password you use to login
//CONNECTION OBJECT
//This Keeps the Connection to the Databade
$conn = new MySQLi($hostname, $username, $password, $dbname) or die('Can not connect to database')
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Update</title>
<style type="text/css">
body {
background-color: #000;
}
body,td,th {
color: #FFF;
}
</style>
</head>
<body>
<?php
if(isset($_POST['Submit'])){//if the submit button is clicked
$page_no = $_POST['page_no'];
$data = $_POST['data'];
$update = "UPDATE cms_content SET data='$data' WHERE cms_content page_no = '$page_no'";
$conn->query($update) or die("Cannot update");//update or error
}
?>
<?php
//Create a query
$sql = "SELECT * FROM cms_contet WHERE page_no = '' ";
//submit the query and capture the result
$result = $conn->query($sql) or die(mysql_error());
$query=getenv(QUERY_STRING);
parse_str($query);
?>
<h2>Update Record </h2>
<form action="" method="post">
<?php
while ($row = $result->fetch_assoc()) {?>
<table border="0" cellspacing="10">
<tr>
<td>Page NO:</td> <td> <input type="text" name="page_no" value=""></td>
</tr>
<tr>
<td>Data:</td> <td><textarea name="data" rows="50" cols="50"><?php echo $row['data']; ?></textarea></td>
</tr>
<?php }
?>
<tr>
<td><INPUT TYPE="Submit" VALUE="Update the Record" NAME="Submit"></td>
</tr>
</table>
</form>
<?php
if($update){//if the update worked
echo "Update successful!";
}
?>
</body>
</html>
</code>
I did got it working where it was able to update the table contant of data column, but as i wanted to add select page option and did some change, it all screwed up
not i can see anything not even the table or text.
please help me out
thank you for reading the thread.
have a nice day / night ahead.

had the Iframe problem but as the solution is not there do i have moved on and choose to let the login page to open in new windows and admin can work there.
so now the next problem i am facing is the edit or update mysql table data with an php webpage.
here are the codes :
<code>
<?php
$hostname = "localhost";//host name
$dbname = "a_test";//database name
$username = "root";//username you use to login to php my admin
$password = "";//password you use to login
//CONNECTION OBJECT
//This Keeps the Connection to the Databade
$conn = new MySQLi($hostname, $username, $password, $dbname) or die('Can not connect to database')
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Update</title>
<style type="text/css">
body {
background-color: #000;
}
body,td,th {
color: #FFF;
}
</style>
</head>
<body>
<?php
if(isset($_POST['Submit'])){//if the submit button is clicked
$page_no = $_POST['page_no'];
$data = $_POST['data'];
$update = "UPDATE cms_content SET data='$data' WHERE cms_content page_no = '$page_no'";
$conn->query($update) or die("Cannot update");//update or error
}
?>
<?php
//Create a query
$sql = "SELECT * FROM cms_contet WHERE page_no = '' ";
//submit the query and capture the result
$result = $conn->query($sql) or die(mysql_error());
$query=getenv(QUERY_STRING);
parse_str($query);
?>
<h2>Update Record </h2>
<form action="" method="post">
<?php
while ($row = $result->fetch_assoc()) {?>
<table border="0" cellspacing="10">
<tr>
<td>Page NO:</td> <td> <input type="text" name="page_no" value=""></td>
</tr>
<tr>
<td>Data:</td> <td><textarea name="data" rows="50" cols="50"><?php echo $row['data']; ?></textarea></td>
</tr>
<?php }
?>
<tr>
<td><INPUT TYPE="Submit" VALUE="Update the Record" NAME="Submit"></td>
</tr>
</table>
</form>
<?php
if($update){//if the update worked
echo "Update successful!";
}
?>
</body>
</html>
</code>
I did got it working where it was able to update the table contant of data column, but as i wanted to add select page option and did some change, it all screwed up

not i can see anything not even the table or text.
please help me out

thank you for reading the thread.
have a nice day / night ahead.