php - SQL query with join shows only one result -


i have sql query should shows records table swt_modules, shows first row.

$query1 = mysql_query ("select swt_modules.id, swt_modules.name, swt_exam_regs.name exam_regs                         `swt_modules`                         join `swt_exam_regs`                         using ( `id` )                         swt_exam_regs.id = swt_modules.exam_regulation                         order swt_modules.name desc , swt_modules.id desc                         limit " . $limit . ""); while ($fetch1 = mysql_fetch_array ($query1)) { ... } 

i have in table (swt_modules) 3 rows , in each of them value of field "exam_regulation" 1. in table swt_exam_regs have 1 row 2 columns - id , name. swt_modules.id stores id number. join should use able see records?

result after join records in swt_modules table

i suggest using mysqli or pdo instead of deprecated mysql.

$query1 = mysql_query ("     select          swt_modules.id,          swt_modules.name,          swt_exam_regs.name exam_regs     swt_modules     left join swt_exam_regs on swt_exam_regs.id = swt_modules.exam_regulation     order          swt_modules.name desc,          swt_modules.id desc     limit $limit"); 

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -