[prog] php help

Rachel McConnell rachel at xtreme.com
Tue Sep 16 10:19:52 EST 2003


My PHP knowledge is minimal, but I do see a possible problem in the code
as you've sent it.  Basically, you've defined a variable $query but have
not used it as you've clearly intended.

See below...

> -----Original Message-----

> equals their student number. The table I am trying to get the 
> information from is called term, the rows
> I need are called term and year. I'm trying to follow examples from a 
 
> .<?
> include "connect.inc";
> 
> myconnect();
> 
> $scode = 193721070;

The variable $query (which is perfectly good SQL) doesn't seem to be
used
> $query = "SELECT term, year FROM term WHERE s_code = ".$scode;
> 
> 
> // get current term and year

This line, you are attempting to select from a table called 'current'
which is not a table you've mentioned as existing
> $current=mysql_db_query($db,"select term, year from current");

You probably want this instead:
  $current=mysql_db_query($db,$query);

> $cur=mysql_fetch_array($current);
> $cyear=$cur['year'];
> $cterm=$cur['term'];
> 
> $array = mysql_fetch_array($result);
> echo $array['term']. ;
> echo $array['year']."\n";
> 
> ?>.

As for the array stuff, I can't really help alas!

rachel



More information about the Programming mailing list