Jump to content

Not returning Data

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
zeroradius

zeroradius

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,406 posts
Hey guys,

The below script is supose to return the maximum value of returnOrder filed from the forumCatagory table so that I can increment the highest number value by 1 so i can insert it with the catagory. The problem is it is not printing a value. I tested the querry in PHPMyAdmin and it returned the correct value so that is not the problem. I have tried various ways of doing this but I can't remember what it was at the moment (even though i just frickin did it :001_unsure: ) The answer is probably somthing simple but I have been working on home work sense 8:30AM (it is 1:41 AM right now so its been a while) and every thing is begining to blur together but I need to try and get this done today because i work the next few days and then class is saturday (dosent have to be done but I have a lot of scripting to get done and not much time to work on it )

Heres the code:


//Conect to Database

include("userDbConnection.php");


// select highest oreder number and add one to it

$determinOrder="Select max(returnOrder) from forumCatagory";

$orderResult=mysql_query($determinOrder)or die(mysql_error());

$highOrder=mysql_fetch_row($orderResult);

$orderNumber=$highOrder['returnOrder'];


echo $orderNumber;


Posted Image

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Try this (just a hunch):

//Conect to Database

include("userDbConnection.php");


// select highest oreder number and add one to it

$determinOrder="Select max(returnOrder) as MyReturn from forumCatagory";

$orderResult=mysql_query($determinOrder)or die(mysql_error());

$highOrder=mysql_fetch_row($orderResult);

$orderNumber=$highOrder['MyReturn'];


echo $orderNumber;  

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
Yes, I didn't see that earlier when I was reading this. WingedPanther has right. what you could do otherwise is to read $highOrder[0] which gives the single answer no matter what the field name is.

#4
zeroradius

zeroradius

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,406 posts
Thanks both of you. The first one still returns nothing but the second sugestion fixed it.
Posted Image

#5
pickle3

pickle3

    Newbie

  • Members
  • Pip
  • 5 posts
print_r($array) is nice to use when debuggin arrays.

Will output all the data in the array. In a nice tree :P