urtrivedi 276 Nearly a Posting Virtuoso

specify what error or unexpected things happening?

urtrivedi 276 Nearly a Posting Virtuoso

It is a strange behaviour it is working here

urtrivedi 276 Nearly a Posting Virtuoso

it is really strange because as you go on removing condtions from query, you result no of rows increases normally.

Here it is working fine

urtrivedi 276 Nearly a Posting Virtuoso

Even if you remove 4th condition you will be able to view the result, because one of the four names are there in your name1,name2 and name3. I do not know why you are not getting the result.

if sql looks longer, you will feel same when you try to find result using php code. better you continue with sql.

if you want to search two name then use following query

select * from something where 
name1 in ('roger','dubs')
and name2 in ('roger','dubs')
and name3 in ('roger','dubs')
and name4 in ('roger','dubs')

always keep all name1..4 columns in your query

urtrivedi 276 Nearly a Posting Virtuoso

To format your date output you may use date_format() function. refer mysql manual for details.

urtrivedi 276 Nearly a Posting Virtuoso

create relation in requires table. both column will take value from course table. do not allow casacade update or delete to protect related data from deleting.

urtrivedi 276 Nearly a Posting Virtuoso

user brace around order by phrase

$enamn = mysql_query("SELECT * FROM contacts ORDER BY {$_GET['orderbycol']}  ");
urtrivedi 276 Nearly a Posting Virtuoso

I have changed your line no 51-54

if($_GET['orderbycol']=="")
		$_GET['orderbycol']="lastname";
	

	$enamn = mysql_query("SELECT * FROM contacts ORDER BY  $_GET['orderbycol']"); 		
	echo "<table border='1'>";		
	echo "<tr> 
	<th><a href='{$_SERVER['PHP_SELF']}?orderbycol=lastname'>Efternamn</a> </th> 
	<th><a href='{$_SERVER['PHP_SELF']}?orderbycol=firstname'>Förnamn</a> </th>
	<th><a href='{$_SERVER['PHP_SELF']}?orderbycol=beskcolname'>Beskrivning</a> </th> 
	<th><a href='{$_SERVER['PHP_SELF']}?orderbycol=telfocolname'>Telefonnummer</a> </th> 
	<th><a href='{$_SERVER['PHP_SELF']}?orderbycol=favcolname'>Favorit?</th></a> </tr>";
urtrivedi 276 Nearly a Posting Virtuoso

if you want to use two columns to concat into third column then you may use following query

update mytable set col1=concat(col2,col2) where col4='mycondition'
urtrivedi 276 Nearly a Posting Virtuoso

file permission may be the issue on your server.

urtrivedi 276 Nearly a Posting Virtuoso

above one was copied twice follwing is the correct query

SELECT Customer_Info.CustName,Customer_Info.Address,Customer_Bank_Info.CustChequeNo,Customer_Bank_Info.CustAccountNoFROM Customer_Info,Customer_Bank_InfoWHERE Customer_Info.customerID=Customer_Bank_Info.customerID
urtrivedi 276 Nearly a Posting Virtuoso

i am assuming that you have customer_id column in both tables. I have joined using customer_id instead of agent_id

SELECT Customer_Info.CustName,Customer_Info.Address,Customer_Bank_Info.CustChequeNo,Customer_Bank_Info.CustAccountNoFROM Customer_Info,Customer_Bank_InfoWHERE Customer_Info.AgentID=Customer_Bank_Info.AgentIDSELECT Customer_Info.CustName,Customer_Info.Address,Customer_Bank_Info.CustChequeNo,Customer_Bank_Info.CustAccountNo
from Customer_Info,Customer_Bank_Info
WHERE Customer_Info.customerID=Customer_Bank_Info.customerID
urtrivedi 276 Nearly a Posting Virtuoso

check do you have value in 'field_name' column in table 2 for all rows?

Also my another observation is as follows:
If table 2 contains only one row then you need not to execute subquery in side the loop you can simply join two tables and execute query only once.

urtrivedi 276 Nearly a Posting Virtuoso
update tablename set col1='newvalue' where col2='my condition'
urtrivedi 276 Nearly a Posting Virtuoso

when you use mysql_fetch_array will have number as array key that is 0,1,2,3,....., if you want to access it thourgh field name then you must user mysql_fetch_assoc();
Also I think you need to set an inner loop because second query may give you more than one record. Right now you will be able to print ouput only once for each second query.

$bar = mysql_fetch_array ($foo);
echo $bar['field_name'];
urtrivedi 276 Nearly a Posting Virtuoso

You post your sample data from all tables that you include in your query with column name.
Then post expected output of query.

urtrivedi 276 Nearly a Posting Virtuoso

You action page may be like following. this page may be called from html form.

