General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old May 26th, 2003, 03:17 AM
primoshock primoshock is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 4 primoshock User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation EEK! Errors in developing.

So I am building the school site for next year, and they want to show a list of all the courses they offer. All was going good until I started making redunt calls to MySQL - once to get course listing and again to put a Course Category next to "Courses Offered In " . . . and to complicate matters even more - when the while start looping it does not grab the first entry (ie anything that should go alphabetically first.

Anyone out there - please HELP!

This page appears after URL is clicked on "courselisting.php?courseId=1

PHP Code:
<?php


  $db_server 
"localhost";
  
$db_db "database";
  
$db_user "databaseuser";
  
$db_pass "databasepassword";

   
$courseId $HTTP_GET_VARS["courseId"];
   
  @
$sConn mysql_connect($db_server$db_user$db_pass);
  @
$dConn mysql_select_db($db_db$sConn);

  
$cResult mysql_query("select * from bhs_courses where courseId = '$courseId'");
 
$cRow mysql_fetch_array($cResult);
  
 
$nResult mysql_query("select * from bhs_classes where courseId = '$courseId' order by courseName asc");
 
$nRow mysql_fetch_array($nResult);
?>
<html>
<head>
<title> Your High School || <?php echo str_replace("\"""\\\""$cRow["course"]); ?></title>
</head>
<body>
<table width='500' cellspacing='0' cellpadding='0'>
<tr><td colspan="5">
<font face="arial" size="4"><b>Courses Offered In <?php echo str_replace("\"""\\\""$cRow["course"]); ?></b></font>
</td></tr>
<tr><td colspan="5" valign="middle" align="center" height="40px">
<hr>
</td></tr>

<?
if($nRow) {
  while(
$nRow mysql_fetch_array($nResult))
  {
    
?>
 <tr>  
<td> 
<b>    
<?php echo str_replace("\"""\\\""$nRow["courseName"]); ?>
</b>
</td>
<td> 

<?php echo str_replace("\"""\\\""$nRow["classGrade"]); ?>

</td>
<td>     
<?php echo str_replace("\"""\\\""$nRow["courseNum"]); ?>

</td>
<td>     
<?php echo str_replace("\"""\\\""$nRow["credit"]); ?>

</td>      
<td>     
<?php echo str_replace("\"""\\\""$nRow["creditType"]); ?>

</td>         
</tr>
<tr><td colspan="4"><?php echo str_replace("\"""\\\""$nRow["courseDes"]); ?>

<tr>
<td height="40px">     

</td>         
</tr>

    <?php
  
}

  
?>
<tr><td colspan="5" valign="middle" align="center" height="40px">
<hr>
</td></tr>
<tr><td colspan="5" valign="middle" align="center" height="40px">
<a href='/registration/index.php'><font face='verdana' size='2' color='black'>Back To Course Listing</font></a>
</td></tr>
</table>


  <?php
}
else {
?>
<tr><td colspan="5" valign="middle" align="center" height="40px">
Currently no courses!
</td></tr>
<tr><td colspan="5" valign="middle" align="center" height="40px">
<hr>
</td></tr>
<tr><td colspan="5" valign="middle" align="center" height="40px">
<a href='/registration/index.php'><font face='verdana' size='2' color='black'>Back To Course Listing</font></a>
</td></tr>
</table>
<?
}
?>

Reply With Quote
  #2  
Old May 26th, 2003, 03:51 AM
primoshock primoshock is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 4 primoshock User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
A Look At The Database

This is what my databases are looking like, yeah I am sure this is where my errors are coming from!

PHP Code:
 create table bhs_courses
 
(
   
courseId int auto_increment not null,
   
course varchar(100),
   
primary key(courseId),
   
unique id(courseId)
 );
 
create table bhs_classes
 
(
   
classId int auto_increment not null,
   
courseId varchar(100),
   
courseName varchar(100),
   
courseNum varchar(5),
   
courseDes text,
   
credit varchar(5),
   
creditType varchar(5),
   
primary key(classId),
   
unique id(courseId)
 );

 
insert into bhs_classes values(0'1','English 10H','4602','This is an accelerated course for students demonstrating stong ability to learn and to blah blah blah and why I am typing all this stuff, I - PRIMOSHOCK would like to know.','1.0','(LA)'); 

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > EEK! Errors in developing.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway