urtrivedi 276 Nearly a Posting Virtuoso

before running this query keep backup of that column. or do it in dummy database

update tablename set colname=replace(colname,'TVM/01/00','TVM/01/2000')
urtrivedi 276 Nearly a Posting Virtuoso

SYNTAX

select substring(COLNAME, 1, CHARINDEX('/',COLNAME, CHARINDEX('/',COLNAME)+1)) FROM TABLENAME

EXAMPLE

select substring('TVM/345/2000,TVM/01/00,TSR/42/01', 1,CHARINDEX('/','TVM/345/2000,TVM/01/00,TSR/42/01',CHARINDEX('/','TVM/345/2000,TVM/01/00,TSR/42/01')+1))
urtrivedi 276 Nearly a Posting Virtuoso

You are talking about cron job (linux) and schedule job (windows).
You create your php page to do so,
google for cron job settings.

you can schedule that php script to run whenever and however you want you want.

urtrivedi 276 Nearly a Posting Virtuoso
select last_name, count(*) total from user_master 
group by last_name
having count(*) = 1

This query will find last_name that occurs only once in the table.
so you must use having with aggregate functions.

urtrivedi 276 Nearly a Posting Virtuoso

use single quotes (') instead of double quotes(") at line no 48

$q="UPDATE users SET first_name='$fn', last_name='$ln', email='$e' WHERE user_id='$id' LIMIT 1";
urtrivedi 276 Nearly a Posting Virtuoso

Download php designer 2007 for free, its php editor that will help you to find syntax errors.

urtrivedi 276 Nearly a Posting Virtuoso

YOu have to develop it on your own. google will only give translater script. rest thing you have to develop.

urtrivedi 276 Nearly a Posting Virtuoso

If you are already having date type (reshipdate) then why are u converting it. starting away insert it.

any way try to use
1) change yy to yyyy and change / to -

or

2) str_to_date function

urtrivedi 276 Nearly a Posting Virtuoso
if(count($argument)==1)
			{
				$this->name=$argument[0];
			}
			if(count($argument)==2)
			{
				$this->name=$argument[0];
				$this->msg=$argument[1];
			}

Here you have not written $ sign before argument. In my previous post I suggest about position of dollar sign. So Here this->name is different then argument, so both will start with dollar sign.

urtrivedi 276 Nearly a Posting Virtuoso

change this line 19 from

if(isset($_POST['submitted']))

to

if(isset($_POST['submit']))

because you are giving name submit to the submit-button and not submitted.

urtrivedi 276 Nearly a Posting Virtuoso
$_GET['message']

this variable is empty. check the spelling in the previous page from where your current page is called.

urtrivedi 276 Nearly a Posting Virtuoso

Your textarea and your button must be inside form. you should also set action page for the form, where you will actually insert comment in your table.

urtrivedi 276 Nearly a Posting Virtuoso

run it through sed

Hi smantscheff, I do not understand this, please explain.

urtrivedi 276 Nearly a Posting Virtuoso
UPDATE listing SET email=SELECT CONCAT(REPLACE(title, ' ','' ) , SUBSTR(email, INSTR(email,  '@' ) ) )
urtrivedi 276 Nearly a Posting Virtuoso
$arr[2]=150;
$arr[231]=163;
$arr[235]=1121;
urtrivedi 276 Nearly a Posting Virtuoso

YOU need to run update query in mysql
to update emails

update listing set email='title@test.domain.com' where 
email='suppliers@test.domain.com'

Be carefull before using following query. it will set title to title without spaces in all records, so better you add new column say title_wo_space, then use following query

update listing set title_wo_space=replace(title,' ','')
urtrivedi 276 Nearly a Posting Virtuoso

You can not write where condition in insert statement, remove following part from query. Query will itself find id when u try to insert duplicate row

WHERE id='$edit_sel_id'

If your table have auto_increment then this query will not work. It will only work when you pass all columns in insert statement. If you have another indexes and unique columns, then this query will respond properly.

