after removing <? ?> tags then use htmlentities function to output html code on browser.
echo htmlentities("your html string");
after removing <? ?> tags then use htmlentities function to output html code on browser.
echo htmlentities("your html string");
I have written changes in bold letters. You must add some expression against title column you cannot write title or description.
change your query as following.
$countofrecs = mysql_query("SELECT count(*) from tablename
WHERE
title LIKE '%".$searchterm."%'
OR description LIKE '%".$searchterm."%'
OR catid = '$catid'");
I have written following code try. I have used only one form.
I hope this is what you are looking for.
<script lang='javascript'>
function joinname()
{
if(document.joinnameform.fullname.value!='')
{
document.joinnameform.fullname.value=document.joinnameform.fullname.value+',';
}
document.joinnameform.fullname.value=document.joinnameform.fullname.value+ document.joinnameform.fname.value + ' ' + document.joinnameform.lname.value;
document.joinnameform.fname.value ='';
document.joinnameform.lname.value='';
//return true;
}
</script>
</head>
<form name=joinnameform id=joinnameform action='mycgiscript'>
First name <input type=text name=fname id=fname >
Last name <input type=text name=lname id=lname ><br>
All names <input type=text name=fullname id=fullname readonly style='width:300px'><br>
<input type=button name=btnsub id=btnsub value='Add name to list' onclick='javascript:joinname()'>
<br><br><br><br>
<input type="submit" value="Submit" name=btnsubmit></p>
</form>
</html>
I have set one flag before your while loop;
If while loop is executed then flag is true;
Now I have removed your else and written one if condition based on that flag, if option 1 and 2 is not shown then show option 3.
I hope this is what you are looking for.
$op1and2shown=false;
while ($row = mysql_fetch_array($results, MYSQL_ASSOC))
{
$op1and2shown=true;
/////////////////////////////////
///
/// DISPLAY EXISTING DATA IN
/// TABLE FORM
/////////////////////////////////
/////////////////////////////////
///
/// DISPLAY UPDATE ON LATEST DATA
/// IN TABLE FORM
/////////////////////////////////
}
}
If(!$op1and2shown)
{
echo $HW_dev_num;
/////////////////////////////////
///
/// DISPLAY LATEST DATA NOT UPDATED
///
/////////////////////////////////
}
You question is confusing. filtering the result and ordering the result is different thing. we use "where" clause to filter and "order by " clause to order.
Your queries for ordering are as follows for ordering.
ascending
SELECT * FROM $tbl_name WHERE TO_DAYS( NOW( ) ) - TO_DAYS( `pDate` ) >20
AND mid(`SiteID`,1,1) ='C' AND `cDate` LIKE '0000-00-00' AND `crDate` LIKE '0000-00-00' order by code
descending
SELECT * FROM $tbl_name WHERE TO_DAYS( NOW( ) ) - TO_DAYS( `pDate` ) >20
AND mid(`SiteID`,1,1) ='C' AND `cDate` LIKE '0000-00-00' AND `crDate` LIKE '0000-00-00' order by code desc
function joinname()
{
document.completenameform.fullname.value = document.joinnameform.fname.value + ' ' + document.joinnameform.lname.value;
return true;
}
Return true instead of fullname value.
I cannot understand why you are using two forms. You should keep fullname under joinnameform.
<input type=text name=fname id=fname >
<input type=text name=lname id=lname >
<input type=text name=fullname id=fullname readonly >
<input type=submit name=btnsub id=btnsub onclick='javascript:joinname()'>
<script lang='javascript'>
function joinname()
{
document.frm.fullname.value= document.frm.fname.value+' ' +document.frm.lname.value;
}
</script>
<form name=frm id=frm >
<input type=text name=fname id=fname onblur='javascript:joinname()'>
<input type=text name=lname id=lname onblur='javascript:joinname()'>
<input type=text name=fullname id=fullname readonly >
</form>
You can create global temporary tables in oracle and use them in your procedure.
Creation Of Temporary Tables
The data in a temporary table is private for the session that created it and can be session-specific or transaction-specific. If the data is to deleted at the end of the transaction the table should be defined as follows:
CREATE GLOBAL TEMPORARY TABLE my_temp_table (
column1 NUMBER,
column2 NUMBER
) ON COMMIT DELETE ROWS;
If on the other hand that data should be preserved until the session ends it should be defined as follows:
CREATE GLOBAL TEMPORARY TABLE my_temp_table (
column1 NUMBER,
column2 NUMBER
) ON COMMIT PRESERVE ROWS;
<?php
//this is php
$phpvar=5+10;
?>
<html>
<script lang='javascript'>
//this is javascript
javavar=<?php echo $phpvar;?> ;
alert(javavar);
</script>
<body>
this is html
</body>
</html>
If you say that your result is not showing 3rd option, that is else part of your if condtion, then it means that your all rows in row_export is satisfying your following condition if (trim($pib_bracket_num) !='' and trim($HW_design) !='' ), so it is priting only option 1 and 2.
I think there is no php/mysql problem. YOu need to rework your code. if data for 3rd option exists.
google FPDF or TCPDF
why you are using sum_of_debit, sum_of_credit columns as it holds same value as debit and credit column.
If you want to automatically insert balance, then post your insert query code. you need to modify your insert query for auto updation and without html values.
this will give friends list of this->uid
SELECT username FROM users WHERE id in (SELECT fid as id FROM friends WHERE uid = {$this->id})
if you want to list name of this->uid with friends then try following
SELECT username FROM users WHERE id in (SELECT fid as id FROM friends WHERE uid = {$this->id}) or id={$this->id}
you have typed > instead of ) at the end of line no 28 of your code, remove > and type )
document.write("<H4><FONT Color='firebrick'>"+introMsg+"</H4></FONT" )
if you give 1: prints hello world 2: world apart from these always print "hello world"
rajarajan as you have not used break statement, your code will give following output
on 1) helloworldhello world
on 2) worldhello world
else) hello world
Post your code of selected.php script
What ever you are asking may happen using switch..case statement without using break
switch ($variable)
{
case '1':
print "hello";
//break;
case '2':
print "world";
}
You should write following query in you selected.php page.
select * from table_name where date between '{$_REQUEST['from_date']}' and '{$_REQUEST['to_date']}'
You Just remove DISTINCT keyword, and add " limit 10 " at the end of query, lets add only 10 records first.
I think your datasize is too big.
Please try the query again, it can not show multiple rows, when you use aggregate function without group by it will always return one or no row.
otherwise post your sample data with column names.
do not print or echo anything or do not write html code before calling header() function.
exit after redirection
header('location: edit.php');
exit;
You are confused between two separate environments. You can not ask user to input data in between. Javascript may access values from html input elements.
User mysql_fetch_array() instead of mysql_fetch_assoc() in line no 4 of my code
you may add following code between line no 16 and 18
$countofrecs=mysql_query("SELECT count(*) from auctions WHERE a_title LIKE '%".$searchterm."%' OR category_id = '$catid'");
$cnt=mysql_fetch_assoc($countofrecs) ;
echo "Your search terms returned '{$cnt[0]}' results";
Inner and natural are same
left and rigth are used with outer join.
Dear Members/Moderators
Hi,
It is good to see newly designed website. But I think whenever you upgrade anything it should not loose the old features. We may keep on adding things but without we must retain old features.
When ever we used to open old website.
1) We were able to know that which category is recently updated. Right now only thead title is shown without last post time on home page.
2) in member summary online status was shown in different color. Also no of therad solved by member, member reputation was also shown.
3) on the top of site last time visited was also shown.
Any way I request moderators to look into the matter. And they may also analyise number of posts before and after changes made.
I think you are making one minor mistake intead of != you must use = sign in join condition.
INSERT INTO species_master (genera, name, species_name, authorities, species_source)
SELECT DISTINCT genera, name, species_name, authorities, species_source FROM tervuren_target
LEFT JOIN species_master
ON
tervuren_target.species_name = species_master.species_name
WHERE species_master.species_name IS NULL
Following query will give you all records that are in A, whenever b.flag is 'Y' it will show 'Y' other wise it will show null. You may still apply where clause at the end of query to filter your records.
SELECT a.*, case when b.flag='Y' then b.FLAG ELSE NULL END FLAG FROM A LEFT JOIN B ON A.ID=B.FK_ID_A
You have syntax error in following line numbers of your code
line no. 3. fgetcsv($handle),500,"^")) // remove UNWANTED ) AFTER $HANDLE
line no. 8. write $row++ instead of row++
line no. 11. for ($c=0;$c<$num;$c++) // WRITE $c++ instead of c++
<html>
<head>
<script lang='javascript'>
function btn1_click()
{
//do something;
alert('in btn1_click function');
}
</script>
</head>
<body>
<input type='button' value='click me' id='btn1' name='btn1'
onclick='javascript:btn1_click();' >
</body>
</html>
Most of things are available in PHP as compared to C/C++. When ever you code something say sorting, searching array. do not start writing loops, find functions in php. You will always find something related to your requirements, in manuals. Everybody know how to code but it is worthless to rewrite the code when it is already there in PHP.
If you are not from IT background start learning database with MS access. php/mysql will be difficult to start with for you.
YOu may use $_REQUEST array without any trouble. It will contain both post and get data from previous page.
What do you expect from mailto function? Do you want to send content of filled form to user?
Mailto function only opens email client window with blank body.
You echo query on screen copy it and try to run in mysql directly may be on mysql command prompt or phpmyadmin. Check whether your query works directly to backend or not. keep echo statment before calling mysql_query() function.
echo $query_add_tarife."<br>";
echo $query_add_facilitati."<br>";
You must intialize your javascript variable in line number 2 of your code
var estimatedCost=0;
i am changing your line no 14 and 16
SET @temp = SELECT count(*) FROM approved_man_power WHERE department_id = @department_id AND fy_id= @fy_id AND vertical_id = @vertical_id
IF isnull(@temp,0) = 0
Do not post your probles in code snippet. Post it as Forum Thread.
SELECT sum(case when isnull(my_table.entry,0) > 0
AND my_table.edate = convert(datetime,substring('2009-09-20',1,10))
THEN 1 else 0 END) AS no_entries_date1,
sum(case when isnull(my_table.entry,0) > 0
AND my_table.edate = convert(datetime,substring('2009-09-21',1,10))
THEN 1 else 0 END) AS no_entries_date2,
sum(case when isnull(my_table.entry,0) > 0
AND my_table.edate = convert(datetime,substring('2009-09-22',1,10))
THEN 1 else 0 END) AS no_entries_date3
FROM my_table
I hope following query will help you
SELECT case when t1.id is null then t2.id else t1.id end id
, case when t1.id is null then t2.value else t1.value end value
FROM db1.table1 t1 FULL OUTER JOIN db2.table2 t2 ON t1.ID=t2.ID
You may continue inserting using following statement
if($_POST[opt_yn1] != 'n'){ $opt = "insert into user_req_opt(rq_id, opt_ref, opt_value) values('".$qid."', '".$_POST[opt_ref1]."', '".$_POST[opt_value1]."')";$result = mysqli_query($mysqli, $opt) OR die (mysqli_error($mysqli));
}
if($_POST[opt_yn2] != 'n'){ $opt = "insert into user_req_opt(rq_id, opt_ref, opt_value) values('".$qid."', '".$_POST[opt_ref2]."', '".$_POST[opt_value2]."')";$result = mysqli_query($mysqli, $opt) OR die (mysqli_error($mysqli));
}
.
.
.
.
.
.
.
I have assumed your post variables. You should change it according to your form.
you may use left, right outer joins to control result as expected.
select t1.col1,t1.col2, t2.col1, t2.col2
from db1.table1 t1
left outer join db2.table2 t2
on t1.CommonColName=t2.CommanColName
You may try follwing complex query. It may slow down performance but its due to the database design.
select id ,count(*) from(SELECT id,name1 name FROM table1 t
union
SELECT id,name2 name FROM table1 t
union
SELECT id,name3 name FROM table1 t
union
SELECT id,name4 name FROM table1 t) a
where name in ('roger','chill','dubs','lee')
group by id
having count(*)=4
order by id;
If you are searching for 2 name you must change 2 things
1) having count(*)=2 //number of names to be searched 1,2,3,4
2) where name in ('roger','chill') // actual names to be searched.
This query assumes that there is no duplication as follows
id, name1, name2, name3, name4
3, roger, mike, roger, lee
query will fail for above case, instead make sure to make name3 as null instead of repeating name.
Following query may not work for %mike%%roger%. Also if there is charlee in the database and if you search for %lee%, then charlee's record will also be listed.
select * from database.tables WHERE ( names like ('%roger%%mike%'));
i m changing your line no 11 of first post, to verify whether tz=usertimezone. check of space and character case in $tz/$usertz. You may also want you use $off variable.
echo ">$tz (TZ={$tz}, USERTZ={$usertz})";
simply echo word selected with space at line no 9 of your code
echo " selected "; //correct
DO NOT ASSIGN ANYTHING
echo 'selected="selected"' //incorrect
YOU Must write follwowing code in delete.php
if($_GET['cmd']=="delete")
{ $sql = "DELETE FROM Cars WHERE Id={$_GET['Id']}";
$result = mysql_query($sql); echo "Row deleted!";
}
JRM You are doing the same thing.
(name1 = 'roger' OR name1='dubs' OR name1='chill' OR name1='lee')
gives you same result as
name1 in ('roger','dubs','chill','lee')