Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About JackW

  • Rank
  • Birthday 10/18/1946

Contact Methods

  • Website URL
  1. JackW

    Update to php 7 problem with checkbox form

    Thank you!! I have been the most of two days trying to figure that out. Now to incorporate it into the form on the actual page. Below is the code that worked. $i = 1; // Initialize $i outside the loop echo '<table class="one" width="500" border="0" cellpadding="0" cellspacing="0" align="center">'; $resource = $db->query("SELECT * FROM `outside_levy` WHERE `budget_year` = '".$budget_year2."' AND `department` != '".$blank."' AND `levy_type` != '".$tax_credit."' AND `levy_type` != '".$tax_credit_ag."' ORDER BY `rank` ASC, `levy_type` ASC, `department` ASC LIMIT 0, 40"); while ($row = $resource->fetch_assoc() ) { echo '<tr><td width="90%">'; echo '<div class="levy2">'; echo $i++; echo '<b>'; $tax=number_format(($row ['levy'] )*$value2, 2); echo ' &nbsp; '; echo ($row ['department'] ); echo '</b></div>'; echo '</td><td width="10%"><div class="rightblack">'; echo $tax; echo '</div>'; echo '</td></tr>'; }
  2. I am updating a website to php7 from php5. The project was going well until I come to this page. The page actually uses a form to transfer information to the next page with the checkboxs numbered as ($i+1). The code below in not the form but I "think" that if I can get that code to work I can make the form work. I need to place 1, 2, 3, etc in the result from the php7. when I leave out (for ($i=0; $i < $match_results; $i++)) and (echo ($i+1);) the rest works fine but my form boxes are not numbered so will not transfer to the next page. The link below is the page that works with php5 with the checkbox form on the right. http://www.sheridancountyne.com/levy_page.php?year=2017&amp;value=56000 The below code works with php5 <html> <body> <?php require ("$path/require/connect.php"); $budget_year2=("2017"); $tax_credit=("Tax Credit"); $tax_credit_ag=("Tax Credit Ag"); $show=("show"); $base=("Base"); $value2=("50000"); echo '<table class="one" width="500" border="0" cellpadding="0" cellspacing="0" align="center">'; $query= ("SELECT * FROM `outside_levy` WHERE `budget_year` = '".$budget_year2."' AND `department` != '".$blank."' AND `levy_type` != '".$tax_credit."' AND `levy_type` != '".$tax_credit_ag."' ORDER BY `rank` ASC, `levy_type` ASC, `department` ASC LIMIT 0, 40"); $query_results=mysql_query($query); $match_results=mysql_num_rows($query_results); for ($i=0; $i < $match_results; $i++) { $row=mysql_fetch_array($query_results); echo '<tr><td width="90%">'; echo '<div class="levy2"><b>'; $tax=number_format(($row ['levy'] )*$value2, 2); echo ($i+1); echo ' &nbsp; '; echo ($row ['department'] ); echo '</b></div>'; echo '</td><td width="10%"><div class="rightblack">'; echo $tax; echo '</div>'; echo '</td></tr>'; } echo '</table>'; mysql_close($db); ?> </body> </html> I need to place the code for ($i=0; $i < $match_results; $i++) and echo ($i+1); in the new code for php7 below. <html> <body> <?php require ("$path/require/connectphp7.php"); $budget_year2=("2017"); $tax_credit=("Tax Credit"); $tax_credit_ag=("Tax Credit Ag"); $show=("show"); $base=("Base"); $value2=("50000"); echo '<table class="one" width="500" border="0" cellpadding="0" cellspacing="0" align="center">'; $resource = $db->query("SELECT * FROM `outside_levy` WHERE `budget_year` = '".$budget_year2."' AND `department` != '".$blank."' AND `levy_type` != '".$tax_credit."' AND `levy_type` != '".$tax_credit_ag."' ORDER BY `rank` ASC, `levy_type` ASC, `department` ASC LIMIT 0, 40"); while ($row = $resource->fetch_assoc() ) for ($i=0; $i < $match_results; $i++) // this does not work here in php7 how do I write a code that will work with (Si+1) below { echo '<tr><td width="90%">'; echo '<div class="levy2"><b>'; $tax=number_format(($row ['levy'] )*$value2, 2); echo ($i+1); //this is the part that will not work in php7 echo ' &nbsp; '; echo ($row ['department'] ); echo '</b></div>'; echo '</td><td width="10%"><div class="rightblack">'; echo $tax; echo '</div>'; echo '</td></tr>'; } echo '</table>'; $db->close(); ?> </body> </html>
  3. I have a website that has worked fine for several years. It uses php and a mysql data base. I can still make changes to the data base, but have a hard time getting the new text to show up. It is changed in the data base but the browser insists on showing a cached copy. In the past it worked fine. Don't know what changed. I also use a cookie set by a user name and password and now when I click on the log out function, I need to refresh the log out page before it logs me out. I have looked for a method to disable the cache but nothing I have found works. The site is on a Windows server, not by my choice. Any ideas?
  4. JackW

    Add a link code question

    Thank you, I believe I can work with that and it will do just what I want it to do. JackW
  5. JackW

    Add a link code question

    Thanks, I may be able to make that work. What I really need is just a simple piece of code that does the link part provided in the rich text editor. That may well not be something that is available. JackW
  6. JackW

    Add a link code question

    I am developing a website where my client can update the text using simple forms. I have developed several such site using php and a MySQL database. My current client wants to have the ability to add links within the text without typing the full link code. The form I am using to post this question has the function I need. A box pops up where one can put in the url and form a link. Can someone tell me how to create that function for my page?
  7. JackW

    File Upload To Windows Server Help

    Thank you! Thank you! Thank you! That Worked! I can't believe the number of hours I spent trying to find the answer because I was too stuborn to ask for help.Have a Merry ChristmasJackW
  8. JackW

    File Upload To Windows Server Help

    I have several sites on Linux servers where I have set it up so the site owner can upload picture files. Below is a simplified version of the code used. (without security features that are on the real sites.)Now I have a client that would like this feature on his site, but it is hosted on a windows server. The code does not work on his site.Html form Page code: <body><form enctype="multipart/form-data" action="upload.php" method="POST">Please choose a file: <input name="uploaded" type="file" /><br /><input type="submit" value="Upload" /></form></body> Php page code: <body><?php$target = "upload/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";} else {echo "Sorry, there was a problem uploading your file.";}?></body> The html code is in a folder named test. That same folder named test contains a folder named upload. I set up the windows hosted site and one of my linux hosted sites exactly the same. On the linux server I get this message: “The file 100_0095.jpg has been uploaded” and the file is in the folder.On the windows server, no file in folder, and I get this message:“Warning: move_uploaded_file(upload/100_0095.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in D:\Hosting\5310323\html\test\upload.php on line 19Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\Temp\php\php6435.tmp' to 'upload/100_0095.jpg' in D:\Hosting\5310323\html\test\upload.php on line 19Sorry, there was a problem uploading your file.”I have been looking for solutions and trying different things for 2 days. What am I doing wrong.Some one suggested it was a CHMOD problem. That is not the case on Linux. I don't have a clue about permissions on Windows. This is my first and I hope last experience with a windows server.Thank you for any help you can give.Is it possible to upload files to windows servers and how is it done?
  9. JackW

    Php Require Question

    Thanks, I will play with it some more. Just knowing that it should work helps a lot. Maybe I have some brackets in the wrong place.
  10. JackW

    Php Require Question

    Thank you and please do not spend a lot of time here as copy and paste will work.I will try to explain what I am trying to do.I have a data base with 3 tables. One contains product information. Item name, number, and price.One contains customer information. Customer Number, City, State, County.One contains tax rates for the City, State, and County where my client is required to collect sales tax when shipped to that City, State, and County.From the product table I can create variables for the product informationI can connect to the data base and with the Customer Number get the City State and County. Take that information to the tax rate tables and get the City, County and State tax rates and add those three to come up with a tax rate for the sale.Those variables then need to be placed in the shopping cart button form. This shopping cart button form is what I would like to insert with the require function. See the sample code.<?phpecho '<form target="cart" action="https://www.cart_URL" method="post"><input type="hidden" name="business" value="Bussiness_Code"><input type="hidden" name="item_name" value="';echo $title;echo '"><input type="hidden" name="item_number" value="';echo $stocknumber;echo '"><input type="hidden" name="amount" value="';echo $cost;echo '">';echo '<input type="hidden" name="tax_rate" value="'echo $tax_rate;echo '">';echo '<input type="hidden" name="add" value="1"><input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_SM.gif:NonHosted"><input type="image" src="cart_button" border="0" name="submit" alt="Add to Cart Button"><img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"></form>';?> When I use the php opening and closing, it doesn't let me use the variables I have created.When I do not use the php opening and closing it writes it as html and of course doesn't let me insert the variables I have created.I can copy and paste the code (without the open php and close php) in each place it is needed and it will work. Note: I did remove some lines from the total button code so it may contain errors that are not in the complete code.Thanks again for your help.
  11. JackW

    Php Require Question

    You are correct in that what I am getting is the html content. On the complete page I have the php tags and it connects to the data base to get the information that would be included in the sample script. It is likely that what I want to do can not be done.When I include the php tags it does not allow the content from the data base to be inserted. I could include the complete code in the part that is accessed by require, but that would mean opening and closing the data base 10 times on the page. I would enclude the entire code for the page but there is 1067 lines on the page.I think that copy and paste may be the answer as it will work that way. Just looking for a simpler way to do it. Thanks for your help.
  12. JackW

    Php Require Question

    I am working on a website where I would like to include or require a line of code within a mysql query. Is this possible?I can write the page and everything works fine. However as the query is repeated several times and on several pages and also needs to be changed on occasion I would like to use the require function so I would only have to change it once to have it changed in all applications.Just a piece of the code is included in the text box for reference. As I said when I write the entire code in the pages it works fine. Just looking for a way to include it without writing it many times. echo '<input type="hidden" name="item_name" value="';echo ($row ['title'] );echo '"><input type="hidden" name="item_number" value="';echo ($row ['stock'] );echo '"><input type="hidden" name="amount" value="';echo $shipped;echo '">'; When I use the require function, of course it places the code on the html page with echo ' and '; showing on the page instead of allowing it to be a part of the php mysql function.Thanks in advance for any help you may be able to give.
  13. JackW

    Change text based on database content?

    I do believe that is going to work. The tests so far are all positive.You are a wonder.Thank you so much.Jack
  14. Change text based on database content?I have a database full of items in several categories.Examples are:Cowhide/Leather Milano style FurnitureCowhide/Leather Remington style FurnitureCowhide/Leather Winchester style FurnitureLampsAccessoriesPine FurnitureEtc.What I want to do is write a code so when a link is clicked and the description page comes up the description for any item with Cowhide/Leather in the category name has some different text than what is on all the other pages. Example: This is a special order item.The code I have below seems to work for Cowhide/Leather Milano style Furniture. Is there a way I can write it so that it will echo the correct text for all of the categories that contain the word Cowhide/Leather?Your help will be greatly appreciated. <?php$code=$_GET['code'];$style='Cowhide/Leather Milano style Furniture';@ $db = mysql_pconnect('myserver.net', 'mydatabase', 'password');mysql_select_db('mydatabase') or die( "Unable to select database");{$query= "select * from `table` where `ID` = '".$code."' order by ID DESC";$query_results=mysql_query($query);$match_results=mysql_num_rows($query_results);}for ($i=0; $i < $match_results; $i++){$row=mysql_fetch_array($query_results);if($row ['category'] ==$style){echo '<p class="centerbrown">';echo 'Write Something here';echo '</p>';}else{echo '<p class="centerbrown">';echo'Write something Different';echo '</p>';}}mysql_close($db);?>
  15. JackW

    Order by Random

    Thank you both. That did it. The new code is below and works like a charm. @ $db = mysql_pconnect('myserver','mydatabase','mypassword');mysql_select_db('mydatabase') or die( "Unable to select database");$query= 'SELECT * FROM `sponsors` order by RAND() LIMIT 0, 15 ';$query_results=mysql_query($query);$match_results=mysql_num_rows($query_results);for ($i=0; $i < $match_results; $i++){$row=mysql_fetch_array($query_results);echo '<a href="';echo($row ['url'] ), '"', '>';echo($row ['name'] ), '</a><br>';echo($row ['comment'] ), '<br><br>';}mysql_close($db);