user brace around order by phrase
$enamn = mysql_query("SELECT * FROM contacts ORDER BY {$_GET['orderbycol']} ");
user brace around order by phrase
$enamn = mysql_query("SELECT * FROM contacts ORDER BY {$_GET['orderbycol']} ");
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>";
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
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
update tablename set col1='newvalue' where col2='my condition'
<?php
echo "<a href=hotel-map.php?id=$pid><img src='myimage.jpg' width='100px' height='75px'></a>";
?>
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.
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')
SELECT * FROM rounds WHERE `round`=`current_round`-1
You may use union to combine multiple tables. also Post your table structure.
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'
following query will show 100 records and start from record no 20
select * from table1 a where mycol='mycondition' limit 20, 100
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
use explode function and break your string into array
<input name="hiddenfield" type=hidden value='somevalue'>
User will not able to view the field but still it will be posted along with other form elements.
in your index.php, change line no 14, pass connection resource and then try.
$rs=mysql_query($query, $con);
for page authentication I use to do following steps
1) When user loggs in I store permitted page names from database for the user in a session arrary
2) In every page I call permission.php file, which checks requested page ($_SERVER ) is there in page session array set in step 1.
You need to write following code in "BookingForm.php" page. Remove this code from your registration page. Becuase when registration page is opened nothting is posted to it, so blank row is inserted.
<?php
$con = mysql_connect("localhost","root","password");
if (!$con)
{
die('Could not connect: ' . mysql_error()); }
mysql_select_db("ambos", $con); mysql_query("INSERT INTO customer (ic_no, name, address, tel_no, email)VALUES ('$_POST[ic_no]', '$_POST[name]', '$_POST[address]','$_POST[tel_no]','$_POST[email]')");
mysql_close($con);
?>
1) You type here the expected output of query instead of giving only problem statementl.
2) Where are your product1.... product6 table structures?
3) what difference/similarities/relation between user and client table?
select sum(sub_amt) total_due from (
select sum(amount) sub_amt from product1 where date is null
union
select sum(amount) sub_amt from product2 where date is null
union
select sum(amount) sub_amt from product3 where date is null
union
select sum(amount) sub_amt from product4 where date is null
union
select sum(amount) sub_amt from product5 where date is null
union
select sum(amount) sub_amt from product6 where date is null
) a
insert into desttable (idcol,col2,col3) select idcol+100, col2, col3 from sourcetable
SELECT f.forumname,f.forumdesc,count(*) as total_topics from Forum as f
INNER JOIN Topic as t WHERE f.forumid = t.forumid
group by f.forumname,f.forumdesc;
there is no limit on joining same table again.
SELECT Brochure.*, Leaders.Name, la.name as asst_name FROM Brochure LEFT JOIN Leaders ON Brochure.Leader=Leaders.ID
left outer join leaders as LA on Brochure.Leader_asst=La.ID
WHERE Brochure='2010 spring' AND Activity='biking' ORDER BY Date_Full
You upload your sql file of two table with sample data. and post here sample expected output from that data, then I am able to help you.
use $_SERVER variable to find which page was referred by user before login. In login page above variable will contain the page name from which login is called. so after successfull login check, transfer to url in above variable.
Have you got the expected result?
set auto index for your new table using following query
ALTER TABLE tbl AUTO_INCREMENT = 100;
Select * from lease_north a
inner join lims_payment b on a.siteid=b.siteid
WHERE a.LaStartDate like '%-04-%' and b.pdate like '%-03-%'
which field(s) is link between the two table, and what is the cardinality one-many or many to one between these tables.
Without gateway.
You need to configure hardware with your server. buy sms package and then write a code to send sms.
Following code will give you exactly the required output i.e.
1 4 7
2 5 8
3 6
1) First create blank HTML table by finding rows and colmns, define id of each table cell
2) At the end of page using php/javascript write data into appropriate table cell.
<?php
$query = "select state_id,state_name from statemaster a ";
$result_array =execute(query);;
//you must use proper syntax to bring data in $result_array
?>
<html>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5"></td>
</tr>
<?php
$count=count($result_array); //no of rows in table
$noofcols=5
$rows=ceil($count/$noofcols); //no of columns you want to break here it is 5
$i=0;
for($k=0;$k<$rows;$k++)
{
?>
<tr>
<?php
for($j=0;$j<$noofcols;$j++)
{
?>
<td valign="top" id='cell<?php echo $k.$j?>'> </td>
<?php
$i++;
}
?>
</tr>
<?php
}
?>
</table>
</body>
<?php
$index=0;
echo "\n<script lang='javascript'>";
for ($i=0;$i<$noofcols;$i++)
{
for ($j=0;$j<$rows;$j++)
{
echo "\ndocument.getElementById('cell{$j}{$i}').innerHTML='<a href=\"referecne_page.php?stateid={$result_array[$i]['state_id']}\" class=\"links\">{$result_array[$i]['state_name']}</a>';";
$index++;
}
}
echo "\n</script>";
?>
</html>
I am not exploding $one and using our own code with minor changes. I am only changing condition and echoing only selected instead of selected="selected"
<body>
<select name="city[]" size=5 multiple="multiple">
<option value="pune"<?php if (substr_count($one, 'pune') > 0 )
{
echo
'selected';
} ?>>pune</option>
<option value="mumbai"<?php if (substr_count($one, 'mumbai') > 0) { echo
'selected'; } ?>>mumbai</option>
<option value="nasik"<?php if (substr_count($one, 'nasik') > 0) { echo
'selected' ;} ?>>nasik</option>
<option value="surat"<?php if (substr_count($one, 'surat') > 0) { echo
'selected'; } ?>>surat</option>
<option value="dhule"<?php if (substr_count($one, 'dhule') > 0) { echo
'selected'; } ?>>dhule</option>
</select>
</body>
Below code will display you data in following way
1 2 3 4 5
6 7 8 9 10
......
<?php
$query = "select state_id,state_name from statemaster a ";
$result_array =execute(query);;
//you must use proper syntax to bring data in $result_array
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5"></td>
</tr>
<?php
$count=count($result_array); //no of rows in table
$noofcols=5
$rows=ceil($count/$noofcols); //no of columns you want to break here it is 5
$i=0;
for($k=0;$k<$rows;$k++)
{
?>
<tr>
<?php
for($j=0;$j<$noofcols;$j++)
{
?>
<td valign="top">
<a href="referecne_page.php?stateid=<?php echo $result_array[$i]['state_id'];?>" class="links"><?php echo $result_array[$i]['state_name'];?></a>
</td>
<?php
$i++;
}
?>
</tr>
<?php
}
?>
</table>
use date_format() function in your sql query
$query="select date_format(startdate, '%d/%m/%Y') as startdate, col1,col2,col2 from mytable where col1='mycondition'";
It will always post what ever is on your form. So you must check whether value>0 then add that item is value is 0 or null then ignore that item.
Following code may help you
<html>
<body>
<form>
<!-- copy following php code at the place where you are populating your list box-->
<?php
/*
set $mywholearray from database
this array contains all master values to be shown in listbox
$mywholearray[0]['id']='pkvalue',
$mywholearray[0]['desc']='description',
*/
/*set $myselarray from database
this array contains only those values which are selected and stored in database
$myselarray[0]['id']='pkvalue'
*/
$elementstring ="\n<SELECT id='listbox' size=10 name='listbox' multiple>";
for ($i=0;$i<count($mywholearray);$i++)
{
$seltext="";
for($j=0;$j<count($myselarray);$j++)
{
if ($mywholearray[$i]['id']==$myselarray[$j])
{
$seltext=" selected ";
break;
}
}
$elementstring .= "\n";
$elementstring .= "<OPTION value='{$mywholearray[$i]['id']}' {$seltext}>";
$elementstring .="{$mywholearray[$i]['desc']}</OPTION>";
}
$elementstring .="\n</SELECT>";
echo $elementstring;
?>
</form>
</body>
</html>
There is no straight forward way of entereing multiple table entry in one single page. It requires lot of javascript and php coding to achive such thing.
For photograph, You can keep one photo_filename column in family table. where you should allow user to upload photo file. and save its name in the above column.
You should go two separate pages one for family and another for member.
Writing or explaining whole code will be difficult, better you search some php form tutorial and If you find any problem you may post that particular problem here.
If you want to synchronize two database on separte server then
you need to write some code which will read and update data on another server
OR
if you just want to keep backup of database on difference location then
below is the one way of doing it.
1) You can take backup using mysql command on your database server which will take backup of your database in sql file or any format you prefer.
2) Set default folder for db backup file.
3) you may schedule this command to execute daily.
4) Now through ftp you may download that file everyday from another server or pc
5) You may also write ftp access code using .net to download that file from database server to you another server/pc.
Family Master (all common details will come under this table)
family_id,
fam_address,
fam_city,
fam_phone)
Member_master (all member related details along with family id will come under this table)
member_id
family_id ( foreign key from above table)
member_name
member_birthdate
Following query will help you. Here I assume that you have whole data string in "mytable" in column "data". Also I assume that same table contains all other 5 column. For column 1 index is -5, for 2 index is -4 and so on.
update table mytable
set
category=substr(substring_index(data,'>',-5),1,instr(substring_index(data,'>',-5),';')-1),
nav=substr(substring_index(data,'>',-4),1,instr(substring_index(data,'>',-4),';')-1),
rprice=substr(substring_index(data,'>',-3),1,instr(substring_index(data,'>',-3),';')-1),
sprice=substr(substring_index(data,'>',-2),1,instr(substring_index(data,'>',-2),';')-1),
date=substr(substring_index(data,'>',-1),1,instr(substring_index(data,'>',-1),';')-1)
You use my code, It is correct version.
You simply remove form1.focus(); line from your function. You can not focus on any form.
try following code in your validation function
else if(form1.date5.value=='0000-00-00')
{
alert('Select the Start Date');
form1.focus();
return false;
}
there is problem in line 28
$postPassword = $_POST["postPassword"];
change it to
$postPassword = $_POST["postPass"];
following code will return age in days for each user
SELECT username,datediff( current_date( ) , birthdate )
FROM datatable
You must write your php password verification code at the end of page.
Your div tag is rendered at the end of your code. So if you want to set innerhtml in div tag, you must do it after div is rendered on the browser.
...
.
.
</body>
</html>
<?php
if($isSubmitted == "yes") { if($postUser == "admin" && $postPassword == "pass") { corrLogin(); } else { incorrLogin(); } }
?>
You need to do it manually i dont think mysql will do it automatically
First you may determine the max no using following query and then you may use it while inserting a new record
//determine id
//$id=SELECT max(substr(rollno,2))+1 FROM `alumni_job`;
$id='c'.$id;
insert into table (comp_id,name) values ('$id','$name');
try
$filter = $_REQUEST['att'];