urtrivedi 276 Nearly a Posting Virtuoso

I have tried doing in one query, but Not able to do it in your case, I was able to succced in other cases long back ago. So as almostbob suggested I am posting part query code which is mysql php combination (uncompiled). You may try this

<?PHP
$query="select * from team order by team_id";

$web=mysql_query($query);
echo "\n<table>";

   echo "\n<tr><td><b>team name</b></td>";

   echo "\n";
   echo "<td>col1</td>";
   echo "<td>col2</td>";
   echo "<td>col3</td>";
   echo "</tr>";

while($rowweb=mysql_fetch_assoc($web))
{

   $query="select ....... where .... and team_id='{$rowweb[team_id]}' order by date desc limit 6"; //...means your original query that you have posted with additional teamid filter and limit 6 phrase

   $rec=mysql_query($query);


   while($rowrec=mysql_fetch_assoc($rec))
   {
      echo "\n<tr>";
      echo "<td>{$rowrec['col1']}</td>";
      echo "<td>{$rowrec['col2']}</td>";
      echo "<td>{$rowrec['col3']}</td>";
      echo "</tr>";

   }

   echo "\n<tr><td><b>&nbsp</td></tr>";
}


?>

This may not give you result in order of points.
for that:
1) You may have to store all result in array,
2) perform array sort and
3) display array

urtrivedi 276 Nearly a Posting Virtuoso

I assume that you have defined your primary key or unique key for you table. If yes then you can use following single query. search more "on duplicate key mysql"

insert into tablename(col1,col2, col3) values('1','2','3') on duplicate key update set col2='22', col3='33'
urtrivedi 276 Nearly a Posting Virtuoso

Where is your effort?
Post here, what ever you did so far.

urtrivedi 276 Nearly a Posting Virtuoso

what are values of, num1 and num2.
Your second loop will never execute. eveyting depends on num1 and num2

urtrivedi 276 Nearly a Posting Virtuoso

I think ftp is better. Share ftp userid password with him. Because even if you find such tool, to change single page, he need to download whole site.

urtrivedi 276 Nearly a Posting Virtuoso

Look at the link, it is something readymade. Check whether it is useful in your case or not.
http://coppermine-gallery.net/

Netcode commented: works with mySQL -1
urtrivedi 276 Nearly a Posting Virtuoso

I have tried this sattement but it doesnot work
SELECT accountname, NULL AS debit, credit FROM revenue
UNION
SELECT accountname, debit, NULL FROM expense

This statement is fine. You should get the result. what error you are getting?

urtrivedi 276 Nearly a Posting Virtuoso

You may mark it solved, You may start another thread for second problem. Its little complex to get that work.

urtrivedi 276 Nearly a Posting Virtuoso

You have explained this problem in very well manner.

I have added one more column adj, check are you getting what is expected. Here I have used ifnull function

.
.
.
, d.change as DIFF
, ((sum(CASE WHEN (".$ht." AND ".$hw.")OR(".$at." AND ".$aw.") THEN 3 ELSE 0 END)
+ sum(CASE WHEN (".$ht." OR ".$at.") AND ".$d." THEN 1 ELSE 0 END))) +ifnull(d.change,0)  AS adj
.
.
.
MargateSteve commented: Perfect Answer +1
urtrivedi 276 Nearly a Posting Virtuoso

This is not compiled code, change column name and others syntax.

<?PHP
$query="select websitename,websitelink from receipe_sites order by websiterank desc";

$web=mysql_query($query);
echo "\n<table>";

