urtrivedi 276 Nearly a Posting Virtuoso

We do same in our enviroment. Following is our case
1) out of 100% tables in database, we need just 20% tables to show on website.5% are to be updated back to oracle.
2) We create similar data tables in mysql.
3) we set up cron job in php script (on web interface) (1 script per table). this script connect to both mysql and oracle
3a) small tables are delete completely and all records are updated from oracle to mysql
3b) large tables are checked for update or insert and only those records are updated or inserted to mysql
3c) same way some table are updated from web and oracle depending on last update

4) we schedule all cron script to run at night (once in 24 hours)
5) at last we run one more php script which compares number of records in both databases, if any mismatch found in any table mail is sent to administrator.

urtrivedi 276 Nearly a Posting Virtuoso

you need to learn embeeding php code with html to show dynamic data.

what u mean by google database?

urtrivedi 276 Nearly a Posting Virtuoso

enum needs values to be passed

urtrivedi 276 Nearly a Posting Virtuoso

You need to use parsetFloat function everywhere
http://www.w3schools.com/jsref/jsref_parsefloat.asp

nValue12 = paserFloat(document.getElementById("noofnights6").value);
       nValue13 = parseInt(document.getElementById("rate6").value);
urtrivedi 276 Nearly a Posting Virtuoso

u want to insert or select?

urtrivedi 276 Nearly a Posting Virtuoso

Though once you update data, any new request to your page will present current data only

But somebody is monitoring page, then need to refresh the result section automatically.

For that jquery request can be sent very few mintes say, 5 mintes. You can set timer function in your page which will send request to server every five minutes and updates the result section of your page. And json is good format to send/read

urtrivedi 276 Nearly a Posting Virtuoso

In the begning of your page add 2 lines, It will show error if any

error_reporting(E_ALL); 
ini_set("display_errors", 1); 
urtrivedi 276 Nearly a Posting Virtuoso
window.setTimeout(hello,3000);
function hello(){
    alert("ju");
}

Call back function can not be called , what u have written with () is calling function.

Just pass name of function.

urtrivedi 276 Nearly a Posting Virtuoso
function validate(form, minlength, maxlength) 
{
    var userInput = form.elements[0].value

    if(userInput.length >= minlength && userInput.length <= maxlength)
    {
        return true;
    }
    else
    {
        alert("Please input between " + minlength + " and " + maxlength + " characters");
        return false;
    }
} <-- this is missing
urtrivedi 276 Nearly a Posting Virtuoso

yoru query is fine for that purpose, so what your query do not show or what wrong it shows?

urtrivedi 276 Nearly a Posting Virtuoso

what is ur target, what u want to achive

urtrivedi 276 Nearly a Posting Virtuoso

union will merge 2 result in one, if common rows showed only once

urtrivedi 276 Nearly a Posting Virtuoso
SELECT * FROM `Cater Gid` where Cater like '%$term' UNION SELECT * FROM `Cater Food` where Cater like '%$term'

you forgot single qute near like word on right side

urtrivedi 276 Nearly a Posting Virtuoso

remove quotes around

urtrivedi 276 Nearly a Posting Virtuoso

i dont think so, on web devlpment link on top
if you click it,
then there is blue button lauch chat room.

I guess, its allowd for all users.

but your query is having problem,
copy it from queto to quote, and run it in phpmyadmin,

see error and solve that mysql error first

urtrivedi 276 Nearly a Posting Virtuoso

u can chat on web development room, i m there if u wish

urtrivedi 276 Nearly a Posting Virtuoso

what error it gives?

urtrivedi 276 Nearly a Posting Virtuoso

can u paste sturcture of both table here

urtrivedi 276 Nearly a Posting Virtuoso

cater gid and cater food, must have same number of columsn and of same data type.
If it is not the case
then select column name properly in both queries

urtrivedi 276 Nearly a Posting Virtuoso
 $sql = mysql_query("SELECT * FROM `Cater Gid` where Cater like '%$term UNION SELECT * FROM `Cater Food` where Cater like '%$term")  ;
urtrivedi 276 Nearly a Posting Virtuoso

create 2 dimentional array

$ar[0][0]='Driver`s seat';
$ar[0][1]='';
$ar[0][2]='';
$ar[0][3]='';
$ar[0][4]='';

