Jump to content

brosskgm

Members
  • Posts

    54
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

brosskgm's Achievements

Member

Member (2/5)

0

Reputation

  1. What file would I put this in? Thanks
  2. Sorry. There wasn't much in there and I wasn't sure if it would have been needed. Search.php <?php require_once "dbConnect.php"; Class Search { private $ResultArray, $numRows; public function __construct() { if ($_GET['s']) { $safeQuery = mysql_real_escape_string($_GET['s']); $theQuery = "SELECT * from parts WHERE part_num LIKE '%$safeQuery%' OR dealer LIKE '%$safeQuery%' OR retail LIKE '%$safeQuery%' OR uom LIKE '%$safeQuery%' OR page LIKE '%$safeQuery%' OR product_desc LIKE '%$safeQuery%'"; $res = mysql_query($theQuery); $this->numRows = mysql_num_rows($res); $i = 0; while ($result = mysql_fetch_array($res)) { $this->ResultArray[$i] = $result; $i++; } } else { $this->numRows = -1; } } public function getResult() { return $this->ResultArray; } public function getNumRows() { return $this->numRows; } public function __destruct() { mysql_close(); } } ?>
  3. I have some PHP/Java code that was written for me that searches and displays an item(s) costs etc. Similar to a parts store but with a eCart twist. This was so long ago that I'm no longer able to contact the coder. He no longer in school and they can't tell you were he went to. I guess he got a good grade for the project and got hired. I only have about 20-25 items in the database. Can someone tell here where in the attached code I can tell it to display all the contents of the database with out using the search but leaving all the other functions usable? If you need any other files not in the attachment, let me know. There are several more, but these were most of the php files in the main directory. Thanks in advance. Bob Ross 18055_.zip
  4. I almost forgot, This is the part that calls it. <?php require_once "template.php"; require_once "Search.php"; require_once "Cookie.php"; $Cookie = new Cookie(); $Search = new Search(); $ResultArray = $Search->getResult(); $template = new Template(); $template->ResultArray = $ResultArray; $template->numRows = $Search->getNumRows(); $template->SearchPage(); $template->Generate(); unset($template); unset($Search); ?>
  5. I didn't write this, it was made for me to lookup parts and costs. <?php require_once "config.php"; require_once "recaptcha-php-1.11/recaptchalib.php"; global $captchaPublicKey; Class Template { public $ResultArray, $numRows = 0; private $tmpCurr; public function SimpleGenerate() { echo $this->tmpCurr; } public function Generate() { $captcha = new CaptchaKeys(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <LINK REL="StyleSheet" HREF="style.css" TYPE="text/css"> <LINK REL="StyleSheet" HREF="thickbox.css" TYPE="text/css"> <script type="text/javascript" src="jquery-1.6.4.min.js"></script> <script type="text/javascript" src="thickbox-compressed.js"></script> <script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js?legacy"></script> <script language="javascript"> function removeItem (ItemId) { $('#removeImg-'+ItemId).attr("src","img/loader.gif"); $.get("deleteCart.php",{id:ItemId},function(result) { $('#'+ItemId).html(" "); $("#totalPrice").html(result); }); } function updateItem (ItemId) { $("#loading-"+ItemId).html('<img src="img/loader.gif"/>'); $.get("updateQuantity.php",{id:ItemId,q:$("#quantity-"+ItemId).val()},function(result){ $("#total-"+ItemId).html(result); $("#loading-"+ItemId).html(" "); $("#totalPriceLoading").html('<img src="img/loader.gif"/>'); $.get("totalPrice.php",{},function(result){ $("#totalPrice").html(result); $("#totalPriceLoading").html(' '); }); }); } function updateInfo () { $("#loading-info").html('<img src="img/loader.gif"/> Updating...'); $.get("updateInfo.php",{email:$("#mail").val(),name:$("#name").val(),address:$("#address").val(),city:$("#city").val(),state:$("#state").val(),zip:$("#zip").val(),phone:$("#phone").val()},function(result){ if (result == "Mail Error") { $("#error-info").html('* Please enter a valid mail address'); } if (result == "Mail Success") $("#error-info").html(''); $("#loading-info").html(''); }); } function Finish () { $("#mainloading").html('<img src="img/loader.gif"/>'); $.post("Finish.php",{recaptcha_challenge_field: Recaptcha.get_challenge(),recaptcha_response_field: Recaptcha.get_response()},function (result) { if (result == "Error") { $("#mainloading").html('<b>Please Enter Correct Code</b>'); Recaptcha.reload(); } else { $("#main").html(result); } }); } function FinishNoVal () { $("#mainloading").html('<img src="img/loader.gif"/>'); $.post("Finish.php",{},function (result) { $("#main").html(result); Recaptcha.create("<?=$captcha->getPublic()?>","Captcha",{theme: "white", callback: Recaptcha.focus_response_field}); }); } </script> </head> <body> <?=$this->tmpCurr?> </body> </html> <?php } public function SearchPage() { $this->tmpCurr = ' <div id="search"> <form action="index.php" method="GET"> Search: <input type="text" value="'.htmlentities($_GET['s']).'" name="s"/> <input type="submit" value="Search!"/> </form> </div> <br/>'; if ($this->numRows == 0) { $this->tmpCurr .= "No result"; } elseif ($this->numRows > 0) { $this->tmpCurr .= ' <div id="table_container"> <div id="table_row"> <div id="table_cell" class="header">Part #</div> <div id="table_cell" class="header">Dealer Cost</div> <div id="table_cell" class="header">Markup</div> <div id="table_cell" class="header">Retail Cost</div> <div id="table_cell" class="header">UOM Type</div> <div id="table_cell" class="header">Page#</div> <div id="table_cell" class="header">Description</div> <div id="table_cell" class="header">Add</div> </div>'; $markup = new Markup(); for ($i = 0; $i < $this->numRows; $i++) { $this->tmpCurr .= ' <div id="table_row"> <div id="table_cell" class="cell">'.$this->ResultArray[$i]['part_num'].'</div> <div id="table_cell" class="cell">'.number_format(round($this->ResultArray[$i]["dealer"], 2), 2).'</div> <div id="table_cell" class="cell">'.number_format(round($markup->Calc($this->ResultArray[$i]["dealer"]) , 2), 2).'</div> <div id="table_cell" class="cell">'.number_format(round($this->ResultArray[$i]["retail"], 2), 2).'</div> <div id="table_cell" class="cell">'.$this->ResultArray[$i]['uom'].'</div> <div id="table_cell" class="cell">'.$this->ResultArray[$i]['page'].'</div> <div id="table_cell" class="cell">'.$this->ResultArray[$i]['product_desc'].'</div> <div id="table_cell" class="cell"><a class="thickbox" href="addCart.php?id='.$this->ResultArray[$i]["id"].'&height=480">Add to cart</a></div> </div>'; } // end for $this->tmpCurr .= '</div>'; } //end No Result else } public function ListItems ($list) { $this->tmpCurr = '<div id="main"><div id="listtable_container"><div class="table_row"><div id="table_cell">Item #</div><div id="table_cell">Description</div><div id="table_cell">Quantity</div><div id="table_cell">Markup</div><div id="table_cell">Total</div><div id="table_cell">Remove</div></div>'; $ItemsArray = $list->ListItems(); if ($ItemsArray) { $markup = new Markup(); foreach ($ItemsArray as $key=>$Item) { $this->tmpCurr .= '<div id="'.$Item->id.'" class="table_row"><div id="table_cell">'.$Item->partnum.'</div><div id="table_cell">'.$Item->description.'</div><div id="table_cell"><input type="text" onChange="updateItem(\''.$Item->id.'\');" style="width:25px" id="quantity-'.$Item->id.'" value="'.$Item->quantity.'"/><span id="loading-'.$Item->id.'"></span></div><div id="table_cell">'.number_format(round($markup->Calc($Item->price),2),2).'</div><div id="table_cell"><span id="total-'.$Item->id.'">'.number_format(round($markup->Calc($Item->price),2)*$Item->quantity,2).'</span></div><div id="table_cell"><a href="javascript:removeItem(\''.$Item->id.'\')"><img border="0" id="removeImg-'.$Item->id.'" src="img/delete.gif"/></a></div></div>'; } } $this->tmpCurr .= '</div>'; $this->tmpCurr .= '<div id="dtotalPrice"><span id="totalPriceLoading"></span> Total Price: <span id="totalPrice">'.number_format($list->totalPrice(),2).'</span></div>'; $this->tmpCurr .= '<div class="leftSide" id="listtable_container">' . '<div class="table_row"><div id="table_cell">Email:</div> <div id="table_cell"><input value="'.$list->getEmail().'" onChange="updateInfo();" type="text" id="mail" /> </div></div>' . '<div class="table_row"><div id="table_cell">Name:</div> <div id="table_cell"><input value="'.$list->getName().'" onChange="updateInfo();" type="text" id="name" /></div></div>' . '<div class="table_row"><div id="table_cell">Address:</div> <div id="table_cell"><input value="'.$list->getAddress().'" onChange="updateInfo();" type="text" id="address" /></div></div>' . '<div class="table_row"><div id="table_cell">City:</div> <div id="table_cell"><input value="'.$list->getCity().'" onChange="updateInfo();" type="text" id="city" /></div></div>' . '<div class="table_row"><div id="table_cell">State:</div> <div id="table_cell"><input value="'.$list->getState().'" onChange="updateInfo();" type="text" id="state" /></div></div>' . '<div class="table_row"><div id="table_cell">ZipCode:</div> <div id="table_cell"><input value="'.$list->getZip().'" onChange="updateInfo();" type="text" id="zip" /></div></div>' . '<div class="table_row"><div id="table_cell">Phone:</div> <div id="table_cell"><input value="'.$list->getPhone().'" onChange="updateInfo();" type="text" id="phone" /></div></div>' . '</div>' . '<span id="loading-info"></span><br/><span id="error-info"></span>'; $this->tmpCurr .= '<div id="continue"><input onClick="tb_remove();" style="height:30px;padding:5px" type="button" value="Continue"></div> <div id="finish"><input style="height:30px;padding:5px;" type="button" OnClick="FinishNoVal();" value="Finish"/></div><div id="continue"><input type="button" value="Update Cart" style="height:30px;padding:5px"/></div>' . '</div>'; } public function captchaForm () { ?> Please enter the code:<br/> <form method="post" action="javascript:Finish()"> <span id="Captcha"></span> <input type="submit" value="Submit"/> <span id="mainloading"></span> </form> <?php } public function emailOutput($list) { $Items = $list->ListItems(); $html = '<table width="100%" border="0"><tr><td>Item #</td><td>Description</td><td>Quantity</td><td>Markup</td><td>Total</td></tr>'; $markup = new Markup(); foreach ($Items as $Item) { $html .= '<tr><td>'. $Item->partnum .'</td><td>' . $Item->description . '</td><td>' . $Item->quantity . '</td><td>' . number_format(round($markup->Calc($Item->price),2),2) . '</td><td>'.$Item->totalPrice.'</td></tr>'; } $html .= '</table><p align="right">Total Price: <b>' . number_format($list->totalPrice(), 2) . '</b></p>' . '<p align="left">' . '<table border="0">' . '<tr><td>Email:</td><td><b>' . $list->getEmail() . '</b></td></tr>' . '<tr><td>Name:</td><td><b>' . $list->getName() . '</b></td></tr>' . '<tr><td>Address:</td><td><b>' . $list->getAddress() . '</b></td></tr>' . '<tr><td>City:</td><td><b>' . $list->getCity() . '</b></td></tr>' . '<tr><td>State:</td><td><b>' . $list->getState() . '</b></td></tr>' . '<tr><td>ZipCode:</td><td><b>' . $list->getZip() . '</b></td></tr>' . '<tr><td>Phone:</td><td><b>' . $list->getPhone() . '</b></td></tr>' . '</table>' . '</p>'; return $html; } } ?>
  6. I have a template written for me on another project that searches a MySQL database. I'm moving this template to work with a database that only have 10 records in it and instead of having a search option I would just like it to automatically display the database when the page opens. Is this possible? The php page in close to 200 lines. This is the line of the code that has the search option. If you need more I can post it. Thanks Bob <div id="search"> <form action="parts.php" method="GET"> Search: <input type="text" value="'.htmlentities($_GET['s']).'" name="s"/> <input type="submit" value="Search!"/> </form> </div>
  7. Worked great with multiple file names selected. This will make things so much easier than typing the name of each file. Thank you again. Bob
  8. This little thing was no where to be fond on the internet. It will now. Now I'll be testing 6 file selections on one form and see how it does shortly.
  9. I'm really surprised the Web Builder people didn't want to tell me that. They said it required a different form processor to do that. Thank you so much. I've been banging my head trying to find something to work. Thanks Bob
  10. That was it. It's working. Wow!!, that easy.
  11. I tried param B1-File, FileUpload2 and also put txtB1-File, txtFileUpload2 in the cgi but those didn't work.
×
×
  • 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.