i tried this query , is working for me:
insert into `test` values('<b>dog</b>');
or else post your query.
i tried this query , is working for me:
insert into `test` values('<b>dog</b>');
or else post your query.
what exactly you want?
if you want to simply display the clicked button value in another table,
then assign the
function buttonPress(str,x)
{
var table = document.getElementById('test');
var rows=table.getElementsByTagName("tr");
for(var i=0;i<rows.length;i++)
{
ck=rows[i].id;
if(x==ck)
//alert("Row clcincked:"+ck);
// assign it ck to table
}
}
search for google for assigning into table.
or else post your code here, we will assist you.
servlet is a Java class implementing the javax.servlet.Servlet interface that runs within a Web or application server's servlet engine, servicing client requests forwarded to it through the server.
A Java Server Page is a slightly more complicated beast. JSP pages contain a mixture of HTML, Java scripts (not to be confused with JavaScript), JSP elements, and JSP directives.
The elements in a Java Server Page will generally be compiled by the JSP engine into a servlet, but the JSP specification only requires that the JSP page execution entity follow the Servlet Protocol.
the code sir is now working can you tell me why?? and thanks for the reply in my thread
i just make an id for each row, gave name for the table,
then java script we can get all rows and ids from tha table name.
that's it.
Please mark this thread solved.
Thank you so much mwasif.
but i have one doubt,
can replication be done between remote database server and local database server???
try to give like this:
out.println("<input type=\"radio\" name=\"n1\" value=\""+rs.getString(3)+"\"/>");
<!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>Untitled Document</title>
<script type="text/javascript">
function buttonPress(str)
{
var str;
alert(str);
}
</script>
</head>
<?php session_start();
error_reporting(E_ALL ^ E_NOTICE);
include "dbconfig.php";
$id=$_SESSION["valid_user"];
?>
<body>
<form name="Item Search" method="post" action="search.php">
Item Search:<br>
<label>
<input name="swords" type="text" size="30" maxlength="30">
</label>
<br>
<label>
<input name="search" type="submit" id="search" value="Search">
</label>
<a href="logout.php">Logout</a>
</form>
<?php
if (!$_POST['search']){
//determining the number of lenght of words
}else{
$searchwords = addslashes(htmlspecialchars($_POST['swords']));
if (strlen($searchwords) < 2){
echo "Your search must contain at least 3 characters. Please try again.<br><input type=button value='Back' onClick='history.go(-1)'>";
}else{
$words = explode(' ',$searchwords);
$totalwords = count($words);
$i = 0;
$searchstring = "";
while ($i != $totalwords){
if ($i != 0 and $i != $wordcount){
$searchstring .= " and ";;
}
$searchstring .= "b_name LIKE '%$words[$i]%'";
$searchstring1 .= "b_author LIKE '%$words[$i]%'";
$i = $i + 1;
}
$starrow=10;
//getting query
$query = mysql_query("SELECT DISTINCT * FROM book where $searchstring or $searchstring1 LIMIT $starrow");
if (mysql_num_rows($query) == 0){
echo "No results were found.<br><input type=button value='Back' onClick='history.go(-1)'>";
}else{
echo("<FORM METHOD=post id=form3>");
echo("<H4 ALIGN=left>Books found matching search criteria :</H4><BR>");
echo("</TABLE>");
//code in displaying the table
echo("<TABLE width='70%' border='2' cellpadding='3' ALIGN=CENTER name='test'>");
echo("<TR bgcolor='B0C4DE'>");
echo("<TH>Sr.No</TH>");
echo("<TH>Title Of Book</TH>");
echo("<TH>Author Name</TH>");
echo("<TH>Number of Copies</TH>");
echo("<TH>Borrow</TH>");
echo("</TR>");
//searching using title of book
$count=0;$i=1;
while ($row = mysql_fetch_assoc($query)){
echo("<TR id='$i' bgcolor='B0C4DE'>");
$sr_num=$row['b_sr_num'];
echo ("<td><input name=data id=data type=text id=data readonly=readonly value=$sr_num></td>");
echo ('<td>'.$row['b_name'].'</td>');
echo ('<td>'.$row['b_author'].'</td>');
echo ('<td>'.$row['b_avail'].'</td>');
if($row['b_avail']>0)
{
if (!$_SESSION["valid_user"])
{
// User not logged …
check this code:
echo "<table border=5 cellpadding=2 cellspacing=1>";
// now you can display the results returned
while ($row= mysql_fetch_array($result)) {
$title = $row["$field"];
$title1 = $row["mname"];
$title2 = $row["address"];
$title3 = $row["area_off"];
$title4 = $row["link_ao"];
$title5 = $row["appl_No"];
$title6 = $row["int_rate"];
$title7 = $row["curr_os"];
$title8 = $row["fup"];
$title9 = $row["area_name"];
echo "<tr><td>";
echo "LOAN NO </td><td> $title <br>" ;
echo "</tr></td>";
echo "<tr><td>";
echo "NAME </td><td> $title1 <br>" ;
echo "</tr></td>";
echo "<tr><td>";
echo "ADDRESS </td><td> $title2 <br>" ;
echo "</tr></td>";
echo "<tr><td>";
echo "AREA OFFICE CODE </td><td> $title3 <br>" ;
echo "</tr></td>";
echo "<tr><td>";
echo "LINK AO </td><td> $title4 <br>" ;
echo "</tr></td>";
echo "<tr><td>";
echo "APPLICATION NO. </td><td> $title5 <br>" ;
echo "</tr></td>";
echo "<tr><td>";
echo "INTREST RATE </td><td> $title6 <br>" ;
echo "</tr></td>";
echo "<tr><td>";
echo "CURRENT OS </td><td> $title7 <br>" ;
echo "</tr></td>";
echo "<tr><td>";
echo "FUP </td><td> $title8 <br>" ;
echo "</tr></td>";
echo "<tr><td>";
echo "AREA OFFICE NAME </td><td> $title9 <br>" ;
$count++ ;
}
echo "</table>";
i checked your code it is perfectly running..
Please post your error and code line numbers.
if you use else if conditional statement, then your control goes for one valid condition.
If you want to go for every condition to be checked , then simply use if condition for every input.
and also check it:
if (cofaCOURRIEL == null || cofaCOURRIEL == "") {
alert('Le champ COURRIEL doit être rempli.');
document.forms["COFA_AIG"] ["COURRIEL"].focus();
return false;
}
else {
if ( (atPOS < 1) || (dotPOS < atPOS + 2) || ((dotpos + 2) >= cofaCOURRIEL.length) ) {
alert('Adresse de courriel invalide.');
document.forms["COFA_AIG"] ["COURRIEL"].focus();
return false;
}
}
if (cofaDATE == null || cofaDATE == "") {
alert('Le champ DATE doit être rempli.');
document.forms["COFA_AIG"] ["DATE"].focus();
return false;
}
then:
<script type="text/javascript">
document.write("<SELECT NAME=\"choice\" >")
for (var counter=0; counter<10;counter++)
{
if(counter==6)
{
document.write("<OPTION VALUE=\""+counter+"\" selected>"+counter+"</OPTION >");
}
else
{ document.write("<OPTION VALUE=\""+counter+"\">"+counter+"</OPTION >");
}
}
document.write("</SELECT>");
</script>
yes, search with session keyword in php.ini file.
you can find this line:
; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0
thanks smantscheff,mwasif and SEOcoder for all your suggestions.
I will check all these suggestions.
thanks again.
if you want to create voting poll script in html,
then use form tag, radio button, submit button etc..
for example code, check the below:
<form method="post" action="http://poll.pollcode.com/GzRN"><table border=0 width=150 bgcolor="EEEEEE" cellspacing=0 cellpadding=2><tr><td colspan=2><font face="Verdana" size=-1 color="000000"><b>test test?</b></font></td></tr><tr><td width=5><input type=radio name=answer value="1"></td><td><font face="Verdana" size=-1 color="000000">1</font></td></tr><tr><td width=5><input type=radio name=answer value="2"></td><td><font face="Verdana" size=-1 color="000000">2</font></td></tr><tr><td width=5><input type=radio name=answer value="3"></td><td><font face="Verdana" size=-1 color="000000">3</font></td></tr><tr><td width=5><input type=radio name=answer value="4"></td><td><font face="Verdana" size=-1 color="000000">4</font></td></tr><tr><td colspan=2><center><input type=submit value="Vote"> <input type=submit name=view value="View"></center></td></tr><tr><td bgcolor="white" colspan=2 align=right><font face="Verdana" size=-2 color="black">pollcode.com <a href=http://pollcode.com/><font color="navy">free polls</font></a></font></td></tr></table></form>
or if you want the polls to be inserted in database then, go for some server side scripting languages(PHP),database(Mysql).
search google for free secripts.
or
http://www.devarticles.com/c/a/MySQL/Creating-a-Voting-Poll-With-PHP-And-MySQL-Part-1/
one mistake what i found :
int counter = 0;
bool $success =
you have initialized these two variables two times.
this:
<script type="text/javascript">
document.write("<SELECT NAME=\"choice\" >"+
"<OPTION VALUE=\"1\">one </OPTION >"+
"<OPTION VALUE=\"2\">two </OPTION >"+
"<OPTION SELECTED VALUE=\"5\"> 5 </OPTION>"+
"</SELECT>");
</script>
ok then sorry
After processing the POST page(db insertions), redirect the user to the same page.
if you want check for duplicate record in your db table, then try this like:
$q=mysql_query("select id from login where username=".$user_name);
$count=mysql_num_rows($q);
if($count==0)
{
// your insert code
}
else
{
echo "already exists in database.";
}
or unset the posted data like:
if (isset($_POST["Submit"]))
{
// do your db insertions
unset($_POST); // clear everything
}
and also check some links:
http://www.satya-weblog.com/2009/10/avoid-resubmitting-html-form.html
use this code to validate extension:
echo pathinfo($dirArray[$index], PATHINFO_EXTENSION);
another problem is that if quotation marks exist in the comment, the comment doesn't get stored in the database.
for this use addslashes($str);
i tried with one example.
check this:
session.php
<?php
session_start();
if(!isset($_SESSION['id']))
$_SESSION['id']=90;
?>
test2.php
<?php
session_start();
require_once('session.php');
$id = $_SESSION['id']; // $_SESSION['id'] is empty.
//=========== GET variables from remote server=================
if (isset($_GET['var1']))
$var1 = trim($_GET['var1']);
if (isset($_GET['var2']))
$var2 = trim($_GET['var2']);
if (isset($_GET['var3']))
$var3 = trim($_GET['var3']);
header('Location: test1.php?id='.$id);
?>
test1.php
<?php
echo $_GET['id'];
browse test2.php in your browser.
thanks.
in which page the session is initialized(passing a value).
connecting two databases..
Persistence, there is no other way to success.
if your session initialization is not in get_http_vars.php, then your can get then session in any page.
First of all check the session is set or not.
<tr><td>requested ship date</td><td><input type="text" id="r_s_d" value="<? echo $d; ?>" onchange="<? data_copy() ?>" /></td></tr>
You cannot call a php function on onchange of a form element.
change 28 line to:
<tr><td>requested ship date</td><td><input type="text" id="r_s_d" value="<? echo $d; ?>" onchange="data_copy()" /></td></tr>
and make data_copy() as javascript function..
try this:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
function combofunction(x)
{
var divEls = document.getElementsByTagName("div");
var i = 0;
for(i=0;i<divEls.length;i++)
{
divID=divEls[i].id;
//alert(divID);
//alert(x);
if(divID == x)
document.getElementById(divID).style.visibility = "visible";
else
document.getElementById(divID).style.visibility = "hidden";
}
}
</script>
</head>
<body>
<select name="htmlcombo" id="htmlcombo" onChange="combofunction(this.value);">
<option value="0">Select</option>
<option value="1">Display Text1</option>
<option value="2">Display Text2</option>
<option value="3">Display Text3</option>
</select>
<div id="1" style="visibility:hidden" >hello1</div>
<div id="2" style="visibility:hidden">hello2</div>
<div id="3" style="visibility:hidden">hello3</div>
<div id="4" style="visibility:hidden">hello4</div>
</body>
</html>
Thanks SEOCoder..
Your application would have to update the table, so in the same way you would update your local database every time an INSERT is perform you can do the same every time an UPDATE is performed.
can u give any example for this?
or
$dateFrom ='18-08-1985';
$date = new DateTime($dateFrom);
echo $date->format('Y-m-d H:i:s');
Your code is working fine for me:
or else try with this:
echo $_POST['myVal'];
or
try this:
<form name="myForm" method="Post" action="test12.php">
<INPUT TYPE="hidden" name="myVal" id="myValue" value="0" />
<INPUT TYPE="submit">
</form>
if you click submit without passvalue button , then it displays 0.
if you click submit after clicking passvalue button , then it displays 1.
thanks all for your replies.
But how to update my local database table if any existing rows got updated in server database.
SELECT * FROM SUM(Price) FROM table_name;
thanks for your reply.
But one database is sitting in my local system.
check out some good site regarding this:
http://swik.net/MySQL/MySQL+vs+MS+SQL+Server
http://www.tometasoftware.com/MySQL-5-vs-Microsoft-SQL-Server-2005.asp
http://searchsqlserver.techtarget.com/tip/SQL-Server-vs-MySQL
http://www.postgresonline.com/journal/archives/51-Cross-Compare-of-SQL-Server,-MySQL,-and-PostgreSQL.html
http://www.differencebetween.com/difference-between-mysql-and-ms-sql-server/
i have modified your code . try this:
<div id="errormsg"></div>
<form action="delete.php" method="post" onSubmit="return checkDel()" >
<table width="200" border="0" cellpadding="2" cellspacing="0" class="adforms">
<tr>
<th width="40">Name: </th>
<td width="152" align="left"><input type = "text" name = "dname" size="15" id="delnain" onclick="hideid()"/></td>
</tr>
<tr>
<th>ID: </th>
<td align="left"><input type = "text" name = "did" size="2" id="delidin" onclick="hidena()"/></td>
</tr>
<tr>
<td></td>
<td align="right"><input type="submit" value="Delete item"/></td>
</tr>
</table>
</form>
<script language="javascript">
function hidena()
{
document.getElementById('delnain').style.visibility = "hidden";
}
function hideid(){
document.getElementById('delidin').style.visibility = "hidden";
document.getElementById('delidin').value = 0;
}
</script>
<script language="javascript">
function checkDel(){
var dname = document.getElementById('delnain');
var did = document.getElementById('delidin');
var div = document.getElementById('errormsg');
var lets = /^[a-zA-Z\s]+$/;
var nums = /^[0-9]+$/;
alert(dname.style.visibility);
alert(did.style.visibility);
if(dname.style.visibility=='' && did.style.visibility=='')
{
div.innerHTML= "<b>Please fill ID or Name</b>";
return false;
}
else
{
if(dname.style.visibility == "hidden"){
if(did.value == ''){
div.innerHTML= "<b>Please fill in the an ID</b>";
did.focus();
return false;}
else{ if(did.value.match(nums)){
return true;}
else{
div.innerHTML= "<b>Only numbers please</b>";
did.focus();
return false;}}}
else{
if((dname.value == '') || (dname.value == ' ')){
div.innerHTML= "<b>Please fill in the item name</b>";
dname.focus();
return false;}
else{ if(dname.value.match(lets)){
return true;}
else{
div.innerHTML= "<b>Only letters please</b>";
dname.focus();
return false;}}
}
}
}
</script>
Hello All,
My problem is, i have one database and application in web server, another application in local server which is having another database . But some tables are same in database server and in my local database.
I want to update these particular tables from data base server into my local database for only insert or updated rows.
Please suggest me to do this.
iam asking you to print this query on browser then post this query here:
echo $sql="INSERT INTO `transaction` (ProfileID, ProgramID, ProgramName, ModuleID, ModuleName, EnrollmentID, ProgramFee, OJTFee, WorkshopFee, NCAssessment, OtherFees, TotalAmount, Date, From, To)
Values ('$assessprofileid','$assessprogramid', '$assessprogram',$assessmoduleid, '$assessmodule', $assessenrollmentid, $programfee, $ojtfee, $workshopfee, $ncfee, $otherfees, $total, curdate(), '$formatted_from', '$formatted_to')";
Surprise -> Gift
and also about regular expression, image uploads,creating thumbnails,php encrytion functions,php crons,PHP filters etc..
. What is the use of sprintf() function?
. What is difference between mysql_connect and mysql_pconnect?
. Notify URL and Return URL
try this:
$sqlquery = "SELECT email FROM userdetails WHERE email='".$_POST['email']."'";
$IP = $_SERVER['REMOTE_ADDR'];
$date_time = date("l j F Y g:ia", time() - date("Z")) ;
echo "$date_time IP: $IP";
what is data type of your columns(From, To) in your data base table.
If you feel you are down on your luck, check your level of effort.
- Robert Brault.
-> remove if your top.php contains session_start(); statement.
-> Check that there are not any spaces at the end of those included files.
-> try placing this at the top of your page: <? ob_start(); ?>
-> remove white space before or after the opening and closing PHP tags (<?php . . . ?>).
echo $sql="INSERT INTO `transaction` (ProfileID, ProgramID, ProgramName, ModuleID, ModuleName, EnrollmentID, ProgramFee, OJTFee, WorkshopFee, NCAssessment, OtherFees, TotalAmount, Date, From, To)
Values ('$assessprofileid','$assessprogramid', '$assessprogram',$assessmoduleid, '$assessmodule', $assessenrollmentid, $programfee, $ojtfee, $workshopfee, $ncfee, $otherfees, $total, curdate(), '$formatted_from', '$formatted_to')";
post echoed query.
and post your table structure.
ya, it works for me.
or your keep this keywork in google books '<c:url value> in form tag jsp means'.
and click this link 'Head first servlets and JSP - Page 466'
it may second link.
thanks.
means??