$ar[1][0]='1';
$ar[1][1]='2';
$ar[1][2]='';
$ar[1][3]='3';
$ar[1][4]='4';

$totrows=count($ar);
echo "<table>";
for ($i=0;$i<$totrows;$i++)
{
    echo "<tr>";
    for($j=0;$j<5;$j++)
        echo "<td>".$ar[$i][$j]."</td>";
    echo "</tr>";
}
echo "</table>";
urtrivedi 276 Nearly a Posting Virtuoso

on refresh post data will remain same and even not empty, because on refresh same data will be resubmitted,

One solution is to use cookie.

See my previous reply to this thread

http://www.daniweb.com/web-development/php/threads/455250/upon-loading-form-autosubmits-empty-fields-to-database#post1978017

urtrivedi 276 Nearly a Posting Virtuoso

Such things happens in self submitting page.
I used cookies to solve this kind of problem.
for example when user clicks save before submitting set one cookie say "saveinfo" to 1 , using javascript,

Now along with isset using php $_COOKIE['saveinfo'] ==1,

in the end of page using javascript again to set saveinfo to 0,

urtrivedi 276 Nearly a Posting Virtuoso

in begining of index.php, you may add this 2 line and run your page, you may able to see any error if it is there.

error_reporting(E_ALL); 
ini_set("display_errors", 1); 
urtrivedi 276 Nearly a Posting Virtuoso

change line 69 in your first post

from

 `post_date` AS `date`

 to 


 DATE_FORMAT(`post_date`, '%a., %b %D, %Y %l: %i %p') AS `post_date`
urtrivedi 276 Nearly a Posting Virtuoso
select 
        tbl_centre.centre_id,
                    tbl_centre.centre_no,
                    tbl_centre.centre_name,
                    tbl_region.region,
                    tbl_net.qualification,
                    sum(CASE WHEN tbl_net.qualification=0 THEN 1 ELSE 0 END ) QUALS, 
                    sum(CASE WHEN tbl_net.qualification=1 THEN 1 ELSE 0 END ) AWARDS, 

    from
        tbl_centre

    left join
        tbl_net_centre ON tbl_centre.centre_id = tbl_net_centre.centre_id

    left join
        tbl_net ON tbl_net_centre.ntwrk_cd = tbl_net.network_code

   left join
                    tbl_region ON tbl_centre.region_code = tbl_region.region_ID

    where
                    tbl_centre.reg_status = 'R'
    and
                    tbl_net_centre.net_reg_stts in ('R','P')
    and
                    tbl_region.region_ID ='3'


    group by tbl_centre.centre_id

    HAVING IFNULL(sum(CASE WHEN tbl_net.qualification=0 THEN 1 ELSE 0 END ),0) >0 AND 
                    IFNULL(Sum(CASE WHEN tbl_net.qualification=1 THEN 1 ELSE 0 END ),0) > 0 
    limit 1000;
urtrivedi 276 Nearly a Posting Virtuoso

out of all this code (in your first post here), also post code which you use to call all that functions, and which pariticular function gives you date in default format.

urtrivedi 276 Nearly a Posting Virtuoso

give your sample data also for some records, so that we can understand what data your columns hold,

urtrivedi 276 Nearly a Posting Virtuoso
<?php 
$pass="80"; //this you can pass from html form to the query

$query="select sum(case when percentagescore>='$pass' then 1 else 0 end ) / count(*)*100 pass_percent,
               sum(case when percentagescore<'$pass' then 1 else 0 end ) / count(*)*100 fail_percent
        from tablename";

?>
urtrivedi 276 Nearly a Posting Virtuoso

There are others problems in your, first you can not use "return" as name of any html item, its gives error
second you dont have any bottles html anywhere, so in price function I commented first 3 lines to test my code.

function Price(data) {

//document.getElementById("productprice").value = data.options[data.selectedIndex].id;

//newValue = (parseInt(document.form.bottles.value) * parseInt(document.form.price.value)); 
//document.form.total.value = newValue;

var w = document.getElementById("product").selectedIndex;
var str=document.getElementById("product").options[w].text;

var n=str.split(":");

document.form.quantity.value = n[1];
}
urtrivedi 276 Nearly a Posting Virtuoso

Actually I wanted your html code ,
you run ur page, then right click, view source, copy that source and paste it here

