Jump to content

Dharmender

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by Dharmender

  1. Try This $query = mysql_query("INSERT INTO store_data (network_ID, store_name, store_num, store_type) VALUES ($network_ID, '$store_name', $store_num, '$store_type')"); The column values with varchar types should be in single quotes
  2. I want to create listbox with checkboxes in PHP. The data is comming from Mysql table Table is supplierinfo with id and name. Mysql Query is "select id,name from supplierinfo" I want to have id as option value and name as text. The listbox wtih multiple select option will have checkboxes with options just like Treeview with Checkboxes. PHP code is <select name="info[]" multiple> <option value=$id>$name</option> </select>
  3. Try This <?php session_start(); /*this is for making payment by user*/ if(isset($_SESSION['sname']) && isset($_SESSION['spassword']) && isset($_SESSION['saccount_type'])) { $conn=mysql_connect("localhost","root",""); if(!$conn) { die("Cannot connect:".mysql_error()); } mysql_select_db("bank_acount"); $query="select * from account"; $result=mysql_query($query); if(!$result) { die(mysql_error();} $num=mysql_num_rows($result); echo($num); ?> Echo whatever you want.
  4. Try like this $conn = mysql_connect( $serverName, $uid,$pwd); if (!$conn) { die('Could not connect: ' . mysql_error()); } $select=mysql_select_db($databasename,$conn); if(!$select) { die('could not select db'.mysql_error()); }
  5. Thanks for the help. I have resolved it by using the below query in PHP $sql="select a.date,(select itemname from items where itemid=a.itemid) as item,a.quantity,a.rate,a.fat,a.amount from purchasedetails a where a.supplierid=".$supname." and (str_to_date(a.date,'%d-%m-%Y') between str_to_date('".$fromdate."','%d-%m-%Y') and str_to_date('".$todate."','%d-%m-%Y'))";
  6. I have echoed the variable it returns the value of variables correctly
  7. The Mysql query in PHP gives 0 records where as the query shows 5 records in Mysql. Code in PHP is $fromdate=trim($_POST['fromdate']); $from=date('d-m-Y',strtotime($fromdate)); $todate=trim($_POST['todate']); $to=date('d-m-Y',strtotime($todate)); $supname=$_POST['supplier']; $sql="select a.date,(select itemname from items where itemid=a.itemid) as item,a.quantity,a.rate,a.fat,a.amount from purchasedetails a where a.supplierid=".$supname." and (a.date >='".$from."' and a.date <='".$to."')"; $result=mysql_query($sql); $count=mysql_num_rows($result) echo $count; Query in Mysql select a.date,(select itemname from items where itemid=a.itemid) as item,a.quantity,a.rate,a.fat,a.amount from purchasedetails a where a.supplierid=2 and a.date>='01-12-2012' and a.date<='10-01-2013'; date column in Mysql table is varchar type.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.