post your existing logic and error here.
Shanti C 106 Posting Virtuoso
post your existing logic and error here.
one small error i have found is:
you missed the '=' in form tag.
<form method="post" action="http://localhost/movie1.php">
Rest of the code working fine for me.
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.
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>
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);
or
$dateFrom ='18-08-1985';
$date = new DateTime($dateFrom);
echo $date->format('Y-m-d H:i:s');
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>
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')";
$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.
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.
you just initialize session. no need to return it. As it is a global parameter, if once we set it, we can get the value in any page.
replace your line: 4 like this:
$_SESSION['PolicyNumberAdd'] = $PolicyNumber;
Then your code works.
Goodluck.
then post your code...
Don't put the above code in between php tags.
<table border=1>
<tr>
<td>LOAN NO</td>
<td><?php=$title?></td>
</tr>
<tr>
<td>NAME</td>
<td><?php=$title1?></td>
</tr>
<tr>
<td>ADDRESS</td>
<td><?php=$title2?></td>
</tr>
.
.
.
.etc
</table>
You just write all your textbox properties in css file like:
.class1{
font-weight:normal;
}
.class2{
font-weight:bold;
}
You can change your textbox in php like:
if(something)
{
$style="class1";
}
else
{
$style="class2";
}
then use this class for your text box like:
<input type="textbox" name="test" class="<?=$style;?>" />
if you want recently inserted id then,
you can try this:
$id=mysql_insert_id();
check this:http://php.net/manual/en/function.mysql-insert-id.php
Where you have chkKeyExists am i rite in thinking that would be another function that would check query db and see if the key exists in db? just want to check on that. If so i will get onto it now.
Yes, chkKeyExists is function where we check that key already exists in data base or not.
function getKey()
{
$key=generateKey();
if(!chkKeyExists($key))
{
return $key;
}
else
{
getKey();
}
}
ya, its is MySQL server IP.
or ask your hosting people , they will give you all these details.
give your live database settings (where your database is located):
host,db username,db password,dbname.
give these correct details in the page where you have written connecting data base code.
Did you change data base settings ?
What did you used for php tags: whether it is <? ?>
or <?php ?>
.
For this <? ?>
, we need to enable short tags in your server.
Is your website is having index.php or not?
Where did you uploaded your code (any sub folder)?
check for these basic validations.
correct this line to (==) if ($username == 'letmein') {
= means assignment operator.
== means comparision operator.
Two points have to be noted here:
1. if you use else if conditional loop then it will go for only on condition for your input,then other matched inputs will not return strings.
2.decide your input manner, whether it is in comma separated or space separated or some thing else. Based on this explode an array called $programs
using php explode
function.
and also:
-> Use in_array()
instead of array_search for searching string in an array.
-> remove while loop, no use here.
based on the above things i have changed your code accordingly.try with the following:
<?php
function check_programs($input)
{
$programs = explode(" ", $input);
$return_string = '';
if(in_array('ma', $programs) == true){
$return_string .= "Maya, ";
}if(in_array('ps', $programs) == true){
$return_string .= "Photoshop, ";
}if(in_array('ai', $programs) == true){
$return_string .= "Illustrator, ";
}if(in_array('xn', $programs) == true){
$return_string .= "xNormal, ";
}
if(in_array('mm', $programs) == true){
$return_string .= "MatchMover, ";
}
return $return_string;
}
echo $string1=check_programs('ps xn');
?>
If your requirement not matches this come up with clear information.
thanks.
If you want to update a row in your table , then come up with that table's primary key.
based on that id you can update your table and refresh that page which contain table data.
Means:
add this line after your hearder in line number 25 : <td bgColor="#008080"><font color="#ffffff"><b>Edit</b></font></td>
and also insert this line after line number 52: <td bgColor="#ffff98" vAlign="top"><a href="editpage.jsp?edit_id=%=rst.getString("id")%>">Edit</a></td>
then in editpage.jsp:
this page contains text boxes to enter new data, if we clicks edit link then it will go for update query some thing like : query="update registration set name=requert.getParameter("name") etc where id=requert.getParameter("id")";
After updating your query then redirect to main table data page.
then you can see edited values..
If your requirement is not this, then come up with clear information.
thanks.
if if($critiria=="epitheto_iatrou")
this is true, then
how would the following become true.. $sql="SELECT * FROM doctors WHERE epitheto='$critiria'";
if $critiria="epitheto_iatrou"
then epitheto==epitheto_iatrou
, this never become true..
change your code into accordingly..
What to do?
When you see a post containing this Russian spam (or any spam for that matter), click the "flag bad post" button next to it and type something creative.
ok, Sure..
try this:
<?php
if(isset($_SESSION['userlevel']) || !empty($_SESSION['userlevel']))
{
if ($_SESSION['userlevel'] == 2)
{
echo "ADMIN";
}
else
{
header('Location:index.php?query=notadmin');
}
}
else
{
echo "session not exists..";
}
?>
yes,
you can do this by using sessions...
try this:
session_start();
if(!isset($_SESSION['words']))
{
session_register();
$_SESSION['words']=array();
}
$iterator=count($_SESSION['words']);
$_SESSION['words'][$iterator][] = wordCheck($lname, "lastname");
$_SESSION['words'][$iterator][] = wordCheck($addr, "address");
.
.
.
.
print_r($_SESSION['words']);
yes,
check your inserted id once..
//
Make sure query inserted user successfully
echo mysql_insert_id();
if ( mysql_insert_id()!=0)
{
die("Error: User not added to database.");
}
else
{
// Redirect to thank you page.
Header("Location: register.php?op=thanks");
pass table name, fields as parameters to function declaration,
and write db query in your function definition which is in class.
try coding ...
what is $result contains?
make active column as integer data type in your data base table structure, then you will be sure getting correct result.
use update query to replace that string.
Assume photos is your table and imageurl is your field..
Take backup of your table before update all these..
try this:
update photos set imageurl = replace(imageurl,'http://domain.com/','')
If you dont' want to update in your database..
then try some php string functions str_ireplace() to replace that string in image path..
What data type you have specified for your points field in your database..
post your table structure and your query...
remove slash after file name which comes from $post–>post_name;
As i understood,
see this code:
<script type="text/javascript">
function change_send(x)
{
//alert(x);
window.href="page2.php?text="+x;
}
</script>
<html>
<p>
<table>
<tr>
<td>
Your full name:</td>
<td>
<input type="text" name="fullname" onChange="change_send(this.value);"></td>
</tr>
</table>
</html>
or come up with clear information.
you have to pass $q to the function fetch() not $data..
mysql_fetch_array() function only takes resource returned by mysql_query() function.
or change your fetch() like this:
function fetch($data)
{
$q = mysql_query($data);
mysql_fetch_array($q);
}
First try to google and start coding.. Then any problem occur come here for suggestions..Not for doing your home work..
try this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
function add_val()
{
ival=document.getElementById('ivalue').value;
test.testselect.options[test.testselect.options.length]=new Option(ival,ival);
document.getElementById('ivalue').value="";
}
//-->
</SCRIPT>
<form action="" method="post" name="test">
<br>
<select name="testselect">
<option>One</option>
</select><br>
<br>
<input type="text" name="ivalue" id="ivalue" value="">
<br>
<br>
<input type="button" name="submit" value="submit" onClick="add_val();">
<br>
</form>
</BODY>
</HTML>
i think you wrote unnecessary code.. check it once..
kkjay,
use these functions will help you:
//function for image uploading
function image_upload($image_name,$img_size,$img_temp,$path)
{
if($img_size>1) //for uploading image
{
$proimg=substr($image_name,0,strpos($image_name,'.'));
$commonname=time();
$name=substr($image_name,0,strpos($image_name,'.'));
$fullname=$name.$commonname.strstr($image_name,'.');
$real_image=$path.$fullname;
if(!move_uploaded_file($img_temp,$real_image))
{
$real_image="";
}
chmod($real_image,0777);
}
return $real_image;
}
function image_resize($i_old,$i_path,$size1,$size2)
{
$image_attribs = getimagesize($i_old);
if(substr($i_old,-3)=='gif') {
$im_old =imagecreatefromgif($i_old);
} else if(substr($i_old,-3)=='png') {
$im_old =imagecreatefrompng($i_old);
} else {
$im_old =imagecreatefromjpeg($i_old);
}
$width=$image_attribs[0];
$height=$image_attribs[1];
//
$th_max_width4= $size1;
$th_max_height4=$size2;
$ratio4 = ($width > $height) ? $th_max_width4/$image_attribs[0] : $th_max_height4/$image_attribs[1];
$th_width4 = $image_attribs[0] * $ratio4;
$th_height4 = $image_attribs[1] * $ratio4;
$im_new4 = imagecreatetruecolor($th_width4,$th_height4);
imageantialias($im_new4,true);
$th_file_name4= $i_path;
imagecopyresampled($im_new4,$im_old,0,0,0,0,$th_width4,$th_height4, $image_attribs[0], $image_attribs[1]);
if(substr($i_old,-3)=='gif') {
imagegif($im_new4,$th_file_name4,60);
} else if(substr($i_old,-3)=='bmp') {
imagewbmp($im_new4,$th_file_name4,60);
} else if(substr($i_old,-3)=='png') {
imagepng($im_new4,$th_file_name4,60);
} else {
imagejpeg($im_new4,$th_file_name4,60);
}
return $th_file_name4;
//
}
just call these two functions in your for loop by passing required parameters.
call same image_resize() function for large and small images with different size parameters..
i have tested this code. working fine for me.
thanks.
try this:
<?php
$username = $_POST['username'];
$password = $_POST['password'];
if (isset($username,$password))
{
$connect = mysql_connect ("localhost","root","");
mysql_select_db("phplogin");
$query = mysql_query("SELECT * FROM `users` WHERE username ='$username' and password='$password'");
$numrows=mysql_num_rows($query);
if ($numrows==0)
{
die("Incorrect username / password");
}
}
else
{
die("please enter username and password");
}
?>
how do I resize the array of images so that i can store the 6 large and 6 thumbs in a server/folder and their locations in a database. I'm not very experienced in PHP.
I think this is regardless of array..
Try with your existing code. But name your images with different names (concatinate image name with time and large/small) and save the path in database.
All the best.
you can get array of form field like this:
$uimages = $_POST['establishment_image'];
foreach( $uimages as $v )
{
// single image
print $v;
}
try this:
<input type='radio' name='Sex' style='width:16px; border:0;' value='Male' <?php if($row['Sex']='Male') echo 'checked=checked';?>/>Male <input type='radio' name='Sex' <?php if($row['Sex']='Female') echo 'checked=checked';?> style='width:16px; border:0;' 'value='Female' />
please check quotes ..
check your web files folder for .htaccess named file, open it with note pad
and post here that code.. This also raises error.
I think this error is not because of your code,
it is something else about,
try to google on it for fixing up:
Click here 500 Internal Server Error php