timmah1 Posted June 1, 2008 Share Posted June 1, 2008 When I view the page 'editHistory', the function is this: function editHistroy($DOGID) { $response =""; $count = performSQLMultiRow("select firstname, lastname, logentry, changeDate from editHistory left join useraccounts on editHistory.uid = useraccounts.uid where keyValue = $DOGID AND tableName='DOG'",$result); /* Old query "select firstname, lastname, logentry, changeDate from editHistory,useraccounts where keyValue = $DOGID AND tableName='DOG' AND editHistory.uid = useraccounts.uid" */ for($i =0;$i < $count ; $i++) { $editHistory = mysql_fetch_array($result); if ($editHistory['firstname'] == NULL) { $response .= "Unknown"; } else { $response .= $editHistory['firstname']; } if ($editHistory['lastname'] != "NULL") { $response .= " " . $editHistory['lastname']; } $response .= " on " . $editHistory['changeDate'] ." made change <br><span class=fontsize1emnormalPROFILEIndented>'" . $editHistory['logentry'] . "'</span><br><br>"; } return $response; } It returns this Michelle Kramer on 2008-06-01 11:20:22 made change 'Removed All Owners for Dogs for 39804' Michelle Kramer on 2008-06-01 11:20:22 made change 'Added Owners for 39804' Michelle Kramer on 2008-06-01 11:20:22 made change 'Updated with RegisteredName='Michelle\'s Test Dog', Alias=NULL, CallName=NULL, AKC=NULL, AKCStudBookYear=NULL, AKCStudBookMonth=NULL, CKC=NULL, CKCStudBookYear=NULL, CKCStudBookMonth=NULL, OtherRegistration=NULL, OtherRegistrationCountry=5, Sex='M', Genotype=2, Colour=2, Dentition=1, Height=NULL, Length=NULL, AdultWeight=NULL, DNAprofile=NULL, BirthCountry=3, CauseOfDeath=NULL, birthYear=2008, birthMonth=5, birthDay=30, deathYear=NULL, deathMonth=NULL, deathDay=NULL, confirmedCauseOfDeath='Unknown', SireID=NULL, damID=NULL, namePrefix=NULL, nameSuffix=NULL, publication1=' ', publication2=' ', publication3=' '' How do I get it so that it does not show any of this? Michelle Kramer on 2008-06-01 11:20:22 made change 'Updated with RegisteredName='Michelle\'s Test Dog', Alias=NULL, CallName=NULL, AKC=NULL, AKCStudBookYear=NULL, AKCStudBookMonth=NULL, CKC=NULL, CKCStudBookYear=NULL, CKCStudBookMonth=NULL, OtherRegistration=NULL, OtherRegistrationCountry=5, Sex='M', Genotype=2, Colour=2, Dentition=1, Height=NULL, Length=NULL, AdultWeight=NULL, DNAprofile=NULL, BirthCountry=3, CauseOfDeath=NULL, birthYear=2008, birthMonth=5, birthDay=30, deathYear=NULL, deathMonth=NULL, deathDay=NULL, confirmedCauseOfDeath='Unknown', SireID=NULL, damID=NULL, namePrefix=NULL, nameSuffix=NULL, publication1=' ', publication2=' ', publication3=' '' Now, this isn't my code, I'm helping someone out because the person that wrote this is MIA. Any help is much appreciated. Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/ Share on other sites More sharing options...
hansford Posted June 1, 2008 Share Posted June 1, 2008 that's all the function does is print the information you want to get rid of, so just delete this line. return $response; Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555057 Share on other sites More sharing options...
timmah1 Posted June 1, 2008 Author Share Posted June 1, 2008 Then nothing will show, I only need it to show Michelle Kramer on 2008-06-01 11:20:22 made change 'Added Owners for 39804' Not all of this Updated with RegisteredName='Michelle\'s Test Dog', Alias=NULL, CallName=NULL, AKC=NULL, AKCStudBookYear=NULL, AKCStudBookMonth=NULL, CKC=NULL, CKCStudBookYear=NULL, CKCStudBookMonth=NULL, OtherRegistration=NULL, OtherRegistrationCountry=5, Sex='M', Genotype=2, Colour=2, Dentition=1, Height=NULL, Length=NULL, AdultWeight=NULL, DNAprofile=NULL, BirthCountry=3, CauseOfDeath=NULL, birthYear=2008, birthMonth=5, birthDay=30, deathYear=NULL, deathMonth=NULL, deathDay=NULL, confirmedCauseOfDeath='Unknown', SireID=NULL, damID=NULL, namePrefix=NULL, nameSuffix=NULL, publication1=' ', publication2=' ', publication3=' '' Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555065 Share on other sites More sharing options...
.josh Posted June 1, 2008 Share Posted June 1, 2008 Are you seriously asking how to highlight/delete things out of a string? You find the part in your string you do not wish to have displayed, put your mouse there and click on that spot, and start tapping your delete button. Or you could get really fancy with some advanced editing skills and drag across to highlight it and then press delete. Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555077 Share on other sites More sharing options...
timmah1 Posted June 1, 2008 Author Share Posted June 1, 2008 I came here for some help, not to be talked down too. I'm well aware of how to delete things, thanks for the lesson though, might come in handy later on. Now, I don't what part of the statement that is and why it is showing, that is why I posted the code, to see if maybe somebody here could help out. So you think you might be able to help out, or are smart-alec reponses the only thing in your repertoire?? Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555085 Share on other sites More sharing options...
.josh Posted June 1, 2008 Share Posted June 1, 2008 But that is exactly what you are asking. You're asking: // how do i get it to not show 'bar'? echo "foo bar"; to which the only response to that is: take it out. But then you're like..but how? So what do you expect me to say to that? Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555089 Share on other sites More sharing options...
timmah1 Posted June 1, 2008 Author Share Posted June 1, 2008 What I don't understand is why does it show this, I don't want that to show, how do I get rid of this Alias=NULL, CallName=NULL, AKC=NULL, AKCStudBookYear=NULL, AKCStudBookMonth=NULL, CKC=NULL, I just need it to show this format that I need to show Michelle Kramer on 2008-06-01 11:20:22 made change 'Added Owners for 39804' That is what I'm asking Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555092 Share on other sites More sharing options...
.josh Posted June 1, 2008 Share Posted June 1, 2008 That shouldn't be showing at all, from the code you posted. Check your loop that calls that function to see if you have some sort of erroneous variable concatted onto where you return the displayed response. Failing that, look at your performSQLMultiRow function to see if something isn't being erroneously added on there. It looks like something you (or someone) may have used to echo stuff out for debugging, or else a query building string, that's somehow being tacked onto the end of your output. But it's not in the code you provided. Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555095 Share on other sites More sharing options...
timmah1 Posted June 1, 2008 Author Share Posted June 1, 2008 This is the moreinfo file include_once "dogTableAccess.php"; $res = editHistroy($_GET['DOGID']); if ($res == "") { echo "<div align=center>This dog has no History recorded</div>"; } else { echo $res; } This is the dogTableAccess file function editHistroy($DOGID) { $response =""; $count = performSQLMultiRow("select firstname, lastname, logentry, changeDate from editHistory left join useraccounts on editHistory.uid = useraccounts.uid where keyValue = $DOGID AND tableName='DOG'",$result); /* Old query "select firstname, lastname, logentry, changeDate from editHistory,useraccounts where keyValue = $DOGID AND tableName='DOG' AND editHistory.uid = useraccounts.uid" */ for($i =0;$i < $count ; $i++) { $editHistory = mysql_fetch_array($result); if ($editHistory['firstname'] == NULL) { $response .= "Unknown"; } else { $response .= $editHistory['firstname']; } if ($editHistory['lastname'] != "NULL") { $response .= " " . $editHistory['lastname']; } $response .= " on " . $editHistory['changeDate'] ." made change <br><span class=fontsize1emnormalPROFILEIndented>'" . $editHistory['logentry'] . "'</span><br><br>"; } return $response; } This is the vars.php file associated with both files function logActivity($Activity, $tableName, $keyValue) { // Make sure $tableName is all capps. $tableName=strtoupper($tableName); // Store the datetime value, the date needs to be in this format. // 'YYYY-MM-DD HH:MM:SS if ( isset($_SESSION['UID'])) { $UID = $_SESSION['UID']; } else { $UID = 0; // 0 is a special UID indicating an unloged in user. // Often used when logging the change for a password. } performSQLNoResult("insert into editHistory (uid, logentry,changeDate, tableName, keyValue) values ($UID,'$Activity','".date("Y-m-d G:i:s") ."', '$tableName', '$keyValue')"); } I cannot find anywhere that this is, on any of these files. Like I said, this isn't my code Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555101 Share on other sites More sharing options...
.josh Posted June 1, 2008 Share Posted June 1, 2008 your function calls performSQLMultiRow where in your script is that Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555105 Share on other sites More sharing options...
timmah1 Posted June 1, 2008 Author Share Posted June 1, 2008 This is the only place I could find the function function performSQLMultiRow($SQL, &$result_set) { global $linkID, $database; mysql_select_db("$database", $linkID); $result = mysql_query($SQL); if (!$result) { echo("<P>ERROR " . mysql_error() ."</P> <p> on SQL: $SQL</p>"); exit(); } $result_count = mysql_num_rows($result); $result_set = $result; return $result_count ; } Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555107 Share on other sites More sharing options...
timmah1 Posted June 1, 2008 Author Share Posted June 1, 2008 This is that function if (!$result) { echo("<P>ERROR " . mysql_error() ."</P> <p> on SQL: $SQL</p>"); exit(); } If I take out the $SQL, it won't show, correct? Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555114 Share on other sites More sharing options...
.josh Posted June 1, 2008 Share Posted June 1, 2008 that's right. If you take out $sql it won't show...however, it's showing because there is an error, causing $result to be false, so taking out $sql only keeps it from showing that, but it does not fix your error. Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555119 Share on other sites More sharing options...
timmah1 Posted June 1, 2008 Author Share Posted June 1, 2008 I noticed that also, as long as now I know that the $SQL shows that, it'll make it easier to fix. Thanks for all your help! Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555122 Share on other sites More sharing options...
.josh Posted June 1, 2008 Share Posted June 1, 2008 well..that COULD be it. That condition does echo out your query string, but I'm looking back at your original output and I'm not really seeing that "SQL : <query string>" or even the error...so...I think I have to take that back and say that I don't think that's it. Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555129 Share on other sites More sharing options...
timmah1 Posted June 1, 2008 Author Share Posted June 1, 2008 crap. Guess I was hoping for an easy fix on that there :-) I'll keep looking Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555132 Share on other sites More sharing options...
.josh Posted June 1, 2008 Share Posted June 1, 2008 Now, I am noticing here: for($i =0;$i < $count ; $i++) { $editHistory = mysql_fetch_array($result); if ($editHistory['firstname'] == NULL) { $response .= "Unknown"; } else { $response .= $editHistory['firstname']; } if ($editHistory['lastname'] != "NULL") { $response .= " " . $editHistory['lastname']; } $response .= " on " . $editHistory['changeDate'] ." made change <br><span class=fontsize1emnormalPROFILEIndented>'" . $editHistory['logentry'] . "'</span><br><br>"; } return $response; } $count comes from $count = performSQLMultiRow("select firstname, lastname, logentry, changeDate from editHistory left join useraccounts on editHistory.uid = useraccounts.uid where keyValue = $DOGID AND tableName='DOG'",$result); Making it a result source, which isn't an integer to be counted to. I think you may need to change your code to: while($editHistory = mysql_fetch_array($result)) { if ($editHistory['firstname'] == NULL) { $response .= "Unknown"; } else { $response .= $editHistory['firstname']; } if ($editHistory['lastname'] != "NULL") { $response .= " " . $editHistory['lastname']; } $response .= " on " . $editHistory['changeDate'] ." made change <br><span class=fontsize1emnormalPROFILEIndented>'" . $editHistory['logentry'] . "'</span><br><br>"; return $response; } Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555133 Share on other sites More sharing options...
timmah1 Posted June 1, 2008 Author Share Posted June 1, 2008 I keep getting the same results Quote Link to comment https://forums.phpfreaks.com/topic/108264-need-help-with-a-query/#findComment-555197 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.