Jump to content

rbragg

Members
  • Posts

    176
  • Joined

  • Last visited

    Never

Everything posted by rbragg

  1. Our server has error printing turned off. I have access to the logs on the server and I don't get any errors. When I print ociresult($hall, "HALL") my droplist is empty. That was square 1. :-X Thanks for trying.
  2. I did exactly that early on. As I stated above, I once tried using the ociresult function with ocifetch like this: <?php ociexecute($hallResults); while( $hall = ocifetch($hallResults) ) { $hallList = ociresult($hall,"HALL"); blah blah } ?>
  3. I have an extra Q-tip here if needed.
  4. Btw, thanks for your assistance also. This still gives the Array instances.
  5. <?php while (ocifetchinto($hallResults, $hall, OCI_ASSOC)) ?> Unfortunately, oic_assoc is not a function that is available in PHP 4. When I use the above syntax, I get eleven instances of the word "Array".
  6. Making progress - I get: 11111111111 There are eleven values in my db in the HALL field, which I imagine is why there are eleven 1's.
  7. Hi! I added the <?php print_r($hall); ?> and still have an empty drop list and no printed values anywhere. I have looked in the error logs and there are none. ???
  8. I should say that I usually program in mySQL and am learning SQL+/Oracle. I had read that when you use ocifetch, you must also use ociresult. That's why I had mentioned the $hallList = ociresult($hall,"HALL"); and using $hallList as the record set. I did try the field referencing and it did not work: <?php $hallResults = ociparse($connect, $queryHall); ociexecute($hallResults); echo "<select name='hallDrop'>"; echo "<option value=' '> </option>"; while( $hall = ocifetch($hallResults) ) { echo " \n\t<option value = '" . $hall['HALL'] . "'"; if (isset($_SESSION['hallDrop']) && $_SESSION['hallDrop'] == $hall['HALL']) { echo " selected='selected' "; } echo ">" . $hall['HALL'] . "</option>"; } echo "</select>"; ?>
  9. Thanks for your reply. In user.hall, user is my schema and hall is my table.
  10. What is the OCI equivalent to mysql_fetch_array in SQL+? I am using PHP 4 and so oci_ fetch_ array does not work for me. <?php $queryHall = " SELECT hall FROM user.hall "; $hallResults = ociparse($connect, $queryHall); ociexecute($hallResults); echo "<select name='hallDrop'>"; echo "<option value=' '> </option>"; while( $hall = ocifetch($hallResults) ) { echo " \n\t<option value = '" . $hall . "'"; if (isset($_SESSION['hallDrop']) && $_SESSION['hallDrop'] == $hallList) { echo " selected='selected' "; } echo ">" . $hall . "</option>"; } echo "</select>"; ?> My droplist is not populated. :-\ Inserting $hallList = ociresult($hall,"HALL"); is of no help either.
  11. Isn't that a good thing? I talked out a solution and shared it for those who may be searching about the same problem. Thanks for helping.
  12. Ah! I had an extra GROUP BY clause in there. When I omitted it, things work great.
  13. Ok, only the 2nd count line successfully counted. ???
  14. Ah, the syntax error goes away when I removed the comma after progressCount. DuH! I will keep from closing this topic for right now until I make sure the query is giving me the right counts.
  15. What do I get a syntax error with this query: <?php $queryCountAll = " SELECT COUNT(call_num) AS callCount, COUNT (CASE WHEN status_num = '1' THEN status_num END) AS closedCount, COUNT (CASE WHEN status_num = '2' THEN status_num END) AS openCount, COUNT (CASE WHEN status_num = '3' THEN status_num END) AS forwardCount, COUNT (CASE WHEN status_num = '4' THEN status_num END) AS followupCount, COUNT (CASE WHEN status_num = '5' THEN status_num END) AS progressCount, FROM call "; $countAllResults = mysql_query($queryCountAll) or die( "Count query failed: " . mysql_error() ); $countAll = mysql_fetch_assoc($countAllResults); ?> Thank you in advance!
  16. Well, I have this later down the page: <?php if ( (!$updateStatus) || (!updateDetails) || (!updateTech) ) { die("A query failed: " . mysql_error() ); } ?> So, no.
  17. The problem: Why isn't my table being updated with $details?? During testing, I successfully echo $old, $new, and $details ... yet, $details is not updating my table. <?php # select old details for appending $queryDetails = " SELECT details, time_update FROM call WHERE call_num = '$callID' "; $detailsResults = mysql_query($queryDetails); $oldDetails = mysql_fetch_assoc($detailsResults); $old = $oldDetails['details']; # get new details $new = mysql_real_escape_string($_SESSION['tDetails']); $newTime = date('M j, y @ h:i a' ); if ( empty($old) ) # if no old details { $details = $new; } else { $details = $old . "<br><br>" . $newTime . ": " . $new; } # only if new details were entered, then update; if not then do not update if ( !empty($details) ) { $queryUpdateDetails = " UPDATE call SET details = '$details' WHERE call_num = '$callID' "; $updateDetails = mysql_query($queryUpdateDetails); } ?>
  18. Or better yet - why wouldn't this work? <?php # build URL $url = "?lastCall=" . $_SESSION['dbLast'] . "&refreshEagle=" . $_SESSION['eagle'] . "&searchStatus=" . $_SESSION['status'] . "&refreshHall=" . $_SESSION['hall']. "&refreshTech=" . $_SESSION['tech']; if ( !empty($_GET['searchStatus']) ) { $_SESSION['status'] = mysql_real_escape_string($_GET['searchStatus']); $searchStatus = $_SESSION['status']; $querySearch.= "AND vigil_call.status_num = '$searchStatus' "; } ?> The session is able to be echoed from the URL but it is still not used in my query.
  19. I am building a URL and a SELECT query at the same time. I have a GET method form on search.php. It sends the user to searchResults.php where I am retrieving searchStatus: <?php if ( !empty($_GET['searchStatus']) ) # if searched { $_SESSION['status'] = mysql_real_escape_string($_GET['searchStatus']); # get selected status from previous page $searchStatus = $_SESSION['status']; $querySearch.= "AND vigil_call.status_num = '$searchStatus' "; } if ( !empty($_GET['refreshStatus']) ) # if refreshed, grab session from URL { $refreshStatus = mysql_real_escape_string($_GET['refreshStatus']); $querySearch.= "AND vigil_call.status_num = '$refreshStatus' "; } ?> If the user is sent from the previous page, then the query is built with the searched status. However, this results page is auto refreshed. On the refresh, I am trying to display the same results ... just updated. So, I am grabbing the session from the newly built URL. <?php # build URL $url = "?lastCall=" . $_SESSION['dbLast'] . "&refreshEagle=" . $_SESSION['eagle'] . "&refreshStatus=" . $_SESSION['status'] . "&refreshHall=" . $_SESSION['hall']. "&refreshTech=" . $_SESSION['tech']; ?> I am testing by echoing the values of the 2 variables and it correctly echoes a duplicate number: <?php echo "status: " . $_SESSION['status']; echo "<br>refresh status: " . $refreshStatus; ?> The query is successful when first reaching the page and I get my results, but upon refresh the I have no results. :-\ Can someone be of assistance? Or maybe you know of an easier/cleaner method to achieve the same effect?
  20. OH DUH!!! I told you guys I've been staring at it for TOO long!! Thanks for your replies.
  21. I am bringing in a value via POST: <?php $bird= mysql_real_escape_string($_POST['searchBird']); ?> If this value is not empty, I would like to look the bird up in its table and get the primary key (s_num) to use in a later select query. <?php if ( !empty($bird) ) { $queryBirdSearch = " SELECT s_num FROM bird WHERE bird = '$bird' "; $birdSearchResults = mysql_query($queryBirdSearch) or die( "Bird search query failed: " . mysql_error() ); $sNum = mysql_fetch_assoc($birdSearchResults); $querySearch.= " AND call.s_num = '$sNum' "; } ?> However, I am not finding a match although I KNOW there is one because I'm sitting here looking at it. I echo my two variables, <?php echo "bird: " . $bird; echo "<br>s_num: " . $sNum; ?> and get: bird: 845712365 s_num: Array The bird: is right ... but, why is my s_num being set as an array when there is only one result? Have I been staring at this for too long?
  22. Thank you both very much for your quick replies. I used lur's method and this works VERY well and I understand where I went wrong. Again, thanks much.
  23. My whole objective here is to set $tNum. If a tech is found in the db, the $tNum should be set with t_num. If this is a new tech, there will be a new $tNum (given by the db via incrementation). My problem is that $tNum is not being set! Mainly, it's not being set when there is a match. <?php # see if tech already exists $queryTechMatch = " SELECT t_num FROM tech WHERE t_first = '".mysql_real_escape_string($_SESSION['tFirst'])."' AND t_last = '".mysql_real_escape_string($_SESSION['tLast'])."' "; $techMatch = mysql_query($queryTechMatch) or die( "Select tech query failed: " . mysql_error() ); if (mysql_num_rows($techMatch) > 0) # found existing tech { $tNum = $techMatch['t_num']; } else # new tech so insert new { $insertTech = " INSERT into tech (t_first, t_last, t_phone) VALUES ('".mysql_real_escape_string($_SESSION['tFirst'])."', '".mysql_real_escape_string($_SESSION['tLast'])."', '".mysql_real_escape_string($_SESSION['tPhone'])."' )"; $newTech = mysql_query($insertTech) or die( "Insert tech query failed: " . mysql_error() ); if ( $newTech ) { # get the t_num of this new insert to store in call table $queryLastTech = " SELECT t_num FROM tech ORDER by t_num DESC LIMIT 1 "; $lastTechResult = mysql_query($queryLastTech) or die( "Select tech query failed: " . mysql_error() ); $lastTech = mysql_fetch_assoc($lastTechResult); $tNum = $lastTech['t_num']; } } ?> However, if instead of using mysql_num_rows I use: <?php while( $row = mysql_fetch_array($techMatch) ) { $tNum = $row['t_num']; } ?> ... it works. I still want to use my else statement, though. :-\ Can someone help? Thanks in advance.
  24. Would this need to be $_SESSION['count'] instead of $_SESSION[count] ?
  25. I haven't tried this yet. I was just wondering how $_SESSION[count] would be initially set? I wanted to get the logic before I tried it out.
×
×
  • 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.