<?php

	$file_name="export.csv";
	$filter=" WHERE COL1='{$_POST['text1']}' AND col2='{$_POST['text2']}' ";


	$titlelist="";

	$titlelist="col1,col2,col3";

	{
	    header("Content-type: application/vnd.ms-excel");
		header('Content-Disposition: attachment; filename="'.$file_name.'"');
	 
/*
		--write proper data fetch syntax
		$query= "select col1,col2,col3 from mytable {$filter} order by col1");
		$stid=execute($query);

*/		
		print $titlelist.chr(13).chr(10);
		while ($row = oci_fetch_assoc($stid))
		{
 		    print "{$row['col1']}, {$row['col2']}, {$row['col3']}";
			print chr(13).chr(10);
		}
	}
    exit ();
?>
urtrivedi 276 Nearly a Posting Virtuoso

to create it in excel, you may need some library files. I have never used that though.

I used to export data in csv format, which you can easily open in excel. Also you can do it using standard file write operation. no external libraries needed.

urtrivedi 276 Nearly a Posting Virtuoso

<?php
echo "<a href=hotel-map.php?id=$pid><img src='myimage.jpg' width='100px' height='75px'></a>";
?>

dmkc commented: thanks for the help sir! +1
urtrivedi 276 Nearly a Posting Virtuoso

You have to add one more table to your system say "order_hdr" with columns, order_id, order_date, customer_name, etc..... Here keep order id autoincrement.

rename your order table order_dtl table and without autoincrement in order_id,


first Insert record in order_hdr table. get order_id generated in some variable
now insert products and above order id in order_dtl table.

urtrivedi 276 Nearly a Posting Virtuoso

after line no 63 type end brace " } " for function, before "?>php"
or

line 12 if($alphaNumCheck) is without end brace " } "

urtrivedi 276 Nearly a Posting Virtuoso
select * from something where 
name1 in ('roger','dubs','chill','lee')
and name2 in ('roger','dubs','chill','lee')
and name3 in ('roger','dubs','chill','lee')
and name4 in ('roger','dubs','chill','lee')
rogerkore commented: Very usefull. Thanks a lot +0
urtrivedi 276 Nearly a Posting Virtuoso

check whether script source is a web address. May be jquery. then download equivalent js file.

urtrivedi 276 Nearly a Posting Virtuoso
update mytable set  crterm=bal/pi where somecolumn='my condition'
urtrivedi 276 Nearly a Posting Virtuoso

another alternative for mysql

select min(row) from (
SELECT @row := @row + 1 as row,t.IpAddressDigit
FROM iptable t, (SELECT @row := 0) r
order by t.IpAddressDigit 
)a where a.row<>a.IpAddressDigit ;
urtrivedi 276 Nearly a Posting Virtuoso
select min(a.IpAddressDigit +1) free_ip 
from iptable a 
left outer join iptable b on b.IpAddressDigit =a.IpAddressDigit +1
where   b.IpAddressDigit  is null
order by a.IpAddressDigit
urtrivedi 276 Nearly a Posting Virtuoso

where is you loop code and query?
also post your sample expected output

urtrivedi 276 Nearly a Posting Virtuoso

as far as I know its not possible without cron

urtrivedi 276 Nearly a Posting Virtuoso

I have changed your line no 2

SELECT arp.DisplayName0, 
(case when arp.DisplayName0='Microsoft Office Standard 2007' THEN arp.DisplayName0 ELSE '' END) AS ResourceID2007, 
count(*) AS TotalTarget, 
round(100.0*count(case when arp.DisplayName0='Microsoft Office Standard 2007' THEN 1 ELSE 0 END)/count(*),1) AS Office2007StdPct
FROM v_Add_Remove_Programs arp
INNER JOIN v_CM_RES_COLL_MI100017 coll ON arp.ResourceID=coll.ResourceID  
INNER JOIN v_RA_System_SMSAssignedSites sas ON coll.ResourceID=sas.ResourceID
WHERE sas.SMS_Assigned_Sites0=@Site
GROUP BY arp.DisplayName0, arp.ResourceID
urtrivedi 276 Nearly a Posting Virtuoso

You need to write script that will query all record whose user set time matches with current server time.
Now you can send mail for those recods only.

After writing a script, you need to add this script to cron job/schedule task which runs every minute.

urtrivedi 276 Nearly a Posting Virtuoso

You may give two options for entering MoMA, one dropdown list from moma database which are entered in database and another text box. tell user to select from list and if not found then they may enter it in textbox.

<select name=moma1><option>........</select> &nbsp;
<input type=text name=moma2>

when you update your database if moma1 is having non null value then ignore moma1. if moma1 is null then insert moma2 in your database.

urtrivedi 276 Nearly a Posting Virtuoso