while($rowweb=mysql_fetch_assoc($web))
{

   $query="select recipeid,recipename, reciepelink, recipeby from receipe_submit where websitename='{$rowweb['websitename']}' order by websiterank desc";

   $rec=mysql_query($query);

   echo "\n<tr><td><b>{$rowweb['websitename']}</b></td></tr>";

   echo "\n<tr>";
   echo "<td>Name</td>";
   echo "<td>Link</td>";
   echo "<td>By</td>";
   echo "</tr>";

   while($rowrec=mysql_fetch_assoc($rec))
   {
      echo "\n<tr>";
      echo "<td>{$rowrec['recipename']}</td>";
      echo "<td>{$rowrec['recipelink']}</td>";
      echo "<td>{$rowrec['recipeby']}</td>";
      echo "</tr>";

   }

   echo "\n<tr><td><b>&nbsp</td></tr>";
}


?>
urtrivedi 276 Nearly a Posting Virtuoso
var total=no+no1+no2;
html += 'a.one + a.arr[0] + a.two = ' + total + '<br/>';
document.getElementById('content').innerHTML = html;
​
urtrivedi 276 Nearly a Posting Virtuoso

post your code here

urtrivedi 276 Nearly a Posting Virtuoso

use function
mysql_fetch_assoc() to get array with column name as key instead of index

urtrivedi 276 Nearly a Posting Virtuoso

phpdesigner personal edition is free and at least it indicates you syntax errors. Just 2 mb on download

http://www.download.com/PHP%20Designer%202007%20-%20Personal/3000-10248_4-10575026.html?part=dl-6263317&subj=dl&tag=button

urtrivedi 276 Nearly a Posting Virtuoso

You are using parameter CommandBehavior.SchemaOnly, so I think its not a problem in performance.

urtrivedi 276 Nearly a Posting Virtuoso

Insertion is the problem or you are not able to display things in expected way???

each time i insert a new recipe in creates a new completley seperate table and i want all the recipes that belong to "some recipe website" to apear in the same table of the right recipe website.

Also I do not understand your above statement. What do you mean by "creates a new completely separate table"?

urtrivedi 276 Nearly a Posting Virtuoso

Make sure you write $this->name and NOT $this->$name.

<html>
<head>
Creating objects
</head>
<body>
<?php
class Objects
{
	var $name;

	function set_name($na)
	{
		$this->name= $na;
	}
	
	function get_name()
	{
		return $this->name;
	}
}

$ob=new Objects;
$ob->set_name("ila");
echo "the name of greatest person alive is ",$ob->get_name();

?>
</body>
</html>
urtrivedi 276 Nearly a Posting Virtuoso

echo certain things as i have written below and see what comes in id

echo "<pre>";
print_r($_POST['number']);
echo "</pre>";

$id = implode(",",$_POST[number]);
echo $id;
.
.
.
PsychicTide commented: Thank you, sir +4
urtrivedi 276 Nearly a Posting Virtuoso

I have added constraint at the end.

CREATE TABLE test(
	id INTEGER AUTO_INCREMENT,
	iduser INTEGER REFERENCES player(id) ON UPDATE CASCADE ON DELETE CASCADE,
.
.
class CHAR(10) NOT NULL ,

.
.
PRIMARY KEY(id,iduser),
FOREIGN KEY (iduser) REFERENCES user(idu),
CONSTRAINT chk_class CHECK (class IN ('x1','x2','x3'))
);
urtrivedi 276 Nearly a Posting Virtuoso

echo your array structure. before everything and check is it as expected

<?php
echo "<pre>";
print_r($array);
echo "<pre>";

