Jump to content

dlebowski

Members
  • Posts

    262
  • Joined

  • Last visited

Everything posted by dlebowski

  1. Is there anything I can run that will strip the apostrophe? I don't want them in there anyway.
  2. What is happening is when it gets to the line above, it sees the ' in Torch's as an enclosure and it then creates an extra column.
  3. Thanks for the quick reply. It still isn't getting past that. It is breaking on this line if I manually remove the apostrophe in "Torch's" prior to the import, it works: 1, "Snap-On Torch's Bit Sockets", 8 Pieces, 2, "0000-00-00"
  4. Below is my code for fgetcsv. If a column in my import contains an apostrophe ' , then it errors out. It breaks my column separation. Does anyone know how I could remove apostrophes prior to being imported or can I some how write the query to ignore the apostrophe. Thanks in advance! if(isset($_POST['submit3'])) { $fileupload=$_POST['fileupload']; $filename="$fileupload"; $auctiondate=$_POST['auctiondate']; $handle = fopen("$filename", "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $column1=$_POST['column1']; $column2=$_POST['column2']; $column3=$_POST['column3']; $column4=$_POST['column4']; $column5=$_POST['column5']; $column6="$auctiondate"; $onlineonsite=ONSITE; $lotpaymentexempt=NO; $import="INSERT into test(LotID,LotNumber,LotTitle,SellingPrice,Buyer,LotPaymentExempt,OnlineOnsite,AbsenteeBid,SellerNumber,LotAuctionDate) values('', '$data[$column1]','$data[$column2]', '$data[$column3]','', '$lotpaymentexempt', '$onlineonsite', '$data[$column4]', '$data[$column5]', '$column6')"; mysql_query($import) or die(mysql_error()); } fclose($handle);
  5. I have not been able to figure out how to capture the column headings from a file on my web server in variables to be used in a .php script. For example. File Headers: ID, NAME, OCCUPATION, DATE I would like a script that would grab those headers in a file and store them in variables: $ID=ID $NAME=NAME $OCCUPATION=OCCUPATION $DATE=DATE Thank in advance.
  6. Thanks for the detailed response. I think I can handle all of those things mentioned in your post with the exception of: What kind of query would I run to count the fields in a file? Thanks again.
  7. The client will have a .csv file that looks like this: ID, TITLE, DESCRIPTION, DATE 3, Pontiac, 4 Door, 2007-08-15 The database will look something like this: ID, TITLE, DESCRIPTION, DATE Once they are logged into the website, I want them to be able to go a page on the site where they can click on a "Browse" button to find the .csv file on their machine. Once they find it, I want them to be able to match up the columns in their .csv file with the corresponding columns in the database. Once they are matched up, click submit and the script inserts or updates the records in the database accordingly.
  8. I want to give my clients the ability to import a .csv file from the website into their mysql database. I want them to be able to browse to the .csv file on their machine, select the fields they want to import and match them up with the fields in the MySql DB. Then submit the import. Is anyone aware of any good tutorials or threads here in the forum that show me how to do this? I may have overlooked them in my search over the last couple of days. Thanks in advance.
  9. We have a web app that runs on our web server (Red Hat) here on our LAN and everything works great. When we connect to it remotely, there are a couple of links within the application that don't resolve correctly. For example: LAN: If a person browses to http://portal/portal it automatically resolves to http://portal/portal/site/hpp/ throughout the application. Remote: If a person hits the site remotely through out vpn client, certain links want to only route to portal/portal. Do I need to add a .htaccess file or make another modification to make sure that it always routes to the portal/portal/site/hpp no matter what? Any help would be appreciated. Thanks. Ryan
  10. Andy, I can't thank you enough man. Take care. Ryan
  11. Andy, I replaced if(isset($_POST['submit1'])){ with if (isset($_POST['submit1_x'])) { and it appears to be working now in IE. It updates the database just fine. So do I just leave it as that? Is that all it was?
  12. All the queries contain what they are suppose to when the form is submitted because I confirmed that the data base is updated correctly after the submit for each field. It will not submit anything correctly when I have the images in there for the buttons. So it either all is submitted correctly in Firefox or nothing is submitted correctly in other browsers. Here is what it actually is <td><input type="image" value ="ADD" name="submit1" src="images/tick.png" alt="SUBMIT"></td> <td><input type="image" value ="ADD" name="submit2" src="images/tick2.png" alt="SUBMIT"></td> Here is the "GET" piece. <? include("dbinfo.inc.php"); $conn = mysql_connect("localhost",$username,$password) or die(mysql_error()); $db = mysql_select_db($database,$conn) or die(mysql_error()); // get the page number or set default $page = (is_numeric($_GET['page']) && $_GET['page'] > 0) ? $_GET['page'] : 1; // Define the number of results per page $max_results = 10; // Figure out the limit for the query based // on the current page number. $from = (($page * $max_results) - $max_results); // going to make some links to click in order for // user to sort by whichever column $allowed = array('LotNumberASC', 'LotNumberDESC', 'LotTitleASC', 'LotTitleDESC', 'SellingPriceASC', 'SellingPriceDESC','BuyerASC', 'BuyerDESC', 'OnlineOnsiteASC', 'OnlineOnsiteDESC', 'LotPaymentExempt','AbsenteeBidASC', 'AbsenteeBidDESC', 'SellerNumberASC', 'SellerNumberDESC', 'LotAuctionDateASC', 'LotAuctionDateDESC'); $sortby = (in_array($_GET['sortby'],$allowed)) ? $_GET['sortby'] : 'LotNumber'; // build and run the sql query //$query = "select * from customers order by $sortby limit $from, $max_results"; //$getlist = mysql_query($query, $conn) or die(mysql_error()); // get value of id that sent from form submission $LotAuctionDate=$_GET['SelectLotAuctionDate']; if ($sortby=="LotNumberASC") { $sortby = "LotNumber ASC"; } elseif ($sortby=="LotNumberDESC"){ $sortby = "LotNumber DESC"; } elseif ($sortby=="LotTitleASC"){ $sortby = "LotTitle ASC"; } elseif ($sortby=="LotTitleDESC"){ $sortby = "LotTitle DESC"; } elseif ($sortby=="SellingPriceASC"){ $sortby = "SellingPrice ASC"; } elseif ($sortby=="SellingPriceDESC"){ $sortby = "SellingPrice DESC"; } elseif ($sortby=="BuyerASC"){ $sortby = "Buyer ASC"; } elseif ($sortby=="BuyerDESC"){ $sortby = "Buyer DESC"; } elseif ($sortby=="OnlineOnsiteASC"){ $sortby = "OnlineOnsite ASC"; } elseif ($sortby=="OnlineOnsiteDESC"){ $sortby = "OnlineOnsite DESC"; } elseif ($sortby=="AbsenteeBidASC"){ $sortby = "AbsenteeBid ASC"; } elseif ($sortby=="AbsenteeBidDESC"){ $sortby = "AbsenteeBid DESC"; } elseif ($sortby=="SellerNumberASC"){ $sortby = "SellerNumber ASC"; } elseif ($sortby=="SellerNumberDESC"){ $sortby = "SellerNumber DESC"; } elseif ($sortby=="LotAuctionDateASC"){ $sortby = "LotAuctionDate ASC"; } elseif ($sortby=="LotAuctionDateDESC"){ $sortby = "LotAuctionDate DESC"; } $sql=" SELECT * FROM lots WHERE LotAuctionDate='$LotAuctionDate' order by $sortby limit $from, $max_results"; $getlist = mysql_query($sql, $conn) or die(mysql_error()); $result=mysql_query($sql); $num=mysql_numrows($result); $color1 = '#ebebeb'; $color2 = '#ffffff'; $cym="$"; ?>
  13. I think this should do it. Let me know if you need anything else. Thanks again for your time. <td><input value ="UPDATE" type="submit" id="addsubmit" name="submit1"></td> <td><input value ="DELETE" type="submit" id="addsubmit" name="submit2"></td> <form action="<? echo "{$_SERVER['PHP_SELF']}?page=$page&SelectLotAuctionDate=$LotAuctionDate&sortby=$sortby" ?>" method="post"> if(isset($_POST['submit1'])){ // connect to the database and select the correct database include("dbinfo.inc.php"); mysql_connect("localhost",$username,$password); @mysql_select_db($database) or die( "Unable to select database"); // define each variable $LotID=$_POST['ud_LotID']; $LotNumber=$_POST['ud_LotNumber']; $LotTitle=$_POST['ud_LotTitle']; $SellingPrice=$_POST['ud_SellingPrice']; $Buyer=$_POST['ud_Buyer']; $LotPaymentExempt=$exempt; $OnlineOnsite=$_POST['ud_OnlineOnsite']; $AbsenteeBid=$_POST['ud_AbsenteeBid']; $SellerNumber=$_POST['ud_SellerNumber']; $LotAuctionDate=$_POST['SelectLotAuctionDate']; $query = "UPDATE lots SET `LotNumber` = '$LotNumber', `LotTitle` = '$LotTitle', `SellingPrice` = '$SellingPrice', `Buyer` = '$Buyer', `OnlineOnsite` = '$OnlineOnsite', `LotPaymentExempt` = '$LotPaymentExempt', `AbsenteeBid` = '$AbsenteeBid', `SellerNumber` = '$SellerNumber', `LotAuctionDate` = '$LotAuctionDate' WHERE `LotID` = '$LotID'"; mysql_query($query) or die ("Error in query: $query"); echo "<BR><font size=1>$LotNumber UPDATED</font>"; mysql_close(); if(isset($_POST['submit2'])){ include("dbinfo.inc.php"); mysql_connect("localhost",$username,$password); @mysql_select_db($database) or die( "Unable to select database"); // define each variable $LotID=$_POST['ud_LotID']; $LotNumber=$_POST['ud_LotNumber']; mysql_query("DELETE FROM lots WHERE LotID='$LotID'"); echo "<BR><font size=1>$LotNumber DELETED</font>"; mysql_close();
  14. Hey Andy. I went ahead and tested this and it is sending over the values in Firefox, but not IE or Opera. I used "POST" to grab the data and then just echoed the values back onto the screen. So knowing that the values are not being submitted, what should my next step be? I am "under the gun" on this and would appreciate any more suggestions. Thanks for your help.
  15. I have a feeling that is what the problem is because it doesn't show up in my URL. Is there what my form does when clicked. Can you help me with what I need to add to the URL string to get it to capture the cooridanates of the image? Thanks man. <form action="<? echo "{$_SERVER['PHP_SELF']}?page=$page&SelectDate=$Date&sortby=$sortby" ?>" method="post">
  16. For some reason, the code below works in Firefox just fine. The form submission goes through. In IE7, the page refreshes on the submit and it appears that the data is being passed, but it's not adding entry to database. Any ideas? Thanks in advance. <td><input type="image" value ="ADD" name="submit3" src="images/tick.png" alt="SUBMIT"></td></form></tr></table><br>
  17. Well, it's closer. Thanks for your help man!
  18. Thanks for the quick reply. Do i wan this in my css? form{display:inline;margin:0;padding:0;}
  19. I cannot figure out why I am getting these huge gaps in between each row that is returned after I run my sql query. Can someone help me out? Thanks. <table> <form action="<? echo "{$_SERVER['PHP_SELF']}?page=$page&SelectDate=$Date&sortby=$sortby" ?>" method="post"><tr> <? echo "<input type='hidden' name='ud_ID' value='$ID'>";?> <? echo "<input type='hidden' name='ud_Payment' value='$Payment'>";?> <TD width="53" height="35"><? echo "<input type='text' size='5' name='ud_LNumber' style='background-color:$color; text-align:center; border-style: solid; border:1px solid black' value='$Number'>";?></td> <TD width="250" height="35"><? echo "<input type='text' size='40' name='ud_LTitle' style='background-color:$color; border:1px solid black' value='$Title'>";?></td> <TD width="78" height="35"><? echo "<input type='text' size='7' name='ud_Price' style='background-color:$color; border:1px solid black; text-align:center' value='$Price'>";?></td> <TD width="60" height="35" align="center"><? echo "<input type='text' size='6' name='ud_Buyer' style='background-color:$color; border:1px solid black; text-align:center' value='$Buyer'>";?></td> <TD width="80" height="35" align="center"> <? echo "<select style='background-color:$color; border:1px solid black;' name='ud_OnlineOnsite'>"; ?> <option value="ONLINE" <? if ($OnlineOnsite == "ONLINE") echo "selected"; ?> >ONLINE</option> <option value="ONSITE" <? if ($OnlineOnsite == "ONSITE") echo "selected"; ?> >ONSITE</option> </select> </td> <TD width="74" height="35" align="center"><? echo "<input type='text' size='9' name='ud_Absentee' style='background-color:$color; border:1px solid black; text-align:center' value='$Absentee'>";?></td> <TD width="65" height="35" align="center"><? echo "<input type='text' size='7' name='ud_Seller' style='background-color:$color; border:1px solid black; text-align:center' value='$Seller'>";?></td> <TD width="72" height="35" align="center"><? echo "<input type='text' size='8' name='SelectDate' style='background-color:$color; border:1px solid black; text-align:center' value='$Date'>";?></td> <td><input value ="UPD" type="Submit" border="0" name="submit1"></td> <td><input value ="DEL" name="submit2" type="Submit"></td></tr></form></table> <td> <? $i++; } ?></td>
  20. The ud_lottitle field is the one that is grossly out of proportion in my site. The other ones are off by a little bit. Let me know what you think. Thanks for getting back to me. <tr><form action="<? echo "{$_SERVER['PHP_SELF']}?page=$page&SelectLotAuctionDate=$LotAuctionDate&sortby=$sortby" ?>" method="post"> <? echo "<input type='hidden' name='ud_LotID'>";?> <? echo "<input type='hidden' name='ud_LotPaymentExempt'>";?> <TD height="29"><? echo "<input type='text' size='5' style='background-color:#F2F2F2; text-align:center; border-style: solid; border:1px solid black' name='ud_LotNumber' value='$LotNumber'>";?></td> <TD height="29"><? echo "<input type='text' size='46' style='background-color:#F2F2F2; text-align:center; border-style: solid; border:1px solid black' name='ud_LotTitle' >";?></td> <TD height="29" align="center"><? echo "<input type='text' size='10' style='background-color:#F2F2F2; text-align:center; border-style: solid; border:1px solid black' name='ud_SellingPrice' >";?></td> <TD height="29" align="center"><? echo "<input type='text' size='7' style='background-color:#F2F2F2; text-align:center; border-style: solid; border:1px solid black' name='ud_Buyer' >";?></td> <TD height="29" align="center"> <select style='background-color:#F2F2F2; text-align:center; border-style: solid; border:1px solid black;' name="ud_OnlineOnsite"> <option value="ONLINE">ONLINE</option> <option value="ONSITE">ONSITE</option> </select></td> <TD height="29" align="center"><? echo "<input type='text' size='8' style='background-color:#F2F2F2; text-align:center; border-style: solid; border:1px solid black' name='ud_AbsenteeBid' >";?></td> <TD height="29" align="center"><? echo "<input type='text' size='7' style='background-color:#F2F2F2; text-align:center; border-style: solid; border:1px solid black' name='ud_SellerNumber' >";?></td> <TD height="29" align="center"><? echo "<input type='text' size='8' style='background-color:#F2F2F2; text-align:center; border-style: solid; border:1px solid black' name='SelectLotAuctionDate' value='$LotAuctionDate'>";?></td></tr> <td><input value ="ADD LOT" name="submit3" type="Submit"></td></form><br><br>
  21. I have an interesting situation that has come while developing mys site. I have some basic tables with columns and text in this site that I am designing that line up perfectly when I access the page in Windows using Firefox or IE7. But for some reason, when I access the same page using Firefox while using Ubuntu, the columns are off. No matter what I do to increase font size or decrease font size, they simply will not line up. Has anyone else experienced anything similar to this? It may be a setting in Firefox, but I don't know what it could possibly be. Let me know if you have come across anything like this. Thanks, Ryan edited by akitchin: moved to HTML help.
  22. I think I figured it out. This is appears to work. And VERY efficiently. $query = "SELECT SellerNumber FROM lots WHERE SellerNumber='$SellerTotalNumber' AND LotAuctionDate='$LotAuctionDate'"; $sellerresult = mysql_query($query) or die(mysql_error()); $sellertotalnumber=mysql_numrows($sellerresult); mysql_close(); if ($sellertotalnumber<1) { include("dbinfo.inc.php"); mysql_connect("localhost",$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query= "DELETE from sellertotals WHERE SellerTotalNumber='$SellerTotalNumber' AND SellerTotalDate='$LotAuctionDate'"; mysql_query($query); mysql_close(); // echo "<BR><font size=1>$SellerTotalNumber Deleted!</font>"; } else { } } $i++;
  23. Can anyone give me an example of how I can get this code to work by not using "not in"? I am really struggling to get this to work in a way that doesn't utilize "not in" and run efficiently. Thanks in advance. DELETE from sellertotals where SellerTotalNumber not in (select SellerNumber from lots WHERE LotAuctionDate = '$LotAuctionDate') AND SellerTotalDate = '$LotAuctionDate
  24. Can someone help me with the "compare" part of the query. I am struggling to see how I compare two results from two different queries. Thanks for your help.
×
×
  • 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.