You just fill up your country database with country code and country name. you will find it very easily. make country code as foreign key.

Then give user dropdownlist to select country. dont allow user to type country name.

urtrivedi 276 Nearly a Posting Virtuoso

Thanks for your reply.

urtrivedi 276 Nearly a Posting Virtuoso

SELECT * FROM rounds WHERE `round`=`current_round`-1

urtrivedi 276 Nearly a Posting Virtuoso

You may use union to combine multiple tables. also Post your table structure.

urtrivedi 276 Nearly a Posting Virtuoso

To join two table you must have pk/fk relation between tables. I am assuming that itemid is link column between two tables.

SELECT a.name, a.price,b.somcolname from products a ,discount b 
WHERE a.itemid=b.itemid and a.itemid = '$id'
urtrivedi 276 Nearly a Posting Virtuoso

I have some doubt regarding jquery and ajax.
What is the difference between jquery and ajax?
Do jquery accesses server resource or its just do the things at client side?
while solving a problem what to choose out of these two?

urtrivedi 276 Nearly a Posting Virtuoso

You first output your query before executing, then copy that query to mysql admin panel, may be mysql client or query browser or phpmyadmin ,what ever you have. Then see the result, is it coming there as expected.

$query="SELECT COUNT (*) from timerecord.timesheet.fnempid, timerecord.timesheet.fdDate, timerecord.timesheet.fnDepid, timerecord.timesheet.fnDivId, timerecord.timesheet.ftTimeIn, timerecord.timesheet.ftTimeOut, timerecord.timesheet.fcEmpName, timerecord.timesheet.fcRemarks, Master.refdepartment.fcDeptDesc FROM timerecord.timesheet inner join Master.refdepartment on timerecord.timesheet.fnDepid = Master.refdepartment.fnDeptId where timerecord.timesheet.fdDate = '$date' AND timerecord.timesheet.ftTimeIn != '' AND timerecord.timesheet.fcDeptDesc like '$dept'";
echo $query;
die('');
urtrivedi 276 Nearly a Posting Virtuoso

sid data
1 abc
2 def
1 dfsf
2 sdfs

suppose above is the case in your table, then what result do you expect?

urtrivedi 276 Nearly a Posting Virtuoso

group by is used to aggregate you data, you dont need group by so remove group by clause from your query. following is your query

SELECT Dname, Dnumber FROM DEPARTMENT
urtrivedi 276 Nearly a Posting Virtuoso

following query will show 100 records and start from record no 20

select * from table1 a where mycol='mycondition' limit 20, 100
urtrivedi 276 Nearly a Posting Virtuoso

select * from db1.table1 a left outer jion db2.table2 b on a.joincolname=b.joincolname

urtrivedi 276 Nearly a Posting Virtuoso

try as given below with @ sign

@mysql_connect("localhost", "Master", "pword");
@mysql_select_db("db"); 	
$official2 = @mysql_query("SELECT * FROM Contribute WHERE stack LIKE '%comic%' ORDER BY points DESC")OR die (mysql_error());
urtrivedi 276 Nearly a Posting Virtuoso

Your code only works option value and text is same. and that to in small case
try with following
programmer|programmer
myself|myself
irene|irene

You need to modify your javascript function

hmortensen commented: Short and to the point. +1
urtrivedi 276 Nearly a Posting Virtuoso

use explode function and break your string into array

urtrivedi 276 Nearly a Posting Virtuoso

you need to add a cron job on linux and schedule task on windows.

urtrivedi 276 Nearly a Posting Virtuoso

you can build your query as shown below

$query= " select * from mytable where 
company_name in ( '".implode("','",$_POST['flight'])."' )";
urtrivedi 276 Nearly a Posting Virtuoso
<?php
function sort($arr)
{
	for($i=0;$i<count($arr);$i++)
	{
		if($arr[$i]>$arr[$i+1])
		{
			$max=$arr[$i+1];
			$arr[$i+1]=$arr[$i];
			$arr[$i]=$max;						
		}
	}
	return ($arr);
}

$a[0]=3;
$a[1]=4;
$a[2]=5;

$b[0]=1;
$b[1]=3;
$b[2]=5;

$c[0]=5;
$c[1]=3;
$c[2]=2;

$a=sort($a);
$b=sort($b);
$c=sort($c);

?>
urtrivedi 276 Nearly a Posting Virtuoso

change line no 5 of second code block to following

$att_ref .= $attribute[$i].",";

separte selected codes with comma. Also you are directly assing you must concat to retain previous loop values.

urtrivedi 276 Nearly a Posting Virtuoso

Some database supports cascade delete, cascade update option. Mysql innodb engine may be supporting this. You need to modify relation between two tables and allow cascade delete.

click here for details