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')
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')
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))
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.
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.
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";
Download php designer 2007 for free, its php editor that will help you to find syntax errors.
YOu have to develop it on your own. google will only give translater script. rest thing you have to develop.
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
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.
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.
$_GET['message']
this variable is empty. check the spelling in the previous page from where your current page is called.
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.
run it through sed
Hi smantscheff, I do not understand this, please explain.
UPDATE listing SET email=SELECT CONCAT(REPLACE(title, ' ','' ) , SUBSTR(email, INSTR(email, '@' ) ) )
$arr[2]=150;
$arr[231]=163;
$arr[235]=1121;
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,' ','')
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.
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> </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
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'
Where is your effort?
Post here, what ever you did so far.
what are values of, num1 and num2.
Your second loop will never execute. eveyting depends on num1 and num2
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.
Look at the link, it is something readymade. Check whether it is useful in your case or not.
http://coppermine-gallery.net/
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?
You may mark it solved, You may start another thread for second problem. Its little complex to get that work.
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
.
.
.
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> </td></tr>";
}
?>
var total=no+no1+no2;
html += 'a.one + a.arr[0] + a.two = ' + total + '<br/>';
document.getElementById('content').innerHTML = html;
​
post your code here
use function
mysql_fetch_assoc() to get array with column name as key instead of index
phpdesigner personal edition is free and at least it indicates you syntax errors. Just 2 mb on download
You are using parameter CommandBehavior.SchemaOnly, so I think its not a problem in performance.
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"?
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>
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;
.
.
.
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'))
);
echo your array structure. before everything and check is it as expected
<?php
echo "<pre>";
print_r($array);
echo "<pre>";
if(is_array($array)){
.
.
.
?>
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());
?>
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
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.
date or datetime
post your mysql script with 2 table structure and sample data.
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
move_uploaded_file($_FILES['fileelement']['tmp_name'],'../uploadedfiles/newfile.ext');
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
MYFORM is anyway child of document so it is allowing, I think problem occurs when there are more than one form.
remove 's' from line 7
it should look like below
$error_array=array();
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
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","");
.
.
.
you may find solution at
http://www.daniweb.com/web-development/php/threads/361569/1544967#post1544967