Jump to content

zero118

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Everything posted by zero118

  1. I apologize, the error was elsewhere. Sometimes all you need is someone to make you look at the code a little harder =-) The array was fine, it was a query that was causing the issue.
  2. Yes, I can see the array just fine. But it is still telling me the argument is invalid. Could it have anything to do with the format of the contents? A sample would be FVRB-8239
  3. I keep getting an invalid foreach argument here... case 'move_loc': foreach ($_POST[ 'move' ] as $key ) { $update ("UPDATE recert SET location =" . $_POST[ 'location' ] . " WHERE serial = '$key'"); } break; My form uses 'move' as the checkbox names and I am attempting to update multiple rows at one time. I do not have much experience with foreach so any help is appreciated.
  4. I also cannot get into the command line because it will not accept the password so I don't think it's a phpmyadmin problem
  5. Hey guys. I am a linux novice but I am fairly good with the commands. I have installed Ubuntu server and GNOME... I also tried to install phpmyadmin but it refuses to accept any password to let me into mysql. If there a way that I can reset permissions, reinstall the software, etc?
  6. The biggy is that they're not always in range of the internet. I was thinking that maybe I can duplicate the server onboard the truck and just sync the info with a script when they get back. But this would be difficult since numbers are automatic (not just `id`s but the numbers of the parts they are testing). Another thing I was thinking would be to just save the money in computer equipment and have them fill out forms and enter them when hey return. But this lacks the benefit of searching past records when they are out. Maybe a touchscreen laptop that lets them fill out digital forms? I could copy the database to the laptop before they go this would still let them search but not enter directly into the system.... Make sense?
  7. Personally, I wouldn't store them at all. But if you decide that you need to, at the very least you should md5 hash them.
  8. Greetings. So, I'm building this application in PHP on a dedicated system here. It will not be accessable outside the building for security reasons. My question is: What would be the best way for our employees in the field (on a mobile truck) to get the information from this system and to send results back? I've thought about setting up a VPN but that would only work if the truck were in cell range for internet access and that doesn't always work. I've also considered basically duplicating the system onto another computer that could stay with the truck and simply be synced when they returned... But this obviously is not ideal. Any suggestions? (I hope I'm in the right thread.)
  9. Excellent! Thanks! Works like a charm. I was never good at using JOIN but this will help a lot.
  10. Greetings. I am attempting to get familiar with Object Oriented Code but I cannot seem to grasp how to merge two tables with it. Here is my code (ask if you need to see the functions but I think you can gather how they work). Basically, I want the 'cstmr' field of the `serial` database table to find the Company Name in the `customer` database table for the corresponding ID. So instead of showing "128" it shows "General Motors" (just an example, we don't have the money to bailout GM). Thanks! <?php require_once ( '../settings.php' ); $login->checkLogin ( 1 ); include ( '../lib/Pagination.php' ); $login->add_user_groups (); $pagination = new Pagination(); $pagination->start = ( @$_GET['start'] ) ? $_GET['start'] : '0'; $pagination->filePath = APPLICATION_URL . 'admin/admin_serials.php'; $pagination->select_what = '*'; $pagination->the_table = '`' . DBPREFIX . 'serial`'; $pagination->add_query = ' ORDER BY `ID` ASC'; $query = $pagination->getQuery ( TRUE ); $paginate = $pagination->paginate(); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?= $login->design->get_page_title ( 'admin' ) ?></title> <?= $login->design->get_page_css () ?> <?= $login->design->get_page_js ( 'admin' ) ?> <script type="text/JavaScript"> <!-- function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } //--> </script> </head> <body> <div id="top"> <?= $login->design->setMenu () ?> <div class="content"> <h1><?= $login->functions->Lang ( 'manage_serials' ) ?></h1> <?= $login->design->get_admin_menu () ?> <?= $login->message ?> <TABLE border="0" cellpadding="4" cellspacing="3" width="98%"> <caption><?= $login->functions->Lang ( 'manage_serials' ) ?></caption> <thead> <tr> <th width="20"> </th> <th><?= $login->functions->Lang ( 'hserial_num' ) ?></th> <th><?= $login->functions->Lang ( 'hcust' ) ?></th> <th><?= $login->functions->Lang ( 'hpart_num' ) ?></th> <th><?= $login->functions->Lang ( 'hstatus' ) ?></th> </tr> </thead> <?php $nr = 1; if ( $login->db->RecordCount ( $query ) > 0 ) { $groups = $login->db->get_results ( $query ); foreach ( $groups as $row ): $row_class = ( $nr % 2 ) ? '' : ' class="alt"'; ?> <tr<?= $row_class ?>> <td><?= $nr ?></td> <td class="lft"><?= $row->serial ?></td> <td class="lft"><?= $row->cstmr ?></td> <td class="lft"><?= $row->fvprt ?></td> <td class="lft"><?php if ( $row->status == '1' ) { echo "<img src='" . APPLICATION_URL . "images/icons/tick.gif'"; } else { echo "<img src='" . APPLICATION_URL . "images/icons/tickfail.gif'"; } ?></td> </tr> <?php $nr++; endforeach; } else { ?> <tr> <td colspan="4"><?= $login->functions->Lang ( 'no_groups' ) ?></td> </tr> <? } ?> </table> <?= $paginate ?> <div class="clear"></div> </div> <!-- FOOTER --> <?= $login->design->setFooter( ) ?>
  11. I really wanted this to work on IIS 7with 2008 Server but it's just too much of a headache. I'm going to just install Apache
  12. if I open this (inc_usercheckall.php) by itself I see that it connects and tells me wrong password. If I try to load this from my login for I get the 500 error again.
  13. I meant to add the = in there... I don't get any new error with the added tags. IIS is still just saying 500, There is a problem with the resource...
  14. Actually, yes. PHP is running, just some odd things that make me think this is the php.ini causing it... For instance I cannot use <?$variable?> to display but I can use <? echo $variable ?> I will add the tags when I get to the office and let you know what I get.
  15. This is just a simple, NON-object oriented system that I was playing with and I just want to make sure I get things right on the 2008 server. So please don't laugh =-) <?php $dbhost = 'localhost'; $dbusername = '*****'; $dbpasswd = '*****'; $database_name = 'nimbus'; $length = '5'; // Site information $siteadd = '10.0.1.197'; $formsOnOff = '1'; // 0=off 1=on $level = $_SESSION['s_userlevel']; $username = $_SESSION['s_username']; $disname = $_SESSION['s_disname']; //db tables $user_database_table = 'users'; $serials_database_table = 'serials'; /* Database Stuff, do not modify below this line */ $connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd") or die ("Couldn't connect to server."); $db = mysql_select_db("$database_name", $connection) or die("Couldn't select database."); if ($db) {echo "Connected!";} ?>
  16. He meant: $sql = mysql_query("SELECT * FROM customers WHERE id = '$id' "); $sql_res = mysql_query($sql); //execute query while($row = mysql_fetch_array($sql_res)) //Forget the "S" { $firstname=$row['firstname']; $lastname=$row['lastname']; $address=$row['address']; $suburb=$row['suburb']; $postcode=$row['postcode']; $phone1=$row['phone1']; $phone2=$row['phone2']; $email1=$row['email1']; $email2=$row['email2']; $billingemail=$row['billingemail']; }
  17. Greetings... I'm new to running PHP on Win2008 and I can't seem to figure out my problem here. Below is the code that checks users against the database. I get an error telling me "500, There is a problem with the resource you are looking for..." (Oh, PHP5 and MySQL (newest stable) ) Thanks!! <?php $username=""; $password=""; include("db.php"); $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $user_database_table WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:index.php"); } else { echo "Wrong Username or Password"; } ob_end_flush(); ?>
  18. Actually... you're very right.  Sorry :)  I hadn't thought logically through it.
  19. I know it's not PHP but it's somewhat related. I'm using the following: [CODE]        $qry = "SELECT DISTINCT `name` FROM `$parts_database_table`";         $result2 = mysql_query($qry, $connection);         $parts = mysql_fetch_row($result2); [/CODE] The problem is that I need to get the `id` field of those.  I tried using [I]DISTINCT `name`, `id`[/I] but all it got me was a huge headache.  Please someone help :-(
  20. *will be sure to come back here the next time he has a seemingly simple problem that will turn into a 2 page discussion* :)
  21. Holy crap dude.  I think it worked.  Go check it out.  Thank you very much.
  22. I'm not linux expert (or even close) but something may be screwy with some installations on your server.  When I get stupid errors I just call my host and make them figure out why.
  23. Updated.  You can see the full query at http://www.kerrpumps.com/index.php?p=srchprod3 I do appriciate your help.  Sorry I'm not more into it, I'm used to figuring out problems myself. The code: [code]<table width="100%" border="0" cellspacing="0" cellpadding="0">   <tr>     <td width="240" align="left" valign="top"><img src="img/pd-search.jpg" width="230" height="160" style="padding-right:6px;" /><br />       <br />       <br />       <br />       <a href="<?=$siteadd?>"><img src="img/page-logo.jpg" width="230" height="108" border="0" /></a></td>     <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">         <tr>           <td><strong>                       <?php if ($go){ // If form submitted // Check if a page value was passed // if not, set the default page (1) if( isset($_POST['page']) && !empty($_POST['page']) && ctype_digit($_POST['page']) ){ $page = $_POST['page']; } else { $page = 1; } // Set the maximum results per page $max_results = 4; // Calculate the search range for PSI if ($psi != ""){ if ($psi < 1400){ $psi01 = $psi; $psi02 = ($psi * 1.19); } else if ($psi >= 1400){ $psi01 = $psi; $psi02 = ($psi * 1.21); } } else if (!$psi or $psi == ""){ $psi01 = 0; $psi02 = 9999999; } // Calculate the search range for GPM if ($gpm != ""){ $gpm1 = $gpm; $gpm2 = ($gpm * 1.2); } else if (!$gpm or $gpm == ""){ $gpm1 = 0; $gpm2 = 9999999; } // Send information and call the results result($psi01, $psi02, $gpm1, $gpm2, $use01, $mod, $page, $max_results); } // If form has not been submitted else {   ?>               </strong>             <form action="index.php?p=srchprod3" method="post">               <table width='405' height="285" border='0' cellpadding='3' cellspacing='0' style="background:url(<?=$siteadd?>/img/search-back.jpg); background-position:left; background-repeat:no-repeat; background-color:#000000">                 <tr>                   <td width="512" height="22" style="background:url(<?=$siteadd?>/menus/images/newline.gif);"><strong><font color="#FFFFFF">Search</font></strong></td>                 </tr>                 <tr>                   <td height="260" align="left" valign="middle" ><table width="100%" border="0" cellspacing="0" cellpadding="2">                       <tr>                         <td width="37%" height="45" align="center" style="border-bottom: 1px solid #c0c0c0;"><strong>                           <input name="psi" type="text" id="psi" style="width:120px;" onkeypress="return numeralsOnly(event)" value="<?=$psi?>" />                           </strong></td>                         <td width="63%" height="45" style="border-bottom: 1px solid #c0c0c0;"><strong><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">Pressure per Square Inch <br />                           <font size="1">(searches using max PSI) </font></font></strong></td>                       </tr>                       <tr>                         <td height="45" align="center" style="border-bottom: 1px solid #c0c0c0;"><strong>                           <input name="gpm" type="text" id="gpm" style="width:120px;" onkeypress="return numeralsOnly(event)" value="<?=$gpm?>" />                           </strong></td>                         <td height="45" style="border-bottom: 1px solid #c0c0c0;"><strong><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">Flow Rate<br />                           <font size="1">(searches using max GPM) </font></font></strong></td>                       </tr>                       <tr>                         <td height="45" align="center" style="border-bottom: 1px solid #c0c0c0;"><strong>                           <input name="model" type="text" id="mod" style="width:120px;" value="<?=$mod?>" />                           </strong></td>                         <td height="45" style="border-bottom: 1px solid #c0c0c0;"><strong><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">Pump Model Number <br />                           <font size="1">(i.e. KD-12 will display all pumps beginning with that) </font></font></strong></td>                       </tr>                       <tr>                         <td height="45" align="right" style="padding-right:10px;"><font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif">                           <label> <font size="2">Continuous Duty<font color="#FFFFFF" face="Arial, Helvetica, sans-serif">                           <input name="use01" type="radio" value="Continuous" <?php if ($use01 != "Intermittent") { echo "checked=checked";} ?> />                           </font></font></label>                           <font size="2">&nbsp;&nbsp;&nbsp;<br />                           <label> Intermittent Duty<font color="#FFFFFF" face="Arial, Helvetica, sans-serif">                           <input name="use01" type="radio" value="Intermittent" <?php if ($use01 == "Intermittent") { echo "checked=checked";} ?> />                           </font></label>                           &nbsp;&nbsp;&nbsp;</font> </font></td>                         <td height="45"><strong><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">Usage<br />                           </font></strong><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><font size="1"><strong>(Continuous: more than 6 hrs/day to 14<br />                           hrs/day. fully loaded ) <br />                           </strong></font><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><font size="1"><strong>(Intermittent: less than 6 hrs/day, loaded no<br />                           more than 15 min. every hr.)</strong></font></font></font></td>                       </tr>                       <tr>                         <td align="center"><strong>                           <input type="submit" name="go" value="Search" style="width:120px;" />                           </strong></td>                         <td>&nbsp;</td>                       </tr>                     </table></td>                 </tr>               </table>               <strong><br />               </strong>             </form>             <strong>             <?php       } // Show results function result($psi01, $psi02, $gpm1, $gpm2, $use01, $mod, $page, $max_results) { global $psi, $gpm; include('db.php'); if ($model != "") { // Query if Model has been searched for $query_mem_1 = "SELECT *  FROM `$pump_database_table` WHERE ( (`psi1` > $psi01 AND `psi1` < $psi02) OR (`psi2` > $psi01 AND `psi2` < $psi02) OR (`psi3` > $psi01 AND `psi3` < $psi02) OR (`psi4` > $psi01 AND `psi4` < $psi02) OR (`psi5` > $psi01 AND `psi5` < $psi02) OR (`psi6` > $psi01 AND `psi6` < $psi02) OR (`psi7` > $psi01 AND `psi7` < $psi02)) AND ( (`maxflow` > $gpm1 AND `maxflow` < $gpm2) OR (`flow2` > $gpm1 AND `flow2` < $gpm2) OR (`flow3` > $gpm1 AND `flow3` < $gpm2) OR (`flow4` > $gpm1 AND `flow4` < $gpm2) OR (`flow5` > $gpm1 AND `flow5` < $gpm2) OR (`flow6` > $gpm1 AND `flow6` < $gpm2) OR (`flow7` > $gpm1 AND `flow7` < $gpm2)) AND (`use` = '$use01') AND `model` LIKE CONVERT ( _utf8 '%$mod%' USING latin1 ) COLLATE latin1_swedish_ci ORDER BY maxflow ASC"; } else if (!$mod or $mod == ""){ // Query if Model was not searched for $query_mem_1 = "SELECT *  FROM `$pump_database_table` WHERE ( (`psi1` > $psi01 AND `psi1` < $psi02) OR (`psi2` > $psi01 AND `psi2` < $psi02) OR (`psi3` > $psi01 AND `psi3` < $psi02) OR (`psi4` > $psi01 AND `psi4` < $psi02) OR (`psi5` > $psi01 AND `psi5` < $psi02) OR (`psi6` > $psi01 AND `psi6` < $psi02) OR (`psi7` > $psi01 AND `psi7` < $psi02)) AND ( (`maxflow` > $gpm1 AND `maxflow` < $gpm2) OR (`flow2` > $gpm1 AND `flow2` < $gpm2) OR (`flow3` > $gpm1 AND `flow3` < $gpm2) OR (`flow4` > $gpm1 AND `flow4` < $gpm2) OR (`flow5` > $gpm1 AND `flow5` < $gpm2) OR (`flow6` > $gpm1 AND `flow6` < $gpm2) OR (`flow7` > $gpm1 AND `flow7` < $gpm2)) AND (`use` = '$use01') ORDER BY maxflow ASC"; } // Fetch a count of all results $mem_1 = mysql_query($query_mem_1, $connection) or die(mysql_error()); $numOfRows = mysql_num_rows($mem_1); // No results if ($numOfRows == 0){ ?>     </strong>     <table width='405' border='0' cellspacing='0' cellpadding='3' style='border: 0px solid White;'>       <tr> <td background="menus/images/newline.gif"><strong><font color="#FFFFFF">Results: No Matches</font></strong></td>       </tr>       <tr> <td height="70" align="left" valign="top" class="prod"><strong>We're sorry.  There were no matches for the search criteria you specified.  Please try again.</strong></td>       </tr>     </table>     <strong><br /> <?php } else { // Determine the number of pages $num_pages = ceil($numOfRows / $max_results); // Determine the starting result to print $start_result = ($page * $max_results) - $max_results; // Append to our query with our result limit $query_mem_1_limit = $query_mem_1 . " LIMIT ".$start_result.",".$max_results.""; // Display the query echo $query_mem_1_limit.'<br>'; // Query for our current page of results $mem_1_limit = mysql_query($query_mem_1_limit, $connection) or die(mysql_error()); $row_mem_1_limit = mysql_fetch_assoc($mem_1_limit); // Print The results $numOfPageRows = mysql_num_rows($mem_1_limit); for ($i = 0; $i < $numOfPageRows; $i++){ $id = mysql_result ($mem_1, $i, "id"); $model = mysql_result ($mem_1, $i, "model"); $img = mysql_result ($mem_1, $i, "img"); $type = mysql_result ($mem_1, $i, "type"); $psi1 = mysql_result ($mem_1, $i, "psi1"); $maxflow = mysql_result ($mem_1, $i, "maxflow"); $use = mysql_result ($mem_1, $i, "use"); $cylinder = mysql_result ($mem_1, $i, "cylinder"); // conver numbers to words / cylinders if ($cylinder == '1'){ $cylinder = "Simplex"; } if ($cylinder == '2'){ $cylinder = "Duplex"; } if ($cylinder == '3'){ $cylinder = "Triplex"; } if ($cylinder == '5'){ $cylinder = "Quintuplex"; } if ($cylinder == '6'){ $cylinder = "Sextuplex"; } ?>             </strong>             <table width='405' border='0' cellspacing='0' cellpadding='3' style='border: 0px solid White;'>               <tr>                 <td colspan="2" background="menus/images/newline.gif"><strong><font color="#FFFFFF">                   <?=$model?>                   </font></strong></td>               </tr>               <tr>                 <td width="186" height="70" align="left" valign="top" class="prod"><strong>                   <?=$use?>                   Duty<br />                   <?=$cylinder?>                   <?=$type?>                   Pump <br />                   Max PSI:                   <?=$psi1?>                   PSI<br />                   Max Flow Rate:                   <?=$maxflow?>                   GPM</strong></td>                 <td width="180" height="70" align="right" valign="bottom" class="prod"><strong><a href='index.php?p=pmp&pid=<?=$id?>' class="prod">See this pump</a><br />                   <?php if ($img != "img/pp/") { ?>                   <a href='pd.php?pid=<?=$id?>' onclick="NewWindow(this.href,'pd','690','420','no','center');return false" onfocus="this.blur" class="prod">View dimensions</a><br />                   <?php } ?>                   <a href='calc.php' onclick="NewWindow(this.href,'pd','690','450','yes','center');return false" onfocus="this.blur" class="prod">View Pump Calculations</a></strong></td>               </tr>             </table>             <br />             <?php             }                         // Start pagination             ?>                         <table width='405' border='0' cellspacing='0' cellpadding='3' style='border: 0px solid White;'>               <tr>                 <td colspan="2">                           <?php             // Loop to print a button for each page of results             for($j = 1;$j <= $num_pages;$j++){             // Check if we are printing the current page             // we won't make it an active button             $disabled = ($j == $page) ? "DISABLED" : NULL;                         ?>                         <form action="index.php?p=srchprod3" method="post">             <input type="hidden" name="psi" id="psi" value="<?=$psi?>" />             <input type="hidden" name="gpm" id="gpm" value="<?=$gpm?>" /> <input type="hidden" name="page" id="page" value="<?=$page?>" />             <input type="hidden" name="use01" id="use01" value="<?=$use01?>" />             <input type="hidden" name="mod" id="mod" value="<?=$mod?>" />             <input type="hidden" name="page" id="page" value="<?=$j?>" />             <input type="submit" name="go" id="go" value="<?=$j?>" <?=$disabled?> />             </form> (((DEBUG)))<br /> PSI:<?=$psi?><br /> GPM:<?=$gpm?><br /> Page:<?=$page?><br /> Use01:<?=$use01?><br /> Mod:<?=$mod?><br /> J:<?=$j?><br /> Disabled:<?=$disabled?><br /> <br />             </td>         </tr>       </table>             <?php             } }  }     ?>             </td>         </tr>       </table></td>   </tr> </table> </body></html> [/code]
  24. Okay, I made the changes and the page IS limiting the results to 4 per page, keeping the searched for variables and keeping the amount of pages, but it's showing the same 4 results (out of 10 total) on every page.
  25. I posted exactly what you had but then had to change it because of errors :)  I will surely try this in just a minute though
×
×
  • 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.