Then you may use code in post no #6 of this thread.
Then you may use code in post no #6 of this thread.
I dont think keeping one table per cell in database is a right approach.
select * from lease_tablen
while loop{}
If you have one table per cell, then this design is very poor.?
Even though you may execute query using two for loops
$rows=find number of year rows for particular user;
$cols=8; //year,due date, date sent etc
for ($rowindex=1;$rowindex<=$rows;$rowindex++)
{
print "<tr>";
for ($colindex=1;$colindex<=$cols;$colindex++)
{
$queryresult="select * from table".$rowindex*$colindex;// this will give appropriate table name for your cell
//execute above query here
print "<td>{$result}</td>";
}
print "</tr>";
}
above code is not syntatically correct.
Are you confused with report query or data structure?
Your query seems to be ok, though I have changed last line. Let me know what result /error are you getting.
$sql = "SELECT s.name,COUNT(a.id),COUNT(r.id) FROM product_items AS i
LEFT JOIN watch_addtocart AS a ON a.id = i.id
LEFT JOIN watch_removefromcart AS r ON r.id = i.id
LEFT JOIN product_styles AS s ON s.id = i.product_style_id
GROUP BY [b]s.name [/b]";
You must keep id column unique at database level. Without checking the duplication at frontend, you must attempt to insert a new row. If id exist in database it will throw an error with error code which you should trace in your code. if error code is for duplicate id then display appropropriate message and allow user to change id.
$result = mysql_query("SELECT name FROM user WHERE month(dob) = '$current_month' AND day(dob) >= '$current_day' ")
your er diagram could be of two types
1) logical: used to understand database conceptually, may not reflect actual no of table in database. for e.g when showing many to many relation we may show only 2 related entities in diagram
2) physical: user to show all table used in database. you can say all sql tables may be mapped to physical er diagram for e.g when showing many to many relation we may show all 3 entities in diagram
You are passing only quantity in value tag of check box. for deleting and inserting you need to have some primary key information in value of checkbox. post[id] array will contain only checked rows. you must set value of checkbox in following manner value = '{$row[0]},$row[4]' . I am assuming row[0] contains primary key of table.
I have given you the foreach loop for updating the table, now you can use same loop for both insertion and deletion. foreach loop will work independtly no need to keep it in while loop
following code should be kept in action page of your form.
$keylist="";
foreach ($_POST['id'] as $tablename_value)
{
$arr=split(",",$tablename_value);
//$arr[0] is primary key $ROW[0]
//$arr[1] is quantity value $ROW[4]
$deletequery="DELETE FROM TABLE1 WHERE PKCOLUMN='{$arr[0]}'";
$insertquery="insert into table2 (pkcol,quantitycol) values('{$arr[0]}','{$arr[1]}')";
}
I assume following code will work for you. Place this code in your action file where you are updating your database.
$keylist="";
foreach ($_POST['cc'] as $key => $value)
{
if($i==0)
$keylist.=$key;
else
$keylist.=",".$key;
$i++;
}
$updquery="update central set checkcolname='Y' where keycolumnname in ($keylist)";
// exeucte_update_query($updquery); use proper syntax
I have some doubt
Exactly what do you want?
Do you have column for checkbox say yes/no or 0/1 in central table ?
If user checks the check box of some row, then submits the form what you want to do?
do you want to reflect check values in database when user open abouve page?
Please clearify.
make the change in your query as hightligted below
$data = "UPDATE inventors SET month='$month',
day='$day', year='$year', [b]date='{$year}-{$month}-{$day}'[/b]
WHERE lastname=".'"'.$lastname.'"';
what is the actual problem, Your query is giving error or giving unexpected result
Following query should work
I m assuming that both table contains year column
select sum(elec.votes)/sum(stat.rating) as percentage
from elec inner join on elec.year=stat.year
where stat.year=2009
Following query will show all trainers, and their Sezona.NogSezona if they have idsezona =3 else it will show null
SELECT Trener.BrTrenerskeIskaznice , ISNULL(Sezona.NogSezona, '')
FROM Trener LEFT JOIN Licenca ON Trener.BrTrenerskeIskaznice = Licenca.BrTrenerskeIskaznice [b]and Licenca.IDSezona=3 [/b]
LEFT JOIN Sezona ON Sezona.IDSezona = Licenca.IDSezona
TRY FOLLOWING QUERY
SELECT ISNULL(Sezona.NogSezona, '')
FROM Trener LEFT JOIN Licenca ON Trener.BrTrenerskeIskaznice = Licenca.BrTrenerskeIskaznice
LEFT JOIN Sezona ON Sezona.IDSezona = Licenca.IDSezona
[B]WHERE[/B] Licenca.IDSezona=3
Please post your table sturcture of both tables. also specify the primary key and foriegin key
I dont know the actual method but I think following may work.
str_replace("code","<span style='your style'>",$yourtext);
str_replace("/code","</span>",$yourtext);
You mus use full tag in your code i.e. \[code\]
You must add hidden field on confimation page
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
Your choice: <input type="radio" name="choice" value="yes"> Yes <input type="radio"
name="choice" value="no" /> No
[B]<input type="hidden" name="mGinNo" id="mGinNo" value="<?php echo $_REQUEST['mGinNo'];?>"> [/B] <button type="submit">Send</button>
</form>
It may happen if second page is refreshed continuously. After inserting you redirect browser to another or first page. Also use cookies.
I think your code has little problem, try following:
<?php
$uidTotal = mysql_connect("localhost", "user", "pass");
mysql_select_db("table", $uidTotal);
[B]$uid=3;[/B]
$result = mysql_query("SELECT * FROM tracking WHERE uid = [B]{$uid}[/B]", $uidTotal);
$a = mysql_num_rows($result);
echo "[B]{$a}[/B] \n";
?>
following query will give ids of product which have invetory column's value as 0 select distinct idproduct where inventory=0 from optionsInventory
follwing query deletes all product records which do not have invertory column value as 0
delete from optionsInventory where idproduct not in (
select distinct idproduct where inventory=0 from optionsInventory)
$dbname = "cvarcher_members";
1) Are you sure about spelling of "varchar"?
2) Have echoed query that is $update variable before executing then exectuted in phpmyadmin sql section?
Do not use dummy resolve actual query by echoing $update before exeuting in php.
It is just sr no for readingindex 1,2,3.... etc
If you are not comfortable with it then you can generate new primary key reading_srno (This will go from 1,2,3......n regardless of readingindex)
fk_readingindex is fk from header table
new design
Reading_dtl(Reading_srno,fk_ReadingIndex, ReadingType, F1, F2, F3)
Primary keys are shown in bold letter
Foreign keys are shown in italics
If I had to design the database I would have done it in following manner.
Project (ProjectId,ProjectName,Status)
1,Project A, Open
Zone(ZoneId,ZoneName,ProjectId,IS_VARIABLE)
1,ZONE A, 1, 0
2,ZONE A, 2, 0
3,ZONE A, 3, 0
4,ZONE A, 4, 1
Reading_hdr(ReadingIndex,date,ZoneId)
1,27-mar-2008,1
2,28-mar-2008,4
Reading_dtl(ReadingIndex, srno, ReadingType, F1, F2, F3)
/* Reading type could be in, out or fix. no extra columns are required
I am assuming database is mysql so you can set enum type.
*/
1,1,fix,23,53,54
2,1,in,30,63,63
2,2,out,30,69,64
This table you can join using join operators, can using case when then statement you can create a crosstab query.
Primary keys are shown in bold letter
Foreign keys are shown in italics