Jump to content

txrandom

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

txrandom's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Well I think I found a work around. I'm already detecting to see if the valid is null. I'm just going to change the "locationId = ?" to a variable and have the other option be "locationId IS NULL" That way it doesn't even matter if the parameter is null since it won't be binding it anyways. Thanks for the help!
  2. That was a bad example: $slotRow = $slotTable->fetchRow(array("locationId = ?" => $locationRow->locationId, "timeId = ?" => $timeRow->timeId, "days = ?" => $days)); I'm using this for a data scrubber. I don't want to replicate data, so I need to make sure it's not already in there. For example, a slot may have the time and day fields filled, but this slot may not have a location. The location should be null since it doesn't have one. Well what if there is another slot with the same time and day, but actually has a location? I need to make sure I check whether that locationId is null. Does that make sense? Do you think there is a better approach to this?
  3. $departmentRow = $departmentTable->fetchRow(array("department = ?" => $department)); Let's say there is an off chance $department may be null. Doing this with Zend Framework throws a 'SQLSTATE[HY093]: Invalid parameter number: no parameters were bound' Is there any way to allow $department to be null?
  4. Thanks Barand. Should array_unique() not be used to remove unique objects? It seems like it's not using tostring() to compare objects.
  5. I've got an array of objects that are instantiated based on an ID, but it's possible that multiple objects of the same ID may be added to an array. I've tried using array_unique to get rid of duplicates, but if the object contains a null data field, it throws some error messages. How do I get PHP to compare objects by a certain field rather than every variable (null or set) declared in an object?
  6. I get the error 1054: Unknown column 'gid.gid' in 'on clause'.  Does that mean it's trying to access table gid . field gid? Cause that doesn't exist.  I've never used SQL like this so I have no idea.
  7. Thanks, I tested the script out and I'm getting a "mysql_fetch_array(): supplied argument is not a valid MySQL result resource" error.  I think the query statement must be wrong somewhere.
  8. here is my code: [code]$query = "SELECT * FROM gid"; $result=mysql_query($query); $num=mysql_num_rows($result); $i=0; while ($i<$num) { $gid=mysql_result($result,$i,"name"); $queryb = "SELECT * FROM testbracket WHERE gid='$gid'"; $resultb=mysql_query($queryb); $numb=mysql_num_rows($resultb); $ib=0; $grouppoints=0; while ($ib<$numb) { $points=mysql_result($resultb,$ib,"points"); $grouppoints += $points; $ib++; } //form an array or something else here $i++; } [/code]
  9. In my script I'm querying a set of names and numbers. Certain numbers are totaled up and associated with the name.  I am then trying to display the list of numbers in descending  order with the associated name with it.  Now I'm not really sure how I'm going to do this, I tried using an associated array, but I don't know how I would find the highest value to start the for loop. Is it possible to have an array that has two values that "stick" together.  So if I sorted the array by number, the numbers would stay associated with the name?
  10. Read the book at hudzilla.org, it has helped me a lot.
  11. Thanks everyone.  I swore I checked it for grammar and didn't find anything.  Just a stupid mistake!
  12. In my code, I have an inputted string exploded into an array.  I can type echo "$invitearray[0] $invitearray[1] ... "; and get it to display certain elements within an array.  The only problem is I'm trying to run a for loop, and to do that I need the total number of elements in the array.  When I run $sizearray = count($invitearray);, $sizearray equals 0.  Any idea what's wrong? [code]$invitearray = explode(',', $invitelist); echo "$invitearray[0] $invitearray[1] $invitearray[2] $invitearray[3]"; $sizearray = count($invitearrary); echo "<br><br>$sizearray"; for ($j=0; $j<$sizearray; $j++) { echo "$invitearray[$j]"; }[/code]
  13. Yah, I ended up doing that.  I'm just hoping this problem won't bug me when I absolutely have to be able to delete a row.
×
×
  • 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.