Have you echo what i sent you in previous post
<?php
//editimage.php
echo "<pre>";
print_r($_GET);
echo "</pre>";
.
.
.
other code
?>
Have you echo what i sent you in previous post
<?php
//editimage.php
echo "<pre>";
print_r($_GET);
echo "</pre>";
.
.
.
other code
?>
you need to echo $image_id in link, otherwise you will not receive actually image id value.
<a href=\"editimage.php?img=<?php echo $image_id ?>\">Edit</a>
To check how value passed in your editimage.php, you can dump variables in the beginging
<?php
//editimage.php
echo "<pre>";
print_r($_GET);
echo "</pre>";
.
.
.
other code
?>
I have written line, 72 to 92 again , you should not if else structure.
<?php
if ($_REQUEST["city"]<>"") {
$sqla = " AND (city LIKE '%".mysql_real_escape_string($_REQUEST["city"])."%')";
}
if ($_REQUEST["state"]<>"") {
$sqlb = " AND state='".mysql_real_escape_string($_REQUEST['state'])."'";
}
if ($_REQUEST["county"]<>"") {
$sqlc = " AND (county LIKE '%".mysql_real_escape_string($_REQUEST["county"])."%')";
}
if ($_REQUEST["status"]<>"") {
$sqld = " AND (status LIKE '%".mysql_real_escape_string($_REQUEST["status"])."%')";
}
if ($_REQUEST["pid"]<>"") {
$sqle = " AND (asset_number LIKE '%".mysql_real_escape_string($_REQUEST["pid"])."%')";
}
if ($_REQUEST["bank_officer"]<>"") {
$sqlf = " AND bank_officer='".mysql_real_escape_string($_REQUEST["bank_officer"])."'";
}
$sql = "SELECT * FROM property WHERE id>0".$sqla.$sqlb.$sqlc.$sqld.$sqle.$sqlf;
?>
<?php
function printvalue($val)
{
if($val>1)
printvalue($val-1);
echo $val."<br>";
return;
}
printvalue(100);
?>
You may try this code
<?php
$userprofile= $_SESSION['name'];
$sql = mysql_query("SELECT a.Playername, a.Rating,b.avg_rating FROM userrating a left outer join (select Playername,avg(Rating) avg_rating from userrating group by Playername) b on a.Playername=b.Playername WHERE a.Ratedby = '$userprofile'");
echo "<table>
<tr>
<th> Name </th>
<th> My Rating </th>
<th> Average Rating </th>
</tr>";
while ($row = mysql_fetch_array($sql)){
echo "<td align=center>" . $row['Playername'] . "</td>";
echo "<td align=center>" . $row['Rating'] . "</td>";
echo "<td align=center>" . $row['avg_rating'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
REPROGRAM EVERYTHING AND USE DATABASE TABLE FOR CONDITIONS VALUES
change it to (with only 2 = sign)
if($quantity==0 || trim($quantity)=="")
{
.
.
.
}
I assume that id is auto increment.
I am not sure about performance, but this way you can try updting 1x using only 1 query
insert into 1x (id, domain) select id, domain from 2x where domain not in (select domain from 1x);
Now we assume that all rows from 2x is copied to 1x so we can remove all rows from 2x
delete from table2x;
while ($row = mysql_fetch_array($result))
Is used after select statment to display/process selected reords, but you have inserted record not selecte before while loop. So you need one more select statment before while loop.
I would suggest to keep conditions and slab in mysql table rather than php.
Yes I felt such problem some times back.
Refer this link
http://www.rgagnon.com/jsdetails/js-0129.html
I hope this works.
update [rotadb].[dbo].[Rota],[rotadb].[dbo].[RotaBos], [rotadb].[dbo].[RotaBa],[dentime].[dbo].[den]
set [rotadb].[dbo].[Rota].[ldchangetime] = [dentime].[dbo].[den].[time]
where [rotadb].[dbo].[Rota].[pRotaBos] = [rotadb].[dbo].[RotaBos].[Rotabos_rowid]
and [rotadb].[dbo].[RotaBos].[pRotaBa]=[rotadb].[dbo].[RotaBa].[RotaBa_rowid]
and [rotadb].[dbo].[RotaBa].[skod]= [dentime].[dbo].[den].[skod]
Print_r can only show dump values.
You can try following code to show values on screen in better manner.
<?php
echo "<table>";
echo "<tr>";
echo "<td>ID</td>";
echo "<td>First Name</td>";
echo "<td>Last Name</td>";
echo "</tr>";
for ($i=0;$i<count($mysql->arr2);$i++)
{
echo "<tr>";
echo "<td>{$mysql->arr2[$i]['id']}</td>";
echo "<td>{$mysql->arr2[$i]['first_name']}</td>";
echo "<td>{$mysql->arr2[$i]['last_name']}</td>";
echo "</tr>";
}
echo "</table>";
?>
or still you want to use print_r, then use following code
<?php
for ($i=0;$i<count($mysql->arr2);$i++)
{
echo "<pre>";
print_r($mysql->arr2[$i]);
echo "</pre>";
}
?>
If you are not going to use data after one year, at the end of year, can trunc year old data. to keep on required rows.
I think mysql will handle millions rows without any problem.
$query="SELECT a.id as club_id,
a.fr_name as club_name,
b.id as nation_id,
b.fr_name as nation_name,
c.id as player_id,
c.fr_fname as player_name
FROM fr_clubs as a
INNER JOIN fr_nations as b ON a.id = b.club_id
INNER JOIN fr_players as c ON b.id = c.nation_id
LIMIT ". $paginate->start .",". $paginate->limit
You are almost done, just add column names in the select list you want to access. Your query is alright.
$query="SELECT userprofile.profpic, userprofile.lastname, userprofile.firstname FROM userprofile INNER JOIN accntinfos ON accntinfos.accntnum=userprofile.accntnum";
Start with php tag. Do not keep any space, newline or any Character in the beginning. Here <body> and newline creating problem.
<?php
//start session
session_start();
include("includes/header.php");
//unset any session data until user submits valid username and password
// this is correct way not unset($_SESSION), sorry my mistake
// see http://www.php.net/manual/en/function.session-unset.php
session_unset();
session_destroy();
?>
<body>
<div id="login">
<form action="proseslogin.php" method="post" name="login" target="_self" id="login" style="style.css" title="login"><br />
<label>user : </label>
<input type="text" name="username" id="username" />
<label>password: </label>
<input type="text" name="password" id="password" />
<input type="submit" name="Login" id="Login" value="Login" />
</form>
<div id="searchwrapper"><form action="search.php">
<input type="text" class="searchbox" name="s" value="Search" onFocus="if (this.value=='Search')this.value='';" onBlur="if (this.value=='')this.value='Search'" />
<input type="image" src="Images/submit2.jpg" class="searchbox_submit" value="" />
</form></div>
</div>
remove SRC tag, HREF itself is enough.
<html>
<head> </head>
<body>
<a href ="what_the.html">go </a>
</body>
</html>
YOu should also tell what is the problem in displaying.
Whats happening and whats NOT happening.
Select sum(od.unitprice * od.quantity) as Amount,
ContactName as customername from [Order Details] as od
inner join orders as o on o.orderid = od.orderid
inner join customers as c on o.customerid = c.customerid
group by o.customerid,ContactName
order by amount desc limit 1
SINGLE QUOTE IS INVALID AROUND DATEFIELD, its a column name not a text, so remove single quote surronding 'datefield'
$query="SELECT * FROM table DATE_FORMAT(datefield,'%d-%m-%Y')AS datefield FROM table";
Following query may work as you want.
I have to tell you one thing that you should not use single quote and space in alias column name {'Mã số váºt tư'} it should be as ma_so_vat_tru, without space and quote
SELECT detail.MatId AS 'Mã số váºt tư', custom.CusMatName,
(
SUM(case when header.InvTransTypeId = 'IN1' and header.InvTransAccDate between '2011-01-01' and '2011-04-01'
then Quantity else 0 end) -
SUM(case when header.InvTransTypeId = 'OU1' and header.InvTransAccDate between '2011-01-01' and '2011-04-01'
then Quantity else 0 end)
)
-
(
SUM(case when header.InvTransTypeId = 'IN1' and header.InvTransAccDate between '2011-04-02' and '2011-08-01'
then Quantity else 0 end) +
SUM(case when header.InvTransTypeId = 'OU1' and header.InvTransAccDate between '2011-04-02' and '2011-08-01'
then Quantity else 0 end)
)
AS 'Total'
FROM InventoryTransDetail detail
JOIN InventoryTransHeader header ON detail.InvTransHeaderId = header.InvTransHeaderId
JOIN Material material ON detail.MatId = material.MatId
JOIN CustomsMaterial custom ON material.CustMatId = custom.CustMatId
WHERE Header.InvTransAccDate BETWEEN '2011-01-01' AND '2011-08-01'
GROUP BY detail.MatId, custom.CusMatName
The query is simple so it is not responsible for slow performance.
check your joins, also you can add as many table you want to join for that you need to add new columns in group by as well
GROUP BY detail.MatId, custom.CusMatName
Also do not remove date condition, it will filter result and will give result faster
to convert rows to column you need to do following query
select detail.MatId,
SUM( case when header.InvTransTypeId = 'in1' then Quantity else 0 end) as IN1,
SUM( case when header.InvTransTypeId = 'OU1' then Quantity else 0 end) as OU1,
SUM( case when header.InvTransTypeId = 'TK1' then Quantity else 0 end) as TK1,
SUM( case when header.InvTransTypeId = 'OU1' then Quantity else 0 end)
-SUM( case when header.InvTransTypeId = 'IN1' then Quantity else 0 end) as OU_MINUS_IN,
SUM(QUANTITY) as TOTAL
from InventoryTransDetail detail join InventoryTransHeader header
ON detail.InvTransHeaderId = header.InvTransHeaderId
where Header.InvTransAccDate between '2011-02-01' and '2011-03-01' GROUP BY detail.MatId
This is what you are looking for, But right now its not working in IE, u may try on other browser and then later you can build your logic more using this code.
<html>
<head>
<style type="text/css">
.answerBtnsOff
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: #666666 1px solid;
BORDER-LEFT: #666666 1px solid;
BORDER-RIGHT: #666666 1px solid;
BORDER-TOP: #666666 1px solid;
COLOR: #c;
FONT: 11px Verdana,Arial,Helvetica,sans-serif;
font-weight:bold;
}
.answerBtnsOn
{
BACKGROUND-COLOR: GREEN;
BORDER-BOTTOM: #666666 1px solid;
BORDER-LEFT: #666666 1px solid;
BORDER-RIGHT: #666666 1px solid;
BORDER-TOP: #666666 1px solid;
COLOR: #ffffff;
FONT: 11px Verdana,Arial,Helvetica,sans-serif;
font-weight:bold;
}
</style>
<script lang=javascript>
var currenttotal=0;
function getButtons()
{
document.getElementById("answerA").class="answerBtnsOff";
document.getElementById("answerA").setAttribute("class","answerBtnsOff");
document.getElementById("answerA").setAttribute("className","answerBtnsOff");
document.getElementById("answerB").class="answerBtnsOff";
document.getElementById("answerB").setAttribute("class","answerBtnsOff");
document.getElementById("answerB").setAttribute("className","answerBtnsOff");
document.getElementById("answerC").class="answerBtnsOff";
document.getElementById("answerC").setAttribute("class","answerBtnsOff");
document.getElementById("answerC").setAttribute("className","answerBtnsOff");
document.getElementById("answerD").class="answerBtnsOff";
document.getElementById("answerD").setAttribute("class","answerBtnsOff");
document.getElementById("answerD").setAttribute("className","answerBtnsOff");
document.getElementById("answerE").class="answerBtnsOff";
document.getElementById("answerE").setAttribute("class","answerBtnsOff");
document.getElementById("answerE").setAttribute("className","answerBtnsOff");
currenttotal=0;
}
function btnclick(btn)
{
if(document.getElementById("numberDropId").value=="")
{
alert('Select option');
return false;
}
if (btn.class=="answerBtnsOn")
{
btn.class="answerBtnsOff";
btn.setAttribute("class","answerBtnsOff");
btn.setAttribute("className","answerBtnsOff");
currenttotal--;
return false;
}
if(document.getElementById("numberDropId").value==currenttotal)
{
alert('Not allowed beyond limit, deselect other button');
return false;
}
if (btn.class=="answerBtnsOff")
{
btn.class="answerBtnsOn";
btn.setAttribute("class","answerBtnsOn");
btn.setAttribute("className","answerBtnsOn");
currenttotal++;
return false;
}
}
</script>
</head>
<body>
<p>
<select name="numberDropId" id="numberDropId" onchange="getButtons()" >
<option value=""></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</p>
<p>
<input class="answerBtnsOff" name="answerA" id="answerA" type="button" value="A" onclick='javascript:btnclick(this);' />
<input class="answerBtnsOff" name="answerB" id="answerB" type="button" value="B" onclick='javascript:btnclick(this);' />
<input class="answerBtnsOff" name="answerC" id="answerC" type="button" value="C" onclick='javascript:btnclick(this);' />
<input class="answerBtnsOff" name="answerD" id="answerD" type="button" value="D" onclick='javascript:btnclick(this);' />
<input class="answerBtnsOff" name="answerE" id="answerE" type="button" value="E" onclick='javascript:btnclick(this);' />
</p>
</body>
</html>
1)
You must use {} around varaibles in string when it has quote or array
$images_dir = "images/{$mysql_array['id']}/";
$thumbs_dir = "images/{$mysql_array['id']}/thumbnails/";
2)
also your while loop is with out braces and code.
Specify you want to read data from mysql or you want to read directory.
what you have done so far? post your code, and tell whats NOT happening.
This is full code, you may keep backup of your changepassword.php and create new file with this code
<?php
include './dbfunctions.php';
$link = dbConnect();
session_start();
$stid = $_GET['staffref'];
echo $stid;
$staffs = dbGetRows("staff", "id = '".$stid."'");
$staff = mysql_fetch_array($staffs, MYSQL_ASSOC);
echo $staff['username'];
echo $staff['password'];
if (isset($_POST['Submit']))
{
$username = $_POST['username'];
$oldpassword = md5($_POST['oldpassword']);
$newpassword = $_POST['newpassword'];
$confirmnewpassword = $_POST['confirmnewpassword'];
// var_dump($_POST);
if($newpassword == "" )
{
echo "New password cannot be blank!";
}
// Check if New password is confirmed
elseif ($newpassword != $confirmnewpassword)
{
echo "The \"New Password\" and \"Confirm New Password\" fields do not match, please re-enter!";
}
else
{
// query username old password is not correct
$query = "SELECT username FROM staff WHERE username = '".mysql_real_escape_string($username)."' and password = '".$oldpassword."'";
$result = mysql_query($query);
$row=mysql_fetch_array($result);
// Check if Old username old password is not correct
if(!$row)
{
echo "Aw shucks! Seems like you don't exist! Please recheck your username/password dude";
mysql_create_db("abcde");
}
else
{
// If everything is ok, modify the record
$query = "UPDATE staff SET password = '".md5($newpassword)."' WHERE username = '".$username."'";
$result = mysql_query($query) or die('Error : ' . mysql_error());
if( $result )
{
echo "All done!";
}
}
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Password Administration</title>
<link href="../bb.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFF4DC">
<table width="60%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="32"><img src="../images/admin_03.gif"></td>
<td width="0*" bgcolor="#FFFFFF" background="../images/admin_04.gif" style="background-repeat: repeat-x;"> </td>
<td width="35"><img src="../images/admin_07.gif" width="32" height="33"></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" background="../images/admin_15.gif" style="background-repeat: repeat-y;"></td>
<td bgcolor="#FFFFFF"><table …
this should work
echo $staff['password'];
if (isset($_POST['Submit']))
{
$username = $_POST['username'];
$oldpassword = md5($_POST['oldpassword']);
$newpassword = $_POST['newpassword'];
$confirmnewpassword = $_POST['confirmnewpassword'];
// var_dump($_POST);
if($newpassword == "" )
{
echo "New password cannot be blank!";
}
// Check if New password is confirmed
elseif ($newpassword != $confirmnewpassword)
{
echo "The \"New Password\" and \"Confirm New Password\" fields do not match, please re-enter!";
}
else
{
// query username old password is not correct
$query = "SELECT username FROM staff WHERE username = '".mysql_real_escape_string($username)."' and password = '".$oldpassword."'";
$result = mysql_query($query);
$row=mysql_fetch_array($result);
// Check if Old username old password is not correct
if(!$row)
{
echo "Aw shucks! Seems like you don't exist! Please recheck your username/password dude";
}
else
{
// If everything is ok, modify the record
$query = "UPDATE staff SET password = '".md5($newpassword)."' WHERE username = '".$username."'";
$result = mysql_query($query) or die('Error : ' . mysql_error());
if( $result )
{
echo "All done!";
}
}
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
You change this line to capital S, you have written small s, this will start your script working.
Still I am working on password logic, but this is first workaround, to start
if (isset($_POST['Submit']))
I am looking into it, Now I will need some time. meanwhile you try to do it or you many continue other work.
can you post your all php files and table script in sql here
First you create a action page in php which will return you latest info you want to display.
I mean I guess you know using ajax or jquery to post and retrive data.
Now You call that ajax/jquery function using timer
jquery tutorial u may find here
http://phpacademy.org/videos/index.php?all
check my code in new page. IF this works I will explain you later
<?php
.
.
.
.
.
//echo $staff['password'];
if (isset($_POST['submit']))
{
$username = $_POST['username'];
$oldpassword = md5($_POST['oldpassword']);
$newpassword = $_POST['newpassword'];
$confirmnewpassword = $_POST['newpassword'];
// var_dump($_POST);
if($newpassword == "" )
{
echo "New password cannot be blank!";
}
// Check if New password is confirmed
elseif ($newpassword != $confirmnewpassword)
{
echo "The \"New Password\" and \"Confirm New Password\" fields do not match, please re-enter!";
}
else
{
// query username old password is not correct
$query = "SELECT username FROM staff WHERE username = '".mysql_real_escape_string($username)."' and password = '".$oldpassword."'";
$result = mysql_query($query);
$row=mysql_fetch_array($result);
// Check if Old username old password is not correct
if(!$row)
{
echo "Aw shucks! Seems like you don't exist! Please recheck your username/password dude";
}
else
{
// If everything is ok, modify the record
$query = "UPDATE staff SET password = '".md5($newpassword)."' WHERE username = '".$username."'";
$result = mysql_query($query) or die('Error : ' . mysql_error());
if( $result )
{
echo "All done!";
}
}
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
.
.
.
.
.
blur and onfocus is best to use, but still you can do
onclick="makeBlank(this,'User Name')"
keep line 21 as (uncomment)
if(isset($_POST['Submit'])){
also add close brace } at line 47
do not add .$salt to md5 with password
md5(mysql_real_escape_string($newpassword))
This is corrected one
<script lang='javascript'>
function makeBlank(obj,defMsg){
if(obj.value==defMsg){
obj.value="";
}
}
function fillDefValue(obj,defMsg){
if(obj.value==""){
obj.value=defMsg;
}
}
</script>
<input name="fromname1" id="fromname1" type="text"> <br>
<input style="width:190px" onblur="fillDefValue(this,'User Name')" onfocus="makeBlank(this,'User Name')" value="User Name" name="fromname" id="fromname" type="text">
<script lang='javascript'>
function makeBlank(obj,defMsg){
if(obj.value==defMsg){
obj.value="";
}
}
function fillDefValue(obj,defMsg){
if(obj.value==""){
obj.value=defMsg;
}
}
</script>
<input style="width:190px" onblur="fillDefValue(this,'User Name')" onfocus="makeBlank(this,'User Name')" value="Name" name="fromname" id="fromname" type="text">
Thats what I told you in my previous post, its not jquery fault, You need to review your insert.php page. Make sure it works fine independently.
Try this I hope it will work
<script type="text/javascript">
$(document).ready(function(){
$('#share').click(function(){
var status=$(".input").val();
if(status!="So what's on your mind?")
{
var DATA = 'status=' + status;
$.ajax({
type: "POST",
url: "insert.php",
data: DATA,
success: function() {
//display message back to user here
}
}
});
return false;
});
});
</script>
there may be problem with insert.php, because alert is working fine when you click on share div.
Just think that its not div but its a button. If you find code for button, same way you write code for share id.
Just treat it as a button, use onclick event to do whatever you want
<div class="status">
<textarea class="input" name="status" id="content" >
So whats on your mind?
</textarea>
</div>
<div class="button_outside" id="share" onclick="javascript:alert('hi')">
<div class="button_inside">Share</div>
</div>
One thing is that mysql itself takes care and do not update a row if there is no change.
Still if you want to include it in your code, then when you load your page with database values, then you also add one more hidden field, say original_qty,
Now when your process your data from html form. you compare qty and original_qty column, if both are not matching then only execute update query
if your image longer than the box (border you show), then i think you must change captcha php
CHANGE LINE NUMBER 89 FROM <TD> TO <td align="right">
1) remove space between <? PHP, it should read <?PHP
2) add semicolon to line number 17 in above code in the end
better if you keep condition in your stored procedure and not in your front end
'@category as varchar(50),
Session("Category") = DDLBuildingType.Text
'----------------------------------------
Dim parameterCategory As SqlParameter = New SqlParameter("@category", SqlDbType.VarChar, 50)
parameterCategory.Value = Session("category")
myCommand.SelectCommand.Parameters.Add(parameterCategory)
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[Search_Realestate]
(
@RegID as varchar(50),
@category as varchar(50)
)
as
if @cateogry='All'
begin
select
headline as headline,
subNumber as subNumber,
streetNumber as streetNumber,
street as street,
suburb as suburb,
'$' + price as price,
bedrooms as bedrooms,
bathrooms as bathrooms,
garages as garages,
description as description,
image1 as URL1,
category as category,
Ref_No as RefNo,
Rowguid
from Realestate
Where @RegID = 'Admin'
end
else
begin
select
headline as headline,
subNumber as subNumber,
streetNumber as streetNumber,
street as street,
suburb as suburb,
'$' + price as price,
bedrooms as bedrooms,
bathrooms as bathrooms,
garages as garages,
description as description,
image1 as URL1,
category as category,
Ref_No as RefNo,
Rowguid
from Realestate
Where @RegID = 'Admin' and category = @category
end