if(is_array($array)){
.
.
.
?>
urtrivedi 276 Nearly a Posting Virtuoso

first change name of checkbox to number[] (i have done that change only). this action will send checkbox array to processing page.

<?php
/*connect to and select database*/

$num_rows = mysql_num_rows($result);
$i = 0;
while ($i < $num_rows)
{
  $row = mysql_fetch_array($result);
  $num = $row['id'];
?>
<form action="delete.php" method="post">
...
<div><input type="checkbox" name="number[]" value="<? $num ?>" /><br /><? echo $num ?></div>
...
/*HTML here which displays the rest of the PHP column variables I have set up*/
<? $i++;} ?>

then join array values with comma using implode function

<?php
/*connect to and select database*/

$id = implode(",",$_POST[number]);
mysql_query("DELETE FROM home WHERE id in ({$id})") 
or die(mysql_error()); 
?>
urtrivedi 276 Nearly a Posting Virtuoso

Its not inserting data where it is null. You must say. Updating columns where it is null.

first of you must know which rows you want to update. I mean what is the condition.

sample 1 (to update status of all null columns)

update tablename set status='Single' where status is null

sample 2 (to update status where status is null and id is between 1 and 5)

update tablename set status='Single' where status is null and id between 1 and 5
urtrivedi 276 Nearly a Posting Virtuoso

You must add one transaction id column.
say
Fsample (ESN varchar(10), transId int, optn_type int, auditdate datetime)

depening only on query may generate misleading report, if some data is missing.
In above case if data is missing, then it will show null instead of closest date.

urtrivedi 276 Nearly a Posting Virtuoso

date or datetime

karthik_ppts commented: Yes +5
mschroeder commented: agreed +9
urtrivedi 276 Nearly a Posting Virtuoso

post your mysql script with 2 table structure and sample data.

urtrivedi 276 Nearly a Posting Virtuoso

If following query does not work, then tbl_employee is not contaning e_name column. check spelling in your structure.

select tbl_employee.E_Name,sum(tbl_Salary.Amt),tbl_Dpt.DeptName 
from tbl_employee 
inner join tbl_Salary on tbl_employee.eid = tbl_Salary.eid 
inner join tbl_Dpt on tbl_Salary.eid = tbl_Dpt.eid 
where tbl_employee.eid ='E101'
group by tbl_employee.E_Name,tbl_Dpt.DeptName

or try query with only department

select sum(tbl_Salary.Amt),tbl_Dpt.DeptName 
from tbl_employee 
inner join tbl_Salary on tbl_employee.eid = tbl_Salary.eid 
inner join tbl_Dpt on tbl_Salary.eid = tbl_Dpt.eid 
where tbl_employee.eid ='E101'
group by tbl_Dpt.DeptName
urtrivedi 276 Nearly a Posting Virtuoso
move_uploaded_file($_FILES['fileelement']['tmp_name'],'../uploadedfiles/newfile.ext');
urtrivedi 276 Nearly a Posting Virtuoso
SELECT p.property_id, p.property_type, u.user_id, u.name, u.subscription_id 
from properties p inner join user u on p.user_id=u.user_id
where p.property_type='home'
order by u.subscription_id
karthik_ppts commented: helpful post +5
urtrivedi 276 Nearly a Posting Virtuoso

MYFORM is anyway child of document so it is allowing, I think problem occurs when there are more than one form.

urtrivedi 276 Nearly a Posting Virtuoso

remove 's' from line 7
it should look like below

$error_array=array();
urtrivedi 276 Nearly a Posting Virtuoso

you must take out friend request code out of if condition that is

if(isset($_GET["accept"])) {
//START OF SHOW FRIEND REQUESTS
$query = mysql_query("SELECT * FROM friend_requests WHERE recipient = '" . $_SESSION["logged"] . "'");
if(mysql_num_rows($query) > 0) {
while($row = mysql_fetch_array($query)) { 
$_query = mysql_query("SELECT * FROM members WHERE id = '" . $row["sender"] . "'");
while($_row = mysql_fetch_array($_query)) {
echo $_row["username"] . " wants to be your friend. <a href=\"" . $_SERVER["PHP_SELF"] . "?accept=" . $_row["id"] . "\">Accept?</a><br />";
//END OF SHOW FRIEND REQUESTS
urtrivedi 276 Nearly a Posting Virtuoso

in the begining of your code, you check the post values and see whether you are getting expected variables, and their values or not

<?php
echo "<pre>";
print_r($_POST);
echo "</pre>";
$connect=mysql_connect("localhost","root","");
.
.
.
urtrivedi 276 Nearly a Posting Virtuoso