Jump to content

shmideo

Members
  • Posts

    63
  • Joined

  • Last visited

Everything posted by shmideo

  1. Thanks for your reply. Well the submit part is done in a standard html way, the validation is done in php which is part of the same file. It doesn't reload the page after submit, hence you have to scroll up. to see the message.
  2. Hi Been struggling to find a way to automatically go to the top of the page after the php contact form is executed, when the success message is displayed. Probhlem I have is that the form is quite long and when it is filled in the success or failure message is not fully seen as it displays at the top. Thanks Code below: <div class="row"> <div class="col-md-6"> <div class="offset-anchor" id="contact-sent"></div> <?php if (isset($arrResult)) { if($arrResult['response'] == 'success') { ?> <div class="alert alert-success" id="contactSuccess"> <strong>Success!</strong> Your message has been sent to us. </div> <?php } else if($arrResult['response'] == 'error') { ?> <div class="alert alert-danger" id="contactError"> <strong>Error!</strong> There was an error sending your message. (<?php echo $arrResult['error'];?>) </div> <?php } else if($arrResult['response'] == 'captchaError') { ?> <div class="alert alert-danger" id="contactError"> <strong>Error!</strong> Verificantion failed. </div> <?php } } ?>
  3. The queries merge ok and results are correct except I get a notice: "Notice: Use of undefined constant UNION - assumed 'UNION' in...." But is UNION a constant or is the context wrong? $query = $query1." ".UNION." ".$query2; $result = mysqli_query($dbcon, $query) or die('Error getting data'); $num_rows = mysqli_num_rows($result);
  4. Yes exactly, however I have no control of the table layout but I'll give this a try. Thanks for your help.
  5. Thanks Barand, This works, but due to the clid format, which for example: "Client-1-+012345678" <012345678>" . There may be several instances of the same number. It groups by clid and it does exactly as it's supposed to, but I'm trying to get a count for all rows per client, so is there a way to group by clid except say maybe only by the client name, ie, ignore everything after the '-+'?
  6. Hi Could do with some help. I have 20 clients (client-1, client-2, client-3) and so on. Each client makes several calls per day. How can I get a row count from two columns (Date, clid) and echo the count for each client?
  7. Hi, I'm using $clid = mysqli_real_escape_string ($dbcon, $_POST['clid']); but have come across an issue with certain characters, for example: "bekæ" actually searches for "bekæ", hence no records. The records cannot be changed in the table, so is there a way to fix this?
  8. No for some reason if that condition is present then no results are found for ones that don't require it. Can you give an example of a dynamic field to output please?
  9. Hi I have a form that has a drop-down with a few to choose from, unfortunately I don't get results for some due to the query involved. Some need the AND channel LIKE '%$channel%'"; and some don't and therefore will not get desired results. So I would like to run two queries one with and one without. $query = "SELECT * FROM asterisk_cdr WHERE calldate BETWEEN '$calldate' AND '$calldate2' AND clid LIKE '%$clid%' AND channel LIKE '%$channel%'"; Thanks
  10. I managed to get it working. echo substr($row['columnname'], 6, 3); This just displays those 3 digits. Local/ is always there, the rest changes, so just wanted the 3 digits to show. Sorry for the confusion
  11. Thanks Barand, I should have mentioned that the 3 digits will always change but after that it will also change. Sorry I should have been clearer.
  12. Hi Using: echo $row['columnname']; How can I strip off data from the above echo? The column always begins with 'Local/' then 3 digits then other unwanted data, lke 'Local/567@context-0000461d;1'. It would be ideal to just display '567'.
  13. Yes Ch0cu3r, that did the trick! Thanks for all the help, really appreciated.
  14. Thanks guys but still not filling in blank cells. $dstchannel seems to be the problem but don't know how to validate. 'dstchannel' echo's the non-empty rows ok as does the 'calldate' and 'clid' echo "<tr><td width='20%'>"; echo $row['calldate']; echo "</td><td width='30%'>"; echo $row['clid']; echo "</td><td width='30%'>"; if (empty($dstchannel)) { echo $row["no Data"]; } else { echo $row['dstchannel']; } echo "</td><td width='20%' style='text-align:right'>"; echo $row['duration']; echo "</td></tr>";
  15. Hi, I have results from a MySQL table column which does an echo into a table cell, but some of the results from the table column is be empty, so is there a way to fill in the blanks with text like "No data"?
  16. The code is working correctly with the exception of the end date. For some reason the query (BETWEEN) is not showing the end date. The form has the fields 'calldate' and 'calldate2' (from and to). If I select 2014-11-17 to 2014-11-18, I only get data for the 17th. Selecting 2014-11-17 to 2014-11-19, I get data for 17th and 18th. Nothing seems to fix, even tried <= and >=
  17. Sorry ignore that, just realised using echo $row['calldate']; which cotains the rows partially works. Showing correctly except it's omitting records for the to end datye 2014-11-18
  18. From echo $query I get: SELECT * FROM WHERE callable BETWEEN '2014-10-11' AND '2014-11-18' AND clid LIKE '%Client X%' AND channel LIKE '%SIP/123456%' AND duration 1821 results found For Date: '2014-10-11' - '2014-11-18' Client ID: 'Client X' So the query works after removing the %s and dusplays rows except the date field has an error: "Notice: Undefined index: calldatecalldate2 So this context is wrong: $calldatem = "calldate" . "calldate2"; But if I try this instead it errors on the 2nd variable "Undefined index: calldate2" echo $row['calldate']; echo $row['calldate2'];
  19. Here's the code: If($calldate){ $query = "SELECT * FROM callable WHERE calldate BETWEEN '$calldate' AND '$calldate2' AND clid LIKE '%$clid%' AND channel LIKE '%$channel%' AND duration"; $result = mysqli_query($dbcon, $query) or die('Error getting data'); $num_rows = mysqli_num_rows($result); echo "<br>"; echo "$num_rows results found"; echo "<br> For Date: '$calldate' - '$calldate2'"; echo "<br> Client ID: '$clid'"; echo "<p> </p>"; echo "<table width='100%' border='1px'>"; echo "<tr bgcolor='#EEEEEE'><th width='20%'>Date</th> <th width='60%'>Client ID</th> <th style='text-align:right' width='20%'>Call Duration</th></tr>"; $tot = 0; while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $tot += $row['duration']; $calldatem = "calldate" . "calldate2"; echo "<tr><td width='20%'>"; // echo $row['calldate']; // echo $row['calldate2']; echo $row[$calldatem]; echo "</td><td width='60%'>"; echo $row['clid']; echo "</td><td width='20%' style='text-align:right'>"; echo $row['duration']; echo "</td></tr>"; } $tot = $tot / 60 / 60; echo "</table>";
  20. Thanks, that shows the result, but I'm trying to get 2 variables from the form now (from date - to date) ....WHERE calldate BETWEEN '$calldate' AND '$calldate2'; (this works after removing the %s) but only working for the first variable. Trying to echo both variables so that they will display one after the other, then I get "Notice: Undefined index: calldatecalldate2 in" I know I have the syntax wrong, but cannot find the answer on the web, hope you can help. $calldatem = "calldate" . "calldate2"; echo $row[$calldatem]; Have also tried this but same error for the second variable. echo $row['calldate']; echo $row['calldate2'];
  21. Hi Been trying to run a query to get all rows from a table between two dates, but nothing seems to work. $query = "SELECT * FROM table WHERE date BETWEEN '%2014-11-17%' AND '%2014-11-18%'"; Strange thing if I try a search instead a query in phpmyadmin I don't see an operator called 'BETWEEN' on the remote host, but I do on my localhost. Does this mean it will never work on the remote host? Nevertheless it doesn't work on either and I do have records for both dates in the table. phpmyadmin: Version 4.1.14 localhost (wamp) Version 3.3.7deb7 on remote server Thanks
  22. Ah yes! Been so wrapped up in PHP that I forgot about doing this in html. Thank you so much.
×
×
  • 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.