Jump to content

[SOLVED] retrieve from data


girlzz

Recommended Posts

hello sir... i have 1 question to ask... how can i get 1 table form database so that when i query by search so all the information appear.. coz i had one table called title from medic_subject_offered.. i want the title appear same as code..example: key in code, the display the code and the title... this is my coding... can u explain is there anythiing wrong??

 

<?php

$colname_Recordset1 = "-1";

if (isset($_GET['code'])) {

  $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['code'] : addslashes($_GET['code']);

}

mysql_select_db($database_mas, $mas);

$query_Recordset1 = sprintf("SELECT medic_registered_course.matric_no, medic_registered_course.s_code FROM medic_registered_course WHERE medic_registered_course.s_code LIKE  '%%%s%%' ORDER BY `id` DESC" , $colname_Recordset1);

$Recordset1 = mysql_query($query_Recordset1, $mas) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

 

mysql_select_db($database_mas, $mas);

$query_Recordset2 = "SELECT medic_subject_offered.s_title,medic_registered_course.s_code FROM medic_registered_course,medic_subject_offered WHERE medic_registered_course.s_code=medic_subject_offered.s_code";

$Recordset2 = mysql_query($query_Recordset2, $mas) or die(mysql_error());

$row_Recordset2 = mysql_fetch_assoc($Recordset2);

$totalRows_Recordset2 = mysql_num_rows($Recordset2);

 

 

 

?>


Link to comment
https://forums.phpfreaks.com/topic/117476-solved-retrieve-from-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.