Forum Moderators: coopster
But the problem is When i entry a new data into database, it never show a new entry level in the web. Al i can see is the old data level.
Well i made it using Dreamweaver MX built in PHP and MySql..
Some body plz hlp me .. if u dint get me what am saying plz let me know
If so, then write the code for writing new data into mySQL and for getting it.
The question you asked has too many possible mistakes to really know what's happening!
Michal Cibor
Michal Cibor ,
Yes every thing is working fine, i can retrive data and put it in Mysql too but problem is i when i put new information into mysql its not updating in my page. All i can see is the old data in my web.. the new data i entered into mysql is very there.
for eg i got
1
2
3
4
so i added 5,6,7,8,9 into mysql after i insert a new data it shoud update the above one for eg
instead of 1,2,3,4 it should display
5,
6,
7,
8
any how did u got me .
I presume that you have a button <input type="submit" name="action" id="action" value="Change"/>
And then in PHP you write
<?PHP
if($_POST["action"] == "Change") my_insertData(); //refresh data in mySQL
my_retrieveData();// get data from mySQL and print them onto html
?>
And after one reload there is desired data (5,6,7,8) in mySQL? However not on the website?
Write the code. Otherwise it will still be too difficult to see what's wrong. Don't place your url, because it will be edited.
Michal Cibor
Below is my source code + database table. Its a simeple news that am trying to make some what like Yahoo "in the news" well plz have a look and u will understand more than i try to make u understand. Plz let me know what else u have added and how would u update this News table daily.
****************************************************
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_conn = "localhost";
$database_conn = "tol";
$username_conn = "root";
$password_conn = "";
$conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR);
?>
<?php require_once('file:///C¦/web/tol.com/Connections/conn.php');?>
<?php
$maxRows_Recordset1 = 5;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_conn, $conn);
$query_Recordset1 = "SELECT sb_img, title_link FROM news";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $conn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<table width="280" border="1" cellspacing="0">
<?php do {?>
<tr>
<td width="62"><?php echo $row_Recordset1['sb_img'];?></td>
<td width="208"><?php echo $row_Recordset1['title_link'];?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));?>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
***************************************************
#
# Table structure for table `news`
#
CREATE TABLE `news` (
`id` int(10) unsigned NOT NULL auto_increment,
`extr_frm` varchar(100) NOT NULL default '',
`sb_img` varchar(100) NOT NULL default '',
`title_link` varchar(100) NOT NULL default '',
`cont` longtext NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=28 ;
[edited by: jatar_k at 5:32 pm (utc) on Jan. 11, 2005]
[edit reason] removed table dump [/edit]
mysql_select_db($database_conn, $conn);
$query_Recordset1 = "SELECT sb_img, title_link FROM news ORDER BY id DESC";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
Best regards
Michal Cibor
PS. I understand, that in mySQL there is desired data.