urtrivedi 276 Nearly a Posting Virtuoso
    function Price(data) {

    document.getElementById("productprice").value = data.options[data.selectedIndex].id;

    newValue = (parseInt(document.form.bottles.value) * parseInt(document.form.price.value)); 
    document.form.total.value = newValue;

    var w = document.getElementById("product").selectedIndex;
    var str=document.getElementById("product").options[w].text;

    var n=str.split(":");

    document.form.quantity.value = n[1];
    }
urtrivedi 276 Nearly a Posting Virtuoso

send me html code

urtrivedi 276 Nearly a Posting Virtuoso

You posted in php, so I replied php code, and the code you have written is in javascript. Now Following is the javascript code.

    function Price(data) {

    document.getElementById("productprice").value = data.options[data.selectedIndex].id;

    newValue = (parseInt(document.form.bottles.value) * parseInt(document.form.price.value)); 
    document.form.total.value = newValue;

    var str=document.getElementById("product").innerHTML;
    var n=str.split(":");

    document.form.quantity.value = n[1];
    }
urtrivedi 276 Nearly a Posting Virtuoso

I used 2 tables for solving this problem in past. Table pair gives unlimited categories or not categories at all. This is same as directory structure in your computer.
1) product_master (prod_id, prod_name, is_group, other_columns)
2) product_level (child_prod_id, parent_prod_id, level_no)

product_master
prod_id, prod_name, is_group, other_columns
0, Items, Y, XYZ (This is root group)
1, Pen, Y, xyz1 (This is sub group)
2, Black pen, N, PQR (This is first item of first group)
3, Red Pen, N, QBC (This is second item of first group)
4, HB Pencil, N, NCR (This is direct item under primary "Items" group)

