krillin82 Posted January 27, 2009 Share Posted January 27, 2009 I am trying to make a small php form/mysql application that enters in kids and problems with discipline. I have been working in dreamweaver for the most part and I can create and list the records but I am having problems with pulling all the records for a kid based on his name passed on from a previous page stored in a value called recordID. I'm sure this is a really newb question but for some reason I am having a hard time with it. Here's kind of what I have going on now. Thanks for any help. <?php require_once('Connections/discipline.php'); ?><?php mysql_select_db($database_discipline, $discipline); $query_Incidents = "SELECT * FROM incident_log WHERE 'student_name' = 'recordID'"; $Incidents = mysql_query($query_Incidents, $discipline) or die(mysql_error()); $row_Incidents = mysql_fetch_assoc($Incidents); $totalRows_Incidents = mysql_num_rows($Incidents); $maxRows_DetailRS1 = 10; $pageNum_DetailRS1 = 0; if (isset($_GET['pageNum_DetailRS1'])) { $pageNum_DetailRS1 = $_GET['pageNum_DetailRS1']; } $startRow_DetailRS1 = $pageNum_DetailRS1 * $maxRows_DetailRS1; mysql_select_db($database_discipline, $discipline); $recordID = $_GET['recordID']; $query_DetailRS1 = "SELECT * FROM incident_log WHERE student_name = '$recordID'"; $query_limit_DetailRS1 = sprintf("%s LIMIT %d, %d", $query_DetailRS1, $startRow_DetailRS1, $maxRows_DetailRS1); $DetailRS1 = mysql_query($query_limit_DetailRS1, $discipline) or die(mysql_error()); $row_DetailRS1 = mysql_fetch_assoc($DetailRS1); if (isset($_GET['totalRows_DetailRS1'])) { $totalRows_DetailRS1 = $_GET['totalRows_DetailRS1']; } else { $all_DetailRS1 = mysql_query($query_DetailRS1); $totalRows_DetailRS1 = mysql_num_rows($all_DetailRS1); } $totalPages_DetailRS1 = ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1; ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <table border="1" align="center"> <tr> <td>ID</td> <td><?php echo $row_DetailRS1['ID']; ?> </td> </tr> <tr> <td>enrollment_grade</td> <td><?php echo $row_DetailRS1['enrollment_grade']; ?> </td> </tr> <tr> <td>student_name</td> <td><?php echo $row_DetailRS1['student_name']; ?> </td> </tr> <tr> <td>enrichment_faculty</td> <td><?php echo $row_DetailRS1['enrichment_faculty']; ?> </td> </tr> <tr> <td>incident type</td> <td><?php echo $row_DetailRS1['incident_type']; ?> </td> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/142656-simple-querry-phpmysql-newb/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.