php - Mysql column not returning correct value -


i'm trying number of places left on course specific column. however, result returning 4 incorrect. should 15.

here code:

$courseid = $_get['id'];  $result = mysql_query("select * course_dates id = '$courseid'");   $row = mysql_fetch_row($result);   foreach ($row $record) {     $placesleft = $record['places']; }   echo $placesleft; 

is obvious, being complete noob?

edit: var_dump of $row:

   array(7) {      [0]=> string(1) "2"     [1]=> string(1) "2"     [2]=> string(56) "essential leadership , mangement skills in new nhs"     [3]=> string(6) "london"     [4]=> string(10) "2012-12-15"     [5]=> string(2) "15"     [6]=> string(3) "450"    }  

i believe id primary/unique key

so you'll 1 row result set

so using:

$row['places'];  

is enough don't iterate again


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -