dermemo 6/10/2017 | |
Hi mhollibush, while ( $data1 = db_fetch_array($rsproducts) ) {
|
M
|
mhollibush author 6/10/2017 |
Hi mhollibush, try adding curly brackets and see if that works. while ( $data1 = db_fetch_array($rsproducts) ) {
|
dermemo 6/10/2017 | |
I
|
M
|
mhollibush author 6/11/2017 |
I m assuming you are trying to print these results somewhere on a view/edit or add page. t fully understand what you are trying to accomplish, i.e. you can show details of a master-detail relationship if you follow this tutorial:In any case, I´m assuming that you have a reason to do it the way you are doing it. The code below works for me.
|
dermemo 6/11/2017 | |
I see the problem now <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=82364&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' /> $data = $pageObject->getCurrentRecord();
{$parts}
|
M
|
mhollibush author 6/11/2017 |
I see the problem now <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=82365&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' /> Use this code: $data = $pageObject->getCurrentRecord();
{$parts}
|
dermemo 6/11/2017 | |
Yep, I have it in View page => Before display. |
M
|
mhollibush author 6/11/2017 |
Yep, I have it in View page => Before display. Make sure to make a "full build" and hit ctrl + f5 in the browser to make sure it`s refreshed. Did you read the link I provided to the tutorial? There might be an easier solution to accomplish what you are trying. The only other thing I can think of is, Private message me with a TeamViewer ID and I can try to help you on your machine to see what the problem is.
|
dermemo 6/11/2017 | |
Just following up, did you manage to solve your problem? |
M
|
mhollibush author 6/12/2017 |
Just following up, did you manage to solve your problem?
|
dermemo 6/12/2017 | |
Hi buddy, case
SELECT * FROM parts WHERE LEFT(`case`,10) = '1234567890'
SELECT * FROM parts WHERE `case` like '1234567890%' |
M
|
mhollibush author 6/12/2017 |
Hi buddy, case
SELECT * FROM parts WHERE LEFT(`case`,10) = '1234567890'
SELECT * FROM parts WHERE `case` like '1234567890%'
|
M
|
mhollibush author 6/12/2017 |
DUH..... I feel stupid.... Never thought of that - Thanks.... Will be trying to fix the other issue later today. I appreciate all your help
|
M
|
mhollibush author 6/12/2017 |
Well now I feel really stupid. I am doing the query and its returning nothing I know for a fact that there are multiple cases associated with a specific case I am trying to query even running the query directly in the database through phpMyAdmin - I am getting nothing?
|
admin 6/12/2017 | |
Using LEFT( |
M
|
mhollibush author 6/12/2017 |
Using LEFT( case ,10) or "like" query like @dermemo suggested is the right way to do this.
|
M
|
mhollibush author 6/12/2017 |
Just following up, did you manage to solve your problem?
|
M
|
mhollibush author 6/12/2017 |
I have tried this and the query never returns any results, even if I place a case that I know has other cases associated with the first 10 charactersin the query instead of the $data["case"] this is my code: echo "Associated Cases"; global $pageObject; $data = $pageObject->getCurrentRecord(); $sql = "SELECT * FROM cases WHERE LEFT('case',10) = ".$data["case"]." "; $rscases = CustomQuery($sql); echo "<table width='80%' border='1' bordercolor='#C0C0C0' cellpadding='5' >"; echo "<tr>"; echo "<td> Case</td>"; echo "<td> Date</td>"; echo "<td> Start Time</td>"; echo "<td> End Time</td>"; echo "<td> Repair Type</td>"; echo "</tr>"; while($data1=db_fetch_array($rscases)) { echo "<tr><td> <a href=cases_view.php?editid1=".$data1["caseId"]. ">". $data1["case"]."</a></td>"; echo "<td> "; $data1["date"] = date("l M-d-Y ", strtotime($data1["date"])); echo "". $data1["date"]."</td>"; echo "<td> ". $data1["time"]."</td>"; echo "<td> ". $data1["end_time"]."</td>"; echo "<td> ". $data1["repairtype"]."</td></tr>"; } echo "</table>"; any ideas?
|
M
|
mhollibush author 6/12/2017 |
I am thinking its the format of the case number xxxxxxxxxx-xxx if I do a query of the first 10 characters, it brings up all the cases that have those 10 characters. As soon as I add the "-xxx" ( xxxxxxxxxx-xxx ) it doesn't return any results any ideas on a way to get this to work?
|
dermemo 6/12/2017 | |
Hi buddy, $sql = "SELECT * FROM cases WHERE LEFT('case',10) = ".$data["case"]." ";
$case = $data["case"];
$case =$data["case"];
|
M
|
mhollibush author 6/13/2017 |
Hi buddy, I think this is the Problem: $sql = "SELECT * FROM cases WHERE LEFT('case',10) = ".$data["case"]." ";
$case = $data["case"];
$case =$data["case"];
|
admin 6/13/2017 | |
It is still a little confusing but I believe I'm starting to understand. You need to truncate the the search value before search is applied. where `case` like '%5320003016-123%'
where left(`case`,10) like '%5320003016%'
|
M
|
mhollibush author 6/13/2017 |
It is still a little confusing but I believe I'm starting to understand. You need to truncate the the search value before search is applied. You cannot do that in SQL Query as the value that user types into search box is not known in advance. What you need to do is to use Search API to replace where `case` like '%5320003016-123%'
where left(`case`,10) like '%5320003016%'
|
Y
|
YCH 6/14/2017 |
here is what I am trying to accomplish. each case can have additional cases associated with it example: first case: 1234567890-111 second case: 1234567890-112 third case: 1234567890-113 on the view page of each case, I want to be able to show the associated cases, only the first 11 characters will match 1234567890- the last three characters will change 111, 112, 113 the issue I am running into - I need to run a search of the column "case" and return all the records that match the first 11 characters xxxxxxxxxx- based on the current record set ".$data["case"]." the issue is that the case number is 14 characters long - how would I get it to search only the first 11 characters I hope that makes sense - I looked at the pages you sent, and the API makes sense, but I need to somehow only look at the first 11 characters.. this is where I am lost I am still digging and testing <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=82403&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
|