Product_level (This is to keep track of categories and items properly)
child_prod_id, parent_prod_id, level_no
0,0,0 (root under self at level 0)
1,1,0 (first group under itself at level 0)
1,0,1 (first gropu under items at level 1
2,2,0 (first item under itself at level 0)
2,1,1 (first item under first gropu at level 1)
2,0,2 (first item under "items" at level 2)
3,3,0 (second item under itself at level 0)
3,1,1 (second item under first gropu at level 1)
3,0,2 (second item under "items" at level 2)
4,4,0 (third item under "items" at level 2)
4,0,1 (third item under "items" at level 1)

urtrivedi 276 Nearly a Posting Virtuoso

I assume that ur string have only one colon, and next to colon is the text u need to find

$fullstr="   5 gallon qty: 10";
$strarr=explode(":",$fullstr)
echo "qty=".trim($strarr(1));
urtrivedi 276 Nearly a Posting Virtuoso
.
.
.
.
if(checkEmail($dbemail))
{
    $resultsbla = $DBH->prepare("insert INTO lime_tokens_262697 (firstname, lastname, email, attribute_1, emailstatus) VALUES ('$dbemail', '$dbemail', '$dbemail', '$dbunikid', 'OK')");
    $resultsbla->execute();
 }
 .
 .
 .
urtrivedi 276 Nearly a Posting Virtuoso
function  checkEmail($email) 
{
     if (!preg_match("/^([a-zA-Z0-9\._-])+([a-zA-Z0-9\._-] )*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/" , $email)) 
     {

          return false;
     }
     return true;
}

 $dbemail="abc.com";
 if(checkEmail($dbemail))
 {
    echo "ok";
 }
 else
 {
   echo "invalid email";
 }
urtrivedi 276 Nearly a Posting Virtuoso

I changed you line number 8 in your code and I added last line in ur orderconfirm function

    $cart = $_SESSION['cart'];
    $items = explode(',',$cart);
    $result = count($items);
    $total_list='';
    for ($i=0; $i<$result; $i++)
    {
        //echo $items[$i];
        $total_list=$total_list."<br>".orderconfirm($items[$i]); //URTRIVEDI MODIFIED THIS LINE
    }

    function orderconfirm($productid)
    {
        $cus_id = $_SESSION['own_email'];
        $pro_id = $productid;
        $result = mysql_query("SELECT * FROM products where id = '$pro_id'");
        if($row = mysql_fetch_array($result))
        {
        $subject = $row['Subjects'];
        $main_proname = $row['mainproduct']; 
        $proname = $row['p_name'];  
        $prodetail = $row['details'];   
        $proprince = $row['prince'];
        }
        $holder = $_POST['holder'];
        $bank = $_POST['bank'];
        $branch = $_POST['branch'];
        $ac_no = $_POST['ac_no'];
        $cheqdate = $_POST['cheqdate'];
        $cheq_no = $_POST['cheq_no'];
        $total_amount = $_POST['tota_amount'];

        $total_list = $proname.'-'.$main_proname.'-'.$proprince.'<br />';

    /*  $qry = "INSERT INTO `sales_data`(`cust_id` , `subject` , `pro_id` , `mainproduct` , `pro_name` , `prince` , `bank` , `cheque_no` , `holder_name` , `branch` , `ac_no` , `cheqdate` , `paid` )
         VALUES ('$cus_id', '$subject', '$pro_id', '$main_proname', '$proname', '$proprince', '$bank', '$cheq_no', '$holder', '$branch', '$ac_no', '$cheqdate', 'no')";

        echo $qry; 



        $coloer1 = '';
        if (!mysql_query($qry))
          {
          die('Error: ' . mysql_error());
          } */
        return $total_list; //URTRIVEDI ADDED THIS LINE
    }
    echo $total_list;


    //unset($_SESSION['cart']);
    //$_SESSION['cart']=='';
    //echo "1 record added";
    //header("Location: thankyou.php");
        //exit();
    ?>
urtrivedi 276 Nearly a Posting Virtuoso

are u sure u going to put some $row value in this javascript?, if not, then just keep this script out of php, becasue if u keep it in loop, the script will generate number of times the records are in ur query.

or use something like,
title="<?php echo $row['somevalue']; ?>";

urtrivedi 276 Nearly a Posting Virtuoso

i dont find error in ur code, its compiles well

urtrivedi 276 Nearly a Posting Virtuoso

just need whole code otherwsie cant find error

urtrivedi 276 Nearly a Posting Virtuoso

post complete code, $row is not used anywhere in your code,
so better you write php code where needed,
dont include all static html code in php echo.

urtrivedi 276 Nearly a Posting Virtuoso

abzy, you saying so many times in your post that you dont understand basket ball, before designing ERD you need to learn all things (rules,scoring method,people involved) about basketball, otherwise your ERD will surely go wrong, if you build it on scattered tips received here.

urtrivedi 276 Nearly a Posting Virtuoso
urtrivedi 276 Nearly a Posting Virtuoso

I just looked at your latest post thought thats whats you are working on.

But your original query is fine, you just enquote your e-mail (as you are using hyphen in col name) column with ` (back quote, first key in keyboard, above tab)

$q = mysql_query("INSERT INTO kontakte (`emri`, `mbiemri`,`e-mail`,`nr`, `adresa`, `shenime`) VALUES('{$_POST['emri']}','{$_POST['mbiemri']}','{$_POST['email']}','{$_POST['nr']}','{$_POST['adresa']}','{$_POST['shenime']}')");
urtrivedi 276 Nearly a Posting Virtuoso

I have lines changed 5 to 15 in above code, you can not write if in string formation.
remove all your 5 - 15 lines and only add following line.

$q = mysql_query("INSERT INTO kontakte (emri, mbiemri,e-mail,nr,adresa,shenime) VALUES('{$_POST['emri']}','{$_POST['mbiemri']}','{$_POST['email']}','{$_POST['nr']}','{$_POST['adresa']}','{$_POST['shenime']}')");
urtrivedi 276 Nearly a Posting Virtuoso

You way is not proper to achieve your aim.

Use any of the following 2 ways

Way 1

<?php
$bd=array('1'=>'420','2'=>'520'); 
echo $bd[1]."<br>"; 
echo $bd[2]; 

?>

Way 2

<?php
$bd[1]=420;
$bd[2]=520;

echo $bd[1]."<br>";  
echo $bd[2]; 

?>
urtrivedi 276 Nearly a Posting Virtuoso

Try with double quotes, use statement given below, Php string is in double quote and html element values are in single quote

echo("<embed src='flash/" . rand(1, 5) . ".swf' type='application/x-shockwave-flash' width='320' height='240'></embed>");
urtrivedi 276 Nearly a Posting Virtuoso

can you put sample data from table a and b