Sigma Php Ajax framework, Ajax Components, GUI Builder
May 17, 2012, 01:45:16 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Link two tables . Hurry up :S  (Read 318 times)
caldewallace
Jr. Member
**
Posts: 6


View Profile
« on: October 13, 2011, 08:35:28 AM »

I need help ...

 I am making a query to link two tables with the following statement:

if($json->{'action'} == 'load'){
  $sql = "SELECT servicios.nombre, agencias.nombre  FROM servicios, agencias where agencias.id_agencia = servicios.id_agencia";
  $handle = mysql_query($sql);

 Should work, right? I tried the query in Phpadmin and correct ... I need to show the name of the agency and the service name. Appears correct, but when you load the grid can not see anything .... I tried also with INNER JOIN and does not work.

It would be wrong to teach the correct fields?

var dsOption= {

   fields :[
      {name : 'servicios.nombre'  },
      {name : 'agencias.nombre'  }
   
      
   ],
   recordType : 'object'
}
var colsOption = [
     {id: 'servicios.nombre' , header: "Nombre Servicio" , width :300, editor:{type:'text'} },
     {id: 'agencias.nombre' , header: "Nombre Agencia" , width :300 , editor:{type:'text'}}
];

 It is quite urgent because it is for a project ... thank you very much!
« Last Edit: October 13, 2011, 08:37:45 AM by caldewallace » Logged
caldewallace
Jr. Member
**
Posts: 6


View Profile
« Reply #1 on: October 14, 2011, 12:13:21 AM »

Please, i need hel, is very important for me :S
Logged
Trent
Newbie
*
Posts: 3


View Profile
« Reply #2 on: October 25, 2011, 10:56:51 PM »

Hi,
 I suggest your Php sql statement select fields ,dsOption fields name and colsOption column id change for using alias name not  tablename.fieldname
Logged
caldewallace
Jr. Member
**
Posts: 6


View Profile
« Reply #3 on: October 26, 2011, 07:24:29 AM »

thanks Trent
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!