Jump to content

drewdan

Members
  • Posts

    47
  • Joined

  • Last visited

Everything posted by drewdan

  1. What code are you using to query your database? <?php $conn = mysqli_connect("localhost", "yourusername", "yourpassword") or die(mysqli_error($conn)); mysqli_select_db($conn, "yourdb") or die(mysqli_error($conn)); $client = $_GET['client']; $query = "select * from tablename where client='$client'"; $result = mysqli_query($conn, $query); $count = mysqli_num_rows($result); if($count==0) { echo "No Results Found"; } else { $table = '<table>'; while($array=mysqli_fetch_array($result)) { $table .= '<tr><td>' . $array['name'] . '</td><td>' . $array['otherdetail'] . '</td></tr>' } $table .= '</table>'; } echo $table; ?> or something like that anyway is what you will need to write to query a database and generate a html table to be output into the browser
  2. Hi, Thanks for the information, very helpful. The tutorial I am following is here: http://docs.joomla.org/J3.2:Developing_a_MVC_Component/Adding_backend_actions For some reason the data is duplicated on save instead of being updated. Very annoying!
  3. Hi All, Currently building a Joomla component. Having an issue with data being duplicated when I click the save button. Instead of the item in the database being updated a new item is being created, has anyone faced this issue before? I am wondering if it might be to do with my database design. I have named the primary key as journal_id, but I see in the tutorial it is set just to id, is this a requirement for Joomla to function properly? Any help with this issue would be gratefully received. Andrew
  4. Cheers for the info, I will relay it back to my client and let them know
  5. Hey there, slow reply I know. I was not missing the point, I understand that it is downloadable. What I meant was I would look for a way to make it more difficult to download the PDF. My thought so far is to convert the PDF into JPG images. This means I can put them on the page and use jQuery to create a navigation system to "turn the page" I would then have a transparent div over the top of the jpg so if anyone tried to right click and save the image they would just get a empty transparent gif. I would also implement some hotlink protection too. Of course the images would still be downloaded into the cache and anyone who viewed the source code could find the location of the image to download it, but it would be a little more difficult to do!
  6. Hi All, I am currently trying to learn how to build Joomla Components. I am building a component which will function as a "Magazine Library". I have been following the guide found here and modifying it accordingly to fit my needs: http://docs.joomla.org/J3.2:Developing_a_MVC_Component/Adding_backend_actions I am doing quite well, but I seem to have hit a snag, during development I changed the name of one of the views from journallibraries to journallibrarys, just to make it a little easier to follow the guide. I have the first view which outputs a list of the magazine articles in a table and has a menu at the top to "Add", "Edit" and "Delete". When clicking the Add and Edit function the next view loads fine which shows the form to allow adding or editing of an item. The menu also appears so you can save & close or just close. When I click Save & Close or indeed Close, it redirects to a form which does not exist, which is the "journallibraries" form which was originally in this component. I have been through all of the code and I cannot find a single reference to this view, what I want to know is if anyone has had a similar problem to this, or if anyone knows where the code might be which is responsible for the actions that occur when "Save" is selected. I have uploaded the component admin part (which is all I have done so far), so if anyone has 5 minutes to help me identify this problem I would be eternally grateful! Cheers, Andrew com_journallibrary.zip
  7. Hi Psycho, Thanks for the quick response, the majority of the users of this website will not be tech savvy, so hopefully there wont be much risk involved. I think the best scenario is to make it as difficult as possible for the user to gain access and download the PDF, my customer does not want watermarking or anything like, so I think I will have to get creative! Thanks for your help!
  8. Hi All, I have a question for you all. My client would like a component developed for Joomla that will allow them to upload PDF magazines to the website and then it be output on the PDF in a secure format so they cannot be downloaded or copied. Does anyone know of an open source solution that might enable me to do this. The requirement is that this not be made using flash so that it will work on iOS devices. There are two ways I can see this working, either when the PDF is uploaded it gets converted into a different format so it can simply be integrated into the page when output, or the PDF gets uploaded as it, and it output in some wrapper that will protect it, im really not quite sure, you any advice will be great! Thanks for your help! I look forward to hearing your responses.
  9. Also on line 87 you have @mail($email_to, $email_subject, $email_message, $headers); change that to: mail($email_to, $email_subject, $email_message, $headers); and see what that does
  10. Have you got error reporting turned on? error_reporting(E_ALL); Insert that into your script and run it again and see if any errors are produced and let us know what they are.
  11. Im not sure, as I have never used this before, but something like this might work? $fp = fsockopen("www.example.com", 80, $errno, $errstr, 30); if (!$fp) { echo "website not found"; } else { echo "website found"; }
  12. Thank you very much, this worked a treat!
  13. if you want to do this without refreshing the page you will need to use jQuery (AJAX). PHP script execute before the page loads, to make things change without a page refreshing you will need to use jQuery as that runs client side.
  14. You set the errors to E_ALL, which displays everything, even errors that do not actually mean much. Because your variable was undefined, the error was pointing this out. For example, if you have a form on a page and you have some php script on the same page that will receive the data and process it with a line of code like: $variable = $_GET['form_item']; If the $_GET is not collecting any data because the form has not been submitted, you will get a nice error. I often use this: $action= isset($_REQUEST['action']) ? $_REQUEST['action'] : null; That stops the error for me. Hope that helps!
  15. Hi Guys, I am trying to create a script which send a customer an invoice when they place an order. I have written the following code and this works when sent to an email address which is opened using gmail or the iPhone email client, but Microsoft Outlook screams a great big no at me, and just shows me the html in plain text. Any thoughts anyone? I have included the code below: <?php include("includes/conn.php"); $id=1; $random_hash = md5(date('r', time())); $subject="Red Van Tool Sales - Invoice: "; $headers = "From: sales@redvantoolsales.co.uk" . "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; /*$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; $user=isset($_COOKIE['user']) ? $_COOKIE['user'] : null; $sql="select * from user where user_email='$user'"; $sql_res=mysqli_query($conn, $sql) or die(mysqli_error($conn)); while($array=mysqli_fetch_array($sql_res)) { $uid=$array['user_id']; } */ $sql="select * from orders inner join payment_options on orders.payment_options_id=payment_options.payment_options_id inner join postage_options on orders.delivery_id=postage_options.postage_options_id inner join user_address on orders.delivery_address_id=user_address.user_address_id inner join user on orders.user_id=user.user_id where orders.orders_id='$id'"; $sql_res=mysqli_query($conn, $sql) or die(mysqli_error($conn)); $count=mysqli_num_rows($sql_res); if($count==0) { //header("Location:noauth.php"); echo "fail"; } else { while($array=mysqli_fetch_array($sql_res)) { $order_id=$array['orders_id']; $subject .= $order_id; $order_date=date("d/m/Y", $array['orders_date']); $orders_total=number_format($array['orders_total'],2); $order_subtotal=number_format($orders_total/1.2,2); $vat=number_format($orders_total-$order_subtotal,2); $shipping_total=number_format($array['shipping_total'],2); $payment_fee=number_format($array['payment_fee'],2); $payment_options_name=$array['payment_options_name']; $postage_options_name=$array['postage_option_name']; $user_forename=$array['user_forename']; $user_surname=$array['user_surname']; $address_address=$array['address_address']; $address_city=$array['address_city']; $address_postcode=$array['address_postcode']; $shipping_time=$array['postage_option_shipping_time']; $shipping_time = $shipping_time*86400; $expected_arrival=$array['orders_date']+$shipping_time; $expected_arrival=date("d/m/Y", $expected_arrival); $emailto = $array['user_email']; } } ob_start(); //Turn on output buffering ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="http://www.redvantoolsales.co.uk/invoice.css" media="print"> <link rel="stylesheet" type="text/css" href="http://www.redvantoolsales.co.uk/invoice.css" media="screen"> </head> <body> <div id="cont"> <div id="container"> <div id="topbar"> <img class="logo" src="http://www.redvantoolsales.co.uk/images/logo.png"> <div id="companyaddress">Red Van Tools<br>Address<br>City<br>Postcode<br>VAT: 000000000<br>sales@redvantoolsales.co.uk<br>01633 000000<br>www.redvantoolsales.co.uk</div> </div> <div id="nextbar"> <div id="customeraddress"><?php echo $user_forename . " " . $user_surname; ?><br><?php echo $address_address; ?><br><?php echo $address_city; ?><br><?php echo $address_postcode; ?></div> <div id="invoicedetail">INVOICE <?php echo $order_id; ?><br><?php echo $order_date; ?></div> </div> <div id="orderdetailbar"> <table> <tr><th width="333">Payment Method</th><th width="333">Order Date</th><th width="333">Estimated Delivery Date</th></tr> <tr><td><?php echo $payment_options_name; ?></td><td><?php echo $order_date; ?></td><td><?php echo $expected_arrival; ?></td></tr> </table> </div> <div id="orderitembar"> <table> <tr><th width="120">Quantity</th><th width="500">Details</th><th width="120">Unit Price (£)</th><th width="120">VAT</th><th width="120">Net Subtotal (£)</th></tr> <?php $sql="select * from order_item inner join products on order_item.product_id=products.product_id inner join price on products.product_id=price.product_id where orders_id='$id'"; $sql_res=mysqli_query($conn, $sql) or die(mysqli_error($conn)); while($array=mysqli_fetch_array($sql_res)) { $total = number_format($array['product_price']*$array['product_qty'],2); echo "<tr><td>" . $array['product_qty'] . "</td><td>" . $array['product_name'] . "</td><td>" . number_format($array['product_price'],2) . "</td><td>20%</td><td align=\"right\">" . $total . "</td></tr>"; } ?> </table> </div> <div id="totals"> <table> <tr><td>Net Total</td><td><?php echo $order_subtotal; ?></td></tr> <tr><td>VAT</td><td><?php echo $vat; ?></td></tr> <tr><td><b>GBP Total</b></td><td><b>£<?php echo $orders_total; ?></b></td></tr> </table> </div> </div> </div> </body> </html> <?php $message1 = ob_get_clean(); mail( $emailto, $subject, $message1, $headers ); ?> Thanks guys!
  16. Hi, Im not quite sure I get exactly what you are trying to achieve or how you are planning on going about it. How do you plan on submitting the data from the form? Do you want to do this using AJAX so the page itself does not change? I cannot see any <form submit="page.php"> or anything like this, so can you explain how you see this working when its complete? Andrew
  17. Would you be able to show us your file upload script? It is possible you have an error in your PHP script. If not, this probably is not the forum to be posting in, as its a server error not a PHP error, but maybe someone here can help you! Best of Luck Andrew
  18. Well, im glad I asked. Thank you, that code worked a treat!
  19. can you print_r($arrResult) and tell us what is displayed?
  20. Hi Guys, Just want to run past an idea I am having, I want to make sure the logic is sound. Basically, I am making a website statistics feature for my Content Management System. I want to create a function that will work out the most visited pages on the website. I currently collect a multitude of data, which is stored in a table in my database. Each time a person loads a page the data is added to the table. Some of that data includes the page id. My plan is call this data from the database and add the data to an array. As the rows of the table are being looped through, the script would check to see if the pageid is already in the array, and increment the count, and if not add it to the array until it has collected all of the logs. The array would then be sorted and the top 10 pages would be shown in a graph on the website. Does that logic make sense? Is there a simpler way of doing it? Any input would be great. Thanks!
  21. Welcome to the forum, if your problem is solved, mark it as solved.
  22. I would imagine it queries a database looking for your search term. The content of this website is probably database driven which allows this to happen.
  23. You basically want to use the function the developer is showing you called: calc_postcode_seperation($pcodeA,$pcodeB) You will then need to compare the postcode the user entered with all of your entries in your database, using a loop, then use an if statement to see if they are located less than 10km or whatever from the postcode entered by your user andif they are, add the details to an array and then output the data collected in the array onto your page at the end. The developer provides you with an sql file with all of the postcode details. I am assuming you are located in the UK?
  24. In fact this might explain it better still: http://www.sloomedia.com/php_postcode_script.php
  25. This might explain what you would need to do better: http://stackoverflow.com/questions/2296087/using-php-and-google-maps-api-to-work-out-distance-between-2-post-codes-uk
×
×
  • 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.