urtrivedi 276 Nearly a Posting Virtuoso

you dont need join, join is applicable if you have fk-pk relation
you try following query

select id, sum(suma), sum(sumb) from
(select id, amount as suma, 0 as sumb from a where id=1
union
select id, 0 suma , amount as sumb from b where id=1
) x group by id
urtrivedi 276 Nearly a Posting Virtuoso

I am not sure about your query, but If you want distinct row, if you add distinct keyword after select keyword you will distinct result
so if you say

select distinct TrayID, TrayID , EVA_ID from tablename

The you will get following result

TrayID| TrayID | EVA_ID
313 | 313 | NULL
852 | 852 | 456-89
759 | 759 | 654-22

urtrivedi 276 Nearly a Posting Virtuoso
<?php
//$datestr = '25-5-2012';
$datestr = '25-MAY-2012';
//$datestr = 'TEMP';

// previous to PHP 5.1.0 you would compare with -1, instead of false
if (($timestamp = strtotime($datestr)) === false) {
    echo "The string ($datestr) is bogus";
} else {
    echo "$datestr == " . date('l dS \o\f F Y h:i:s A', $timestamp);
}
?>

http://php.net/manual/en/function.strtotime.php

urtrivedi 276 Nearly a Posting Virtuoso

I am not sure how you can add page break in plain text file. I think its dependent on software you use to open file like notepad/wordpad/word etc.

urtrivedi 276 Nearly a Posting Virtuoso

1) you can create separate page I mean stages, submit 1 will got to page 2, submit 2 will go to page 3

2) you can do by javascript on same page, but first post what u have done so far.

urtrivedi 276 Nearly a Posting Virtuoso

if recordcount of query is zero then you can give message and exit page

if($row['invoiceno']!=$_GET['ids'])
{
   echo "Permission denied";
   exit;
}
logicaweb commented: Thank you again! You're the no.1! :) +0
urtrivedi 276 Nearly a Posting Virtuoso

is it for live project or it is class assignment?

urtrivedi 276 Nearly a Posting Virtuoso

Does this help

$text="\r\n Your text to write \r\n ".date('d')."-".date('m')."-".date('Y')."\r\n";

urtrivedi 276 Nearly a Posting Virtuoso

IN your sql query to load invoice details, you add one more condition to filter records based on login id.

$query="select * from invoice where invoieno='{$_GET[ids]}' and USERID='{$_SESSION['userid']}'";
logicaweb commented: Solved my problem. +0
urtrivedi 276 Nearly a Posting Virtuoso

line 2 comment it
$keywords =mysql_real_escape_string(htmlentities(trim($_POST['keywords'])));

line 3 add new line
$keywords =$_POST['keywords'];

Line 20 change as follow
echo "$error,</br>";

urtrivedi 276 Nearly a Posting Virtuoso

comment line 2, everything will run proeplry then
//$keywords =mysql_real_escape_string(htmlentities(trim($_POST['keywords'])));

urtrivedi 276 Nearly a Posting Virtuoso

eye cathing is personal issue, you can not please all. just select 2 random colors and get it done.

urtrivedi 276 Nearly a Posting Virtuoso

SELECT * FROM tableA WHERE (b= 'y' or (b<>'y' and a='x') or (a<>'x' and b<>'y' and a = '' AND b = '') )

urtrivedi 276 Nearly a Posting Virtuoso

You have created wrong refrecnes, it shows that username refrences playerweapon, actually it should refer to users, so delete that foreing key from users table and add that key to playerweapon

urtrivedi 276 Nearly a Posting Virtuoso

For such case I have created education master table
edu_id, edu_desc, edu_order,
1, SSC, 1
2, hsc,2
3, PHD, 3

I will create on more table user_eductaion
userid, edu_id (ref to above), marks, percent,year

When you insert userid in your usertable at same time you can insert all multiple records from edu_master to user_education with userid just login, rest columsn will be null.

Now when user clicks on eduction page, he will have list of all 3 education detail
So user will simple modify the record by udpating marsk, percent, year. So your query will update record and not insert when user saves

urtrivedi 276 Nearly a Posting Virtuoso

1) explode is not there in your code so add full code here
2) problem occurs (what is the problem?)
3) give sample urls and what u doing with url

urtrivedi 276 Nearly a Posting Virtuoso

what are you trying to do, and what exactly the error you are getting.

urtrivedi 276 Nearly a Posting Virtuoso

there are some username in playerwepons which does not exist in your users table, so it is not allowing you to add constraint. If you want to add contraint, you have to delete that usernames from weapon table which does not exists in your users table, or add that usernames in user table.

chaning username is not good practise, you can also refer ID column to playerweapons table , then you can join tables by ID to access information.

urtrivedi 276 Nearly a Posting Virtuoso

its done on its own. when you create table when you add coulmn, information scheams is managaged by mysql server. You dont have to worry about it, you just use like the query you are using above

urtrivedi 276 Nearly a Posting Virtuoso

urtivedi, thanks but it isn't a good practice and my store procedure has some other requirements so it doesn't suit that . Thanks anyway
any body else plz ?

How you say that it is not a good practise to call procedure twice or n number of times.

inserting 1 row is one operation and inserting 2 rows are 2 distinct operation

in your code if you have n number of rows to insert you have to call your procedure n number of times.

If you feel stored procedure another requirement in your case, you can direct write insert statement in your code itself in loop. this is normal practise. or you can 2 separte stored proceudre one for inserting record only another for your other requirement.

urtrivedi 276 Nearly a Posting Virtuoso

but what do u mean by multiple insert then,

urtrivedi 276 Nearly a Posting Virtuoso

call exec multile times

urtrivedi 276 Nearly a Posting Virtuoso

I had same issue, to avoid recursion i stored all paraent level relation in another table called item_level like for
child_id, parent_id, level
4, 4, 0 (self record at level 0)
4, 1, 1 (first parent that is women for wtshrit at level 1)
4, 0, 2 (second parent (grand father) that is dress for wtshrit at level 2)

same you have to add all upper parents for all ids in your main table

so whenver record is inserted in main table you can insert multiple parent records in level table like abvoe

then you can write join query to sum up things main table to level table

urtrivedi 276 Nearly a Posting Virtuoso

same query works here fine

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

what is the problem? whats happening? or what not happening?

urtrivedi 276 Nearly a Posting Virtuoso

Actully your query works fine here, but still I have did with different way in the link, I hope this links helps you http://urtrivedi.0fees.net/reservation.html

urtrivedi 276 Nearly a Posting Virtuoso

I just checking reply work or not , sorry for this post

urtrivedi 276 Nearly a Posting Virtuoso

1) User can do coding in any langauage or only one?
2) you want to compile code online?

urtrivedi 276 Nearly a Posting Virtuoso

change line 34-37 to

$tresult=mysql_query($tquery) or die(mysql_error());
?>
<table>
<?
While($trow=mysql_fetch_assoc($tresult) { ?>

I have added $tresult in paramenter, do not use $result again

urtrivedi 276 Nearly a Posting Virtuoso

You are depending on the data entered in text area.
This is poor design. If any how you solve your current problem, big unsolvable problems are waiting for you in future

urtrivedi 276 Nearly a Posting Virtuoso

In your code above
I have changed line number 36.
I have commented 80-86 lines.

<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
<?php 
include "../../db.php";
?>
<?php
error_reporting(0);
//Rows
$imgRow = '<tr>';
$idRow = '<tr>';

$nn=10; //Number of items, we split this later

$s=mysql_query("SELECT * FROM `products`");

$c=mysql_num_rows($s);

if($c%$nn==0){
    $cc=$c/$nn; 
}else{
    $cc=$c/$nn+1;   
}

//$cc : Number of pages

$ss=@$_REQUEST['ss']; //Start position (eg: 6)
$other_tables = "";

if($ss=="" || $ss==null){
    $ss = 0; //Set to zero because it is incremented later
}

//Pages
echo "<table border=\"0\" align=\"center\" style=\"text-align:center;\">";
$sql=mysql_query("SELECT * FROM `products` ORDER BY `id` DESC ");
$inc = 0;
while($r=mysql_fetch_array($sql)){
    $key=$r['id'];
    $id=$r['name'];  
    $img=$r['pic1'];
    if($inc == 0){
        $imgRow .= "<tr>";
        $idRow .= "<tr>";
    }
    $imgRow .= "<td title=\"مشاهده جزئیات محصول\"><a href=\"showproducts1-details.php?id=$key\" target=\"_self\" ><img src=\"../admin/products/productimages1/$img\" width=\"139\" height=\"122\" border=\"1\" /></a></td>";
    $idRow .= "<td><a href=\"showproducts1-details.php?id=$key\">$id</a></td>";
    ++$inc;
    if($inc == 5 || $inc == 12 || $inc == mysql_num_rows($sql)){
        //Display Table
        echo $imgRow."</tr>";
        echo $idRow."</tr>";
        echo "</table>";
        echo "<br>";echo "<br>";echo "<br>";
        //To remove extra table
        if(mysql_num_rows($sql) <= 5){
            $inc = 11;
        }

        //Reset
        if($inc == 5){
            echo "<table border=\"0\" align=\"center\" style=\"text-align:center;\">";
            $imgRow = "<tr>";
            $idRow = "<tr>";
        }
    }
}
echo "</table>";
echo "<br>";
?>  </td>
  </tr>
</table>

<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
<?php
$j=0;
echo"تعداد صفحات : ";
/*
for($i=1;$i<=$cc;$i++){
    echo"<a href=\"showproducts1-1.php?ss=$j\">$i</a>";
    echo"|";
    $j=$j+$nn; 
}*/
?>
</td>
  </tr>
</table>
urtrivedi 276 Nearly a Posting Virtuoso

1) semicolor at the end is not needed

or

$tquery="SELECT questions.id,questions.date,questions.title,users.user_name,subjects.subject FROM questions INNER JOIN users ON questions.student_id=users.id INNER JOIN topics ON questions.topic_id=topics.id INNER JOIN subjects ON topics.subject_id=subjects.id WHERE subjects.id=".$_SESSION['sub1']." OR subjects.id=".$_SESSION['sub2'].";"; 

echo $tquery;

2)
a you can echo query before mysql_query,

b run script in browser,
c you will find prepared query on browser output
d copy the output query
e open phpmyadmin or any other interface for mysql
f run that copied prepared query and see query give result or not, otherwise make changes accordingly

urtrivedi 276 Nearly a Posting Virtuoso

1) you must have one primary key in records table
2) that primary key must be referred in upload table
3) on upload page you can check (count) number of files uploaded for id , it its 2, then do not allow more uploads, if its less then 2 than allow to upload

urtrivedi 276 Nearly a Posting Virtuoso

what error does it return (may be you can see error number also)

Here query runs perfectly

urtrivedi 276 Nearly a Posting Virtuoso

If you want to access remote database that is not in your control or your office, they remote owner must give some API access with manuals, so that you know what to pass and how to retrived infomation from that server.

urtrivedi 276 Nearly a Posting Virtuoso

The only thing you have to be aware of is concurrent users. If there are only a few places left and you're half way through a booking, it would be an amazing shame if when you get to the 'confirm' button, that it tells you 'tough luck' as somebody half way across the world was a millisecond quicker than you.

There are ways to deal with this, but you'll need to research it.

Yes if 2 persons get same seat then one have to travel by sitting on anothers lap

urtrivedi 276 Nearly a Posting Virtuoso

Usually in you computer if firewall is installed. You have to allow http port to other users in network.

Like in windows you can manage firewall from control panel.

urtrivedi 276 Nearly a Posting Virtuoso

Following way you can refer third record (index=2).

echo "Third person: ".$data[2]['FirstName']." ".$data[2]['LastName']."-".$data[2]['Amount'];
urtrivedi 276 Nearly a Posting Virtuoso

Its nothing but request/response game.

If you note in case of flight. In the brouwser, in his/her pc, user chose flight, class, date of travel, then u press submit
Now that submitted parameters are send to page on the server
so server use this parameters to query database that how much seats avaialble for that particular day for that flight.

Now server sends response back to the user to his/her browser with the status.

If you book ticket same flight, date, class is updated by one seat in database. so next request will get 1 less seat now.

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

http://stackoverflow.com/questions/220767/auto-refreshing-div-with-jquery
This is sample code.
You need to include jquery in your scirpt than you can follow above link

another example

http://www.9lessons.info/2009/07/auto-load-refresh-every-10-seconds-with.html

urtrivedi 276 Nearly a Posting Virtuoso

what exactly you want to extract?

urtrivedi 276 Nearly a Posting Virtuoso

u said u have ajax, so you can make ajax call (which calls php file) and update div at every 5 seconds

urtrivedi 276 Nearly a Posting Virtuoso

you can use javascript timer functions
http://www.w3schools.com/js/js_timing.asp

urtrivedi 276 Nearly a Posting Virtuoso

php wrox

urtrivedi 276 Nearly a Posting Virtuoso

reading books
practising exampels given in books
read whole book with practise
and start small assinment projects

urtrivedi 276 Nearly a Posting Virtuoso

curl is another way of doing

urtrivedi 276 Nearly a Posting Virtuoso

very strange

urtrivedi 276 Nearly a Posting Virtuoso

You are missing ON keyword after inner join subjects

SELECT questions.id,questions.date,questions.title,users.user_name,subjects.subject FROM questions INNER JOIN topics ON questions.topic_id=topics.id INNER JOIN subjects ON topics.subject_id=subjects.id INNER JOIN users ON subjects.id=users.sub1 OR subjects.id=users.sub2 WHERE users.id=8;