Jump to content

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


kernelgpf

Recommended Posts

$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...
Link to comment
Share on other sites

Your curly braces aren't balanced:
[code]<?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.
?>[/code]

See my comments in the code.

Ken
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.