Jump to content


Photo

Weird problem with fetch_array... not fetching, everything seems fine.


  • Please log in to reply
1 reply to this topic

#1 kernelgpf

kernelgpf
  • Members
  • PipPipPip
  • Advanced Member
  • 227 posts
  • LocationTexas

Posted 04 March 2006 - 09:38 PM

$riderid=$_GET['riderid'];
$query=mysql_query("select * from riders where ridersid='$riderid'")or die(mysql_error());
$row=mysql_fetch_array($query);

if($_GET['action'] == "levelrider"){
if($row[owner] != "$sid"){
print "You don't own this rider.";
exit;
}


That's my code. Everything seems to be working right. action=levelrider is in the URL, no error is being printed out, $sid is equalling what it should, but $row[owner] doesn't show up. It's the correct column name, isn't a blank value...

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 04 March 2006 - 10:15 PM

Your curly braces aren't balanced:
<?php
$riderid=$_GET['riderid'];
$query=mysql_query("select * from riders where ridersid='$riderid'")or die(mysql_error());
$row=mysql_fetch_assoc($query); // changed to getting an associative array
echo '<pre>'.print_r($row,true).'</pre>';  //debug statement -- see what is being returned

if($_GET['action'] == "levelrider"){
    if($row[owner] != $sid){ // don't need the double quotes here
       print "You don't own this rider.";
       exit;
     }
} // added this end curly brace.
?>

See my comments in the code.

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users