Jump to content

Search the Community

Showing results for tags 'table'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 28 results

  1. I have a page of html tables that are filled by database values through PHP, and there are no problems there. However, I have an issue on one of the tables. I have a pricing table, attached below. The $575 is currently filled from a field in the database that is set from a CSV upload, but the new CSV template is not doing this because it's missing the price field. This is the SQL statement that I'm using in the database, since the price is based off of meterSize, meterType and workOrderType2: UPDATE staging INNER JOIN pricing ON staging.meterType = pricing.meterType AND staging.meterSize = pricing.meterSize AND staging.workOrderType2 = pricing.workOrderType SET staging.onsiteTestSurveyPrice = pricing.price This works, but only with the original template, so I'm looking into doing this strictly in PHP with the table/row values, if possible. An example of what I'm looking for, using the html table and PHP: If $row['meterSize'] contains 3", $row['meterType'] contains COMPOUND and $row['workOrderType2'] contains ONSITE SURVEY AND TEST then $575 should go in <td><? echo $row['onsiteSurveyTestCost'];?> </td> Here's the code for those 3 conditional table rows: <tr style="border: none;"> <td style="border: none; text-align: left;">Meter Type:</td> <td style="border: none; text-align: right;"><? echo $row['meterType'];?> </td> </tr> <tr style="border: none;"> <td style="border: none; text-align: left;">Meter Size:</td> <td style="border: none; text-align: right;"><? echo $row['meterSize'];?> </td> </tr> <tr style="border: none;"> <td style="border: none; text-align: left;">Service Preformed:</td> <td style="border: none; text-align: right;"><? echo $row['workOrderType2'];?> </td> </tr> Is there a way to do this? I have multiple prices that are based on multiple conditions, but If I could figure out how to do this once then I can alter the values accordingly. Basically I want to mirror the db/SQL statement only with strictly PHP and the values in each table row. How can I do that, if possible?
  2. Hi, I'm having a problem creating an HTML table in php. I used php code that I believed was the proper format but I guess it is not. I'm trying to pull data from a MySQL database and put the contents into a 3 cell table. There should be one cell in the first row and 2 cells side-by-side in the second row. The data is being displayed ok but just not in a table. Maybe someone can steer me in the right direction to create an html table in php. Here is the code tat I used: <?php echo “<center>”; echo “<table width="600" cellpadding="6">”; echo “<tr>”; echo ”<td>”; $dog = $_POST['breed']; $servername = "localhost"; $username = "myusername"; $password = "**************"; $dbname = "mydatabase"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT * FROM doginfo WHERE breed='$dog'"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { $detail = $size = $row["detail"]; $breed = $row["breed"]; $size = $row["size"]; $height = $row["height"]; $weight = $row["weight"]; $life = $row["life"]; $affect = $row["affection"]; $playfull = $row["playfull"]; $friendlyd = $row["friendly_dogs"]; $friendlyst = $row["friendly_stranger"]; $train = $row["training"]; $health = $row["health"]; } } else { echo "0 results"; } $conn->close(); echo nl2br("$detail" . "\n\n"); echo “/td>”; echo “</tr>”; echo “<tr>”; echo “<td>”; .nl2br("Breed : " . "$breed" . "\n") .nl2br("Size : " . "$size" . "\n") .nl2br("Height : " . "$height" . "\n") .nl2br("Weight : " . "$weight" . "\n") .nl2br("Life Expectancy : " . "$life" . "\n\n") ); echo “/td>”; echo “<tr>”; echo “<tr>”; echo “<td>”; echo ( nl2br("Based on a scale of 1 to 5\n\n") .nl2br(" Affection : " . "$affect" . "\n") .nl2br("Playfull : " . "$playfull" . "\n") .nl2br("Friendly with other dogs : " . "$friendlyd" . "\n") .nl2br("Friendly with strangers : " . "$friendlyst" . "\n") .nl2br("Ease of training : " . "$train" . "\n") ); if($health == "n/a") { echo " "; } else { echo nl2br("Health : " ."$health" . "\n\n"); } echo “</td>”; echo “</tr>”; echo “</table>”; echo ”</center>”; ?> By the way,... I am also having a problem bolding a line of text in the data displayed. Thanks in advance.
  3. I have a page that displays about 12 tables that are filled from database values. These values correspond with a single record but some of these fields are based off of queries I'm making so that if something's wrong in the query, it will display red text. I'm only doing this for a few different fields but I want an option to edit and fix those fields and then save them to the database with an UPDATE. Basically, I don't want to wrap the whole page in a form since only a few fields in a few of the tables will need to be editable. Is there a way to do this so that I can edit only the few fields that need to be fixed? Here's a table as example: <div class="testResults" style=" width: 30%; clear:both; float: left;"> <!--Test Results Table--> <table style="width: 100%;"> <tr> <th colspan="2">Test Results</th> </tr> <tr> <td style="text-align: left;">Tested Within AWWA Standards</td> <td><? echo $row['standards'];?> </td> </tr> <tr> <td style="text-align: left;">Meter Failed on Low Side</td> <td><? echo $row['lowFail'];?> </td> </tr> <tr> <td style="text-align: left;">Meter Failed on High Side</td> <td><? echo $row['highFail'];?> </td> </tr> <tr> <td style="text-align: left;">Meter Failed Low and High Side</td> <td><? echo $row['bothFail'];?> </td> </tr> <tr> <td style="text-align: left;">Unable To Test</td> <td><? echo $row['unableTest'];?> </td> </tr> </table> So, for example, say I want to edit the data for just standards row and lowFail row. I tried this but it didn't work: <td><input type="text" name="test8TRGPM" value="<? echo $row['test8TestRateGPM'];?>"> </td> I know once this is done I'll need to have a submit button that attaches to a query to update with the input name, but right NOw i'm trying to find the best way to edit. Is it easiest to just wrap the whole page in a form and just create the few inputs where I need?
  4. Hello everyone, i'm Osiris and i'm stuck with this PHP/HTML code, i'm fairly new at this so this might be a dumb question. i have a database, but i want to output all data into a table from the database using HTML codes. i had it so far that i could outpust the info in just plain text but it doesn't output in the HTML table. Can anyone see what i did wrong? This is my PHP code its in the body section <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'password'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = 'SELECT `Name`, `Color`, `Type`, `Subtype`, `Power`, `Toughness`, `Manacost`, `Rarity`, `Expansion`, `Foil`, `Stock` FROM `mtgtabel`'; mysql_select_db('mtgstock'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } echo '<table class=mytable>'; echo "<tr><th >Name</th><th >Color</th><th >Type</th><th >Sub Type</th><th >Power</th><th >Toughness</th><th >Converted mana cost</th><th >Rarity</th><th >Expansion</th><th >Foil</th><th >Stock</th></tr>"; while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { echo "<tr><td>"; echo $row['Name'] echo "</td><td>"; echo $row['Color']; echo "</td><td>"; echo $row['Type']; echo "</td><td>"; echo $row['Subtype']; echo "</td><td>"; echo $row['Power']; echo "</td><td>"; echo $row['Toughness']; echo "</td><td>"; echo $row['Manacost']; echo "</td><td>"; echo $row['Rarity']; echo "</td><td>"; echo $row['Expansion']; echo "</td><td>"; echo $row['Foil']; echo "</td><td>"; echo $row['Stock']; echo "</td></tr>"; } echo "</table>"; mysql_close($conn); ?> Thanks in advance!
  5. Here's what I am trying to do. Retrieve "title" and "slug title" from all the rows in a table. Update them with new "title", "slug title" and "brand name". Here's my query. It updates the table with the brand names for each row. But for some reason, it removes the title and slug title from all the rows in the table. Is there a reason why it's doing that? function getIt($var) { $pos = strpos($var, ' - '); echo(substr($var, $pos+3)."\n"); } if(isset($_POST['submit'])) { $get_record = $db->prepare("SELECT * FROM items"); $get_record->execute(); $result_record = $get_record->fetchAll(PDO::FETCH_ASSOC); if(count($result_record) > 0){ foreach($result_record as $row) { $get_item_id = intval($row['item_id']); $get_item_title = trim($row['item_title']); $get_item_title_slug = trim($row['item_title_slug']); $new_title = getIt($get_item_title); $new_title_slug = Output::createSlug($new_title); $brand_name = substr($get_item_title, 0, strpos($get_item_title, ' - ')); $update_record = $db->prepare("UPDATE items SET brand_name = :brand_name, item_title = :item_title, item_title_slug = :item_title_slug WHERE item_id = :item_id"); $update_record->bindParam(':item_id', $get_item_id); $update_record->bindParam(':brand_name', $brand_name); $update_record->bindParam(':item_title', $new_title); $update_record->bindParam(':item_title_slug', $new_title_slug); if(!$update_record->execute()) { $errors[] = 'There was a problem updating the item.'; } } } else { $errors[] = 'No item found.'; } }
  6. I have problem how to saving all my record. when I save I just got 1 record saved in mySQL and it the last record on that table. Here is my code = <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO thasil (nrp, nama, pangkat, mgolongan, mtes_fisik, mkemampuan, hasil) VALUES (%s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['nrp'], "int"), GetSQLValueString($_POST['nama'], "text"), GetSQLValueString($_POST['pangkat'], "text"), GetSQLValueString($_POST['mgolongan'], "int"), GetSQLValueString($_POST['mtes_fisik'], "double"), GetSQLValueString($_POST['mkemampuan'], "double"), GetSQLValueString($_POST['hasil'], "double")); mysql_select_db($database_stok, $stok); $Result1 = mysql_query($insertSQL, $stok) or die(mysql_error()); $insertGoTo = ""; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_stok, $stok); $query_anggotaset = "SELECT * FROM tanggota ORDER BY nrp ASC"; $anggotaset = mysql_query($query_anggotaset, $stok) or die(mysql_error()); $row_anggotaset = mysql_fetch_assoc($anggotaset); $totalRows_anggotaset = mysql_num_rows($anggotaset); mysql_select_db($database_stok, $stok); $query_bobotset = "SELECT * FROM tbobot"; $bobotset = mysql_query($query_bobotset, $stok) or die(mysql_error()); $row_bobotset = mysql_fetch_assoc($bobotset); $totalRows_bobotset = mysql_num_rows($bobotset); $crMax = mysql_query("SELECT min(Golongan) as minK1, max(tes_fisik) as maxK2, max(kemampuan) as maxK3 FROM tanggota"); $max = mysql_fetch_array($crMax); $no=1; ?> <?php include ('header.php') ?> <div id="conten-wrapper"> <div id="conten"> <h1> Normalisasi Anggota Kesamaptaan </h1> <p> <a href="cetak.php"><img src="../images/btn_list.png" height="20"/> >>> Lihat & Cetak Hasil Akhir Perangkingan</a></p> <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1"> <table border="1" cellpadding="3" cellspacing="1"> <tr> <td>no</td> <td>nrp</td> <td>nama</td> <td>pangkat</td> <td>C1 Golongan</td> <td>C2 tes_fisik</td> <td>C3 kemampuan</td> <td>hasil</td> </tr> <?php do { $hasil= round (($max['minK1']/$row_anggotaset['Golongan']*$row_bobotset['golongan']+ $row_anggotaset['tes_fisik']/$max['maxK2']*$row_bobotset['tes_fisik']+ $row_anggotaset['kemampuan']/$max['maxK3']*$row_bobotset['kemampuan']),2) ; ?> <tr> <td><?php echo $no; $no++;?></td> <td><input type="text" name="nrp" value="<?php echo $row_anggotaset['nrp']; ?>" readonly/></td> <td><input type="text" name="nama" value="<?php echo $row_anggotaset['nama']; ?>" readonly/></td> <td><input type="text" name="pangkat" value="<?php echo $row_anggotaset['pangkat']; ?>" size="4" readonly/></td> <td><input type="text" name="mgolongan" value="<?php echo round ($max['minK1']/$row_anggotaset['Golongan'] *$row_bobotset['golongan'],2); ?>" size="2" readonly/></td> <td><input type="text" name="mtes_fisik" value="<?php echo round ($row_anggotaset['tes_fisik']/$max['maxK2'] *$row_bobotset['tes_fisik'],2); ?>" size="2" readonly/></td> <td><input type="text" name="mkemampuan" value="<?php echo round ($row_anggotaset['kemampuan']/$max['maxK3'] *$row_bobotset['kemampuan'],2); ?>" size="3" readonly/></td> <td><input type="text" name="hasil" value="<?php echo $hasil ?>" size="2" readonly/></td> </tr> <?php } while ($row_anggotaset = mysql_fetch_assoc($anggotaset));?> <tr valign="baseline"> <td colspan="8" align="right" nowrap="nowrap"><input type="submit" value="Insert record" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1" /> </form> </div> <?php include ('footer.php') ?> </body> </html> <?php mysql_free_result($anggotaset); mysql_free_result($bobotset); ?>
  7. Hey guys i need help with a CURL code. I need to retreive all the data in a table located at http://www.listenlive.nl/tvgenre.php?g=1&page=0 and parse the data to finish with an array that looks like this: $row[0][station_name] = '3BTV'; $row[0][stream_link] = '420'; $row[0][stream_type] = 'wma'; $row[0][country] = 'United Kingdom'; $row[0][genre][0] = 'Variety'; $row[0][genre][1] = 'Alternative'; $row[0][genre][2] = 'Culture'; $row[0][rating] = '1/5'; I need that for each rows of the table where the first array number would increment $row[1], $row[2] ... My PHP code is incomplete. I currently have a loop for all the TR's of the page ... and when i loop all the TD's inside the TR's it returns a load of crap ... I am unsure where to go from here. Any help would be apreciated thx This is my code: $ch = curl_init(); $categ[url] = 'http://www.listenlive.nl/tvgenre.php?g=1&page=0'; curl_setopt($ch, CURLOPT_URL, $categ[url]); curl_setopt($ch, CURLOPT_POST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies); curl_setopt($ch, CURLOPT_COOKIE, $cookies); curl_setopt($ch, CURLOPT_REFERER, $categ[url]); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_USERAGENT, $nav); $data2 = curl_exec($ch); $dom2 = new DOMDocument(); libxml_use_internal_errors(true); $dom2->loadHTML($data2); $trs = $dom2->getElementsByTagName('tr'); foreach ($trs as $tr) { echo "<pre>"; print_r($tr); echo "</pre>"; }
  8. Here's what I am trying to do. Users Table user_id, sponsor_id, username, filled_positions, position_1, position_2, position_3, position_4, position_5 1 0 user 1 4 user 2 user 3 user 4 user 5 2 1 user 2 2 user 4 user 5 3 1 user 3 4 2 user 4 5 2 user 5 Above is a "Users" table. Here's what I am trying to do. Insert new users into the table. Say I already have the users table set up with 5 users. I want to add User 6. I want to loop through the users in the table and find the next empty position and update it with the new user id. In this scenario diagram above, the next empty position is Row 1 - position_5. The one after that is Row 2 - position_3 and then Row 2 - position_4...etc. It basically loops through rows and checks each position. So User 6 will be placed under Row 1 - position_5 and User 7 will be placed under Row 2 - position_3. How can one go on about doing that?
  9. I have a mysql table named songs with 3 columns, id, artist,title. Most of the songs in the artist column are correct, ex: artist ------------------ John Denver Loretta Lynn Shania Twain Luke Bryan But some of the songs in the artist column are reveresed with a comma, ex: artist ----------------- Dever, John Lynn. Loretta Twain, Shania Bryan, Luke Is there an easy php code snippet or mysql statement that i can use to reverse the order of first name and last name and remove the comma in the last example so the artst columd matches the first example? I hope this makes sense, thanks, Dale.
  10. Hi guys, i have a table with 6 COLS and 12 ROWS. In the first column is a filed with dimensions (4 ml) and in the other 5 columns are the prices with are different one from another. What i like to do is when i click on a cell from the table to autocomplete bellow 2 inputs 1 with dimension and another with the price from that cell. I've manage to do the first part but the secound one i don't know how to do. Please have a look at my code below. (function () { if (window.addEventListener) { window.addEventListener('load', run, false); } else if (window.attachEvent) { window.attachEvent('onclick', run); } function run() { var t = document.getElementById('myTable'); t.onclick = function (event) { event = event || window.event; //IE8 var target = event.target || event.srcElement; while (target && target.nodeName != 'TR') { // find TR target = target.parentElement; } //if (!target) { return; } //tr should be always found //var cells = target.cells; //cell collection - https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableRowElement var cells = target.getElementsByTagName('td'); //alternative var f1 = document.getElementById('Inaltime / Dimensiune'); var f2 = document.getElementById('Ø 14'); var f3 = document.getElementById('Ø 16'); var f4 = document.getElementById('Ø 18'); var f5 = document.getElementById('Ø 20'); var f6 = document.getElementById('Ø 25'); f1.value = cells[0].innerHTML; f2.value = cells[1].innerHTML; f3.value = cells[2].innerHTML; f4.value = cells[3].innerHTML; f5.value = cells[4].innerHTML; f6.value = cells[5].innerHTML; //console.log(target.nodeName, event); }; } })(); <table id="myTable" class="demo"> <caption> <h3>Sisteme de cosuri fum TONA <span class="orange-price">- 15% REDUCERE</span></h3></caption> <thead> <tr> <th> Inaltime / Dimensiune </th> <th>Ø 14</th> <th>Ø 16</th> <th>Ø 18</th> <th>Ø 20</th> <th>Ø 25</th> </tr> </thead> <tbody> <tr> <td>5 ml <br> </td> <td><span class="old-price">583 EUR</span> <br> <span class="orange-price">496 EUR</span> </td> <td><span class="old-price">630 EUR</span> <br> <span class="orange-price">536 EUR</span> </td> <td><span class="old-price">661 EUR</span> <br> <span class="orange-price">562 EUR</span> </td> <td><span class="old-price">704 EUR</span> <br> <span class="orange-price">598 EUR</span> </td> <td><span class="old-price">1125 EUR</span> <br> <span class="orange-price">956 EUR</span> </td> </tr> <tr> <td>5.5 ml</td> <td><span class="old-price">608 EUR</span> <br> <span class="orange-price">517 EUR</span> </td> <td><span class="old-price">659 EUR</span> <br> <span class="orange-price">560 EUR</span> </td> <td><span class="old-price">692 EUR</span> <br> <span class="orange-price">588 EUR</span> </td> <td><span class="old-price">737 EUR</span> <br> <span class="orange-price">626 EUR</span> </td> <td><span class="old-price">1187 EUR</span> <br> <span class="orange-price">1009 EUR</span> </td> </tr> <tr> <td>6 ml</td> <td><span class="old-price">634 EUR</span> <br> <span class="orange-price">539 EUR</span> </td> <td><span class="old-price">687 EUR</span> <br> <span class="orange-price">584 EUR</span> </td> <td><span class="old-price">722 EUR</span> <br> <span class="orange-price">614 EUR</span> </td> <td><span class="old-price">770 EUR</span> <br> <span class="orange-price">655 EUR</span> </td> <td><span class="old-price">1250 EUR</span> <br> <span class="orange-price">1063 EUR</span> </td> </tr> <tr> <td>6.5 ml</td> <td><span class="old-price">659 EUR</span> <br> <span class="orange-price">560 EUR</span> </td> <td><span class="old-price">716 EUR</span> <br> <span class="orange-price">609 EUR</span> </td> <td><span class="old-price">752 EUR</span> <br> <span class="orange-price">639 EUR</span> </td> <td><span class="old-price">803 EUR</span> <br> <span class="orange-price">683 EUR</span> </td> <td><span class="old-price">1313 EUR</span> <br> <span class="orange-price">1117 EUR</span> </td> </tr> <tr> <td>7 ml</td> <td><span class="old-price">685 EUR</span> <br> <span class="orange-price">582 EUR</span> </td> <td><span class="old-price">745 EUR</span> <br> <span class="orange-price">633 EUR</span> </td> <td><span class="old-price">782 EUR</span> <br> <span class="orange-price">665 EUR</span> </td> <td><span class="old-price">836 EUR</span> <br> <span class="orange-price">711 EUR</span> </td> <td><span class="old-price">1375 EUR</span> <br> <span class="orange-price">1169 EUR</span> </td> </tr> <tr> <td>7.5 ml</td> <td><span class="old-price">710 EUR</span> <br> <span class="orange-price">604 EUR</span> </td> <td><span class="old-price">774 EUR</span> <br> <span class="orange-price">660 EUR</span> </td> <td><span class="old-price">812 EUR</span> <br> <span class="orange-price">690 EUR</span> </td> <td><span class="old-price">869 EUR</span> <br> <span class="orange-price">739 EUR</span> </td> <td><span class="old-price">1438 EUR</span> <br> <span class="orange-price">1222 EUR</span> </td> </tr> <tr> <td>8 ml</td> <td><span class="old-price">735 EUR</span> <br> <span class="orange-price">625 EUR</span> </td> <td><span class="old-price">803 EUR</span> <br> <span class="orange-price">683 EUR</span> </td> <td><span class="old-price">843 EUR</span> <br> <span class="orange-price">717 EUR</span> </td> <td><span class="old-price">902 EUR</span> <br> <span class="orange-price">767 EUR</span> </td> <td><span class="old-price">1500 EUR</span> <br> <span class="orange-price">1275 EUR</span> </td> </tr> <tr> <td>8.5 ml</td> <td><span class="old-price">761 EUR</span> <br> <span class="orange-price">647 EUR</span> </td> <td><span class="old-price">831 EUR</span> <br> <span class="orange-price">706 EUR</span> </td> <td><span class="old-price">873 EUR</span> <br> <span class="orange-price">742 EUR</span> </td> <td><span class="old-price">935 EUR</span> <br> <span class="orange-price">795 EUR</span> </td> <td><span class="old-price">1563 EUR</span> <br> <span class="orange-price">1329 EUR</span> </td> </tr> <tr> <td>9 ml</td> <td><span class="old-price">802 EUR</span> <br> <span class="orange-price">682 EUR</span> </td> <td><span class="old-price">876 EUR</span> <br> <span class="orange-price">745 EUR</span> </td> <td><span class="old-price">919 EUR</span> <br> <span class="orange-price">781 EUR</span> </td> <td><span class="old-price">984 EUR</span> <br> <span class="orange-price">836 EUR</span> </td> <td><span class="old-price">1642 EUR</span> <br> <span class="orange-price">1396 EUR</span> </td> </tr> <tr> <td>9.5 ml</td> <td><span class="old-price">827 EUR</span> <br> <span class="orange-price">703 EUR</span> </td> <td><span class="old-price">905 EUR</span> <br> <span class="orange-price">769 EUR</span> </td> <td><span class="old-price">949 EUR</span> <br> <span class="orange-price">807 EUR</span> </td> <td><span class="old-price">1017 EUR</span> <br> <span class="orange-price">864 EUR</span> </td> <td><span class="old-price">1704 EUR</span> <br> <span class="orange-price">1448 EUR</span> </td> </tr> <tr> <td>10 ml</td> <td><span class="old-price">853 EUR</span> <br> <span class="orange-price">725 EUR</span> </td> <td><span class="old-price">934 EUR</span> <br> <span class="orange-price">794 EUR</span> </td> <td><span class="old-price">979 EUR</span> <br> <span class="orange-price">832 EUR</span> </td> <td><span class="old-price">1050 EUR</span> <br> <span class="orange-price">893 EUR</span> </td> <td><span class="old-price">1767 EUR</span> <br> <span class="orange-price">1502 EUR</span> </td> </tr> <tbody> </table>
  11. I have created a system that uses an API to drop utility data into MSQL Server 2008. Once the data is in the db, a web app can query the data to create electric bills. Currently we are working with only one customer but are entertaining expansion and want to approach the growth from the best possible angle. Considering that all data is the same type of data but comes from different customers and sources, would it be best to maintain 1 database with all of the utility meter data streaming to it or would it be best to have a new data base with each customer? Also, assuming we keep it all in the same database, would it be best (assuming we are secure) to have all the individual customers data go to the same tables or have separate tables for separate customers. I'm pretty certain I know the answer but I'm a novice so that means nothing. Thank you for any help with this issue.
  12. I have a strange problem which I just cannot figure out. Some background before the question: I hired a programmer to build a feature for my site last year. I fear she tamperd with the code in ways she should not have and now it is not working correctly like it used to. PROBLEM: When a user completes a form and submits it, all fields are saved to my DB/table except for the userName and password fields. I have scoured the code for two days now and cannot figure out why this is happening, or rather, not happening. Thank you in advance for any hint or push in the correct direction regarding this specific issue! Here is the code: (Please see start of issue at line 153) <!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" xml:lang="en" lang="en"> <head> <title>Sliding Login Panel with jQuery 1.3.2</title> <meta name="description" content="Demo of a Sliding Login Panel using jQuery 1.3.2" /> <meta name="keywords" content="jquery, sliding, toggle, slideUp, slideDown, login, login form, register" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <!-- stylesheets --> <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" /> <link rel="stylesheet" href="css/slide.css" type="text/css" media="screen" /> <!-- PNG FIX for IE6 --> <!-- http://24ways.org/2007/supersleight-transparent-png-in-ie6 --> <!--[if lte IE 6]> <script type="text/javascript" src="js/pngfix/supersleight-min.js"></script> <![endif]--> <!-- jQuery Slide --> <script src="http://code.jquery.com/jquery-latest.js"></script> <!-- Sliding effect --> <script src="js/slide.js" type="text/javascript"></script> <script> function validateEmail(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } $(document).ready(function() { $('.error_message').hide(); $('#first_val').val(Math.floor(Math.random()*11)); $('#second_val').val(Math.floor(Math.random()*11)); $('#loadingGif').hide(); $('.bt_register').click(function(e){ $('#loadingGif').show(); e.preventDefault(); $('.error_message').hide(); $('#email_error').html("Please enter a valid email."); $('#user_error').html('Required'); error=false; if ($('#user').val().length<1) { error=true; $('#user_error').show(); } if ($('#email').val().length<1 || !validateEmail($('#email').val())) { error=true; $('#email_error').show(); } if ($('#pass').val().length< { error=true; $('#pass_error').show(); } if ($('#city').val().length<1) { error=true; $('#city_error').show(); } if ($('#pass').val() != $('#confirmpass').val()) { error=true; $('#confirmpass_error').show(); } var disallowed_characters=/www|http|@|com|\./; if (disallowed_characters.test($('#city').val())) { error=true; $('#city_error').show(); } if (disallowed_characters.test($('#company').val())) { error=true; $('#company_error').show(); } $.getJSON('ajax.php?username='+$('#user').val(), function(data) { if (data.error) { error=true; alert('An error has occured'); } else { if (!data.isUnique) { error=true; $('#user_error').html('This username is already taken.'); $('#user_error').show(); } } $.getJSON('ajax.php?email='+$('#email').val(), function(data) { if (data.error) { error=true; alert('An error has occured'); } else { if (!data.isUnique) { error=true; $('#email_error').html('This email is already being used.'); $('#email_error').show(); } } if ($('#equals_val').val() != (parseInt($('#first_val').val()) + parseInt($('#second_val').val()))) { error=true; $('#captcha_error').show(); } if (!error) { console.log('submit'); $('#member-signup').submit(); } $('#loadingGif').hide(); }); }); }) }) </script> <!--Favicon--> <link rel="icon" href="favicon.ico" type="image/x-icon"/> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/> <!--Country Dropdown--> <!-- <msdropdown> --> <link rel="stylesheet" type="text/css" href="css/msdropdown/dd.css" /> <script src="js/msdropdown/jquery.dd.min.js"></script> <!-- </msdropdown> --> <link rel="stylesheet" type="text/css" href="css/msdropdown/flags.css" /> <style> .error_message { color: #cf1717; font: Arial; font-size: 14px; display:block; } #panel { height: auto; } </style> </head> <body> <?php define('DB_HOST','localhost'); define('DB_NAME','******'); define('DB_USER','******'); define('DB_PASSWORD','******'); $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL:" . mysql_error()); $db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL:" . mysql_error()); function NewUser() { $userName = $_POST['userName']; $email = $_POST['email']; $password = $_POST['password']; $countries = $_POST['countries']; $city = $_POST['city']; $company = $_POST ['company']; $state = $_POST ['state'];//Added 11/3/2014 $query = "INSERT INTO Table4 (userName,email,password,countries,city,company,state) VALUES ('$userName','$email','$password','$countries', '$city','$company','$state')"; $data = mysql_query ($query)or die(mysql_error()); if($data) { echo $state //echo "YOUR REGISTRATION IS COMPLETED..."; } } function SignUp() { if(!empty($_POST['userName'])) //checking the 'user' name which is from Sign-Up.html, is it empty or have some text { if ($_POST['equals_val'] != ($_POST['first_val'] + $_POST['second_val'])) { echo "CAPTCHA IS NOT CORRECT"; } else { $query = mysql_query("SELECT * FROM WebsiteUsers WHERE userName = '$_POST[user]' AND pass = '$_POST[pass]'") or die(mysql_error()); if(!$row = mysql_fetch_array($query) or die(mysql_error())) { NewUser(); } else { echo "SORRY...YOU ARE ALREADY REGISTERED USER..."; } } } } if(isset($_POST['submit'])) { SignUp(); } if (isset($_POST['type'])) { if ($_POST['type'] == "login") } ?> <!-- Panel --> <div id="toppanel"> <div id="panel"> <div class="content clearfix"> <div class="left"> <h1>Welcome to RedLineDown</h1><div style="color:#FFFFFF;">RedLineDown</div> <p class="grey">###</p> </div> <div class="left"> <!-- Login Form --> <form class="clearfix" action="#" method="post"> <h1>Member Login</h1> <input type="hidden" name="type" value="login" /> <label class="white" for="log">Username:</label> <input class="field" type="text" name="log" id="log" value="" size="23" /> <label class="white" for="pwd">Password:</label> <input class="field" type="password" name="pwd" id="pwd" value="" size="23" /> <div class="clear"></div> <input type="submit" name="submit-form" value="Login" class="bt_login" /> </form> </div> <div class="left right"> <!-- Register Form --> <form method="POST" id="member-signup" action="dbConnect.php"> <h1>Not a member yet? Sign Up!</h1> <input type="hidden" name="type" value="signup" /> <!-- Username Field --> <label type="grey" for="signup">Username:</label> <input type="field" type="text" name="user" id="user" value="" size="23")/><span class='error_message' id='user_error'>Required</span> <!-- Email Field(s) --> <label type="grey" for="email">Email:</label> <input type="field" type="text" name="email" id="email" size="23" /><span class='error_message' id='email_error'>Please enter a valid email.</span> <!-- Password Field --> <label type="grey" for="email">Password:</label> <input type="password" name="pass" id="pass" size="23" /><span class='error_message' id='pass_error'>Password must be at least 8 characters long.</span> <!-- Password Field --> <label type="grey" for="email">Confirm Password:</label> <input type="password" name="confirmpass" id="confirmpass" size="23" /><span class='error_message' id='confirmpass_error'>Passwords do not match.</span> //Insert countries here (Dropdown) <!-- City Field --> <label type="grey" for="email">City:</label> <input type="field" type="text" name="city" id="city" size="23" /> <select name="state" id="state"> <option value="AK">AK</option> <option value="AL">AL</option> <option value="AR">AR</option> <option value="AZ">AZ</option> <option value="CA">CA</option> <option value="CO">CO</option> <option value="CT">CT</option> <option value="DC">DC</option> <option value="DE">DE</option> <option value="FL">FL</option> <option value="GA">GA</option> <option value="HI">HI</option> <option value="IA">IA</option> <option value="ID">ID</option> <option value="IL">IL</option> <option value="IN">IN</option> <option value="KS">KS</option> <option value="KY">KY</option> <option value="LA">LA</option> <option value="MA">MA</option> <option value="MD">MD</option> <option value="ME">ME</option> <option value="MI">MI</option> <option value="MN">MN</option> <option value="MO">MO</option> <option value="MS">MS</option> <option value="MT">MT</option> <option value="NC">NC</option> <option value="ND">ND</option> <option value="NE">NE</option> <option value="NH">NH</option> <option value="NJ">NJ</option> <option value="NM">NM</option> <option value="NV">NV</option> <option value="NY">NY</option> <option value="OH">OH</option> <option value="OK">OK</option> <option value="OR">OR</option> <option value="PA">PA</option> <option value="RI">RI</option> <option value="SC">SC</option> <option value="SD">SD</option> <option value="TN">TN</option> <option value="TX">TX</option> <option value="UT">UT</option> <option value="VA">VA</option> <option value="VT">VT</option> <option value="WA">WA</option> <option value="WI">WI</option> <option value="WV">WV</option> <option value="WY">WY</option> </select> <span class='error_message' id='city_error'>Please enter a valid city.</span> <!-- Company Field --> <label class="white" for="email">Company:</label> <input class="field" type="text" name="company" id="company" size="23" /> <span class='error_message' id='company_error'>Please enter a valid company name.</span> <label class="white" for="captcha">Are you human:</label><br> <input class="field" type="text" name="first_val" id="first_val" style="width: 30px;" size="3" disabled/> + <input class="field" type="text" name="second_val" id="second_val" style="width: 30px;" size="3" disabled/> = <input class="field" type="text" name="equals_val" id="equals_val" style="width: 30px;" size="3" /><br> <span class='error_message' id='captcha_error'>Captcha is not correct.</span> <input type="submit" name="submit-form2" value="Register" class="bt_register" /> <img src="loading.gif" id="loadingGif"> <!-- Captcha --> </form> </div> </div> </div> <!-- /login --> <!-- The tab on top --> <div class="tab"> <ul class="login"> <li class="left"> </li> <li>Hello Guest!</li> <li class="sep">|</li> <li id="toggle"> <a id="open" class="open" href="#">Log In | Register</a> <a id="close" style="display: none;" class="close" href="#">Close Panel</a> </li> <li class="right"> </li> </ul> </div> <!-- / top --> </div> <!--panel --> <div id="container"> <div id="content" style="padding-top:100px;"> </div><!-- / content --> </div><!-- / container --> </body> </html>
  13. Hi Peeps So basically im creating a "customer page" i have 2 tabs, 1 is customer info which is the primary and the invoicing tab I have a date picker in the invoicing tab which im hoping will populate a table below. I tried having the form post to php but this resets the page which then goes to the customer info tab so im guessing this will have to be done with jquery and ajax. could someone please point me in the right direction to do this? here is the current page for better explanation: All help is greatly appreciated in advance Mooseh
  14. Hello guys, I have a page named compare.php with two dropdown lists wich are populated with same values from a specific table. Now what i want to do is when a user is selecting one value from the first dropdown and another value from the secound dropdown to be redirected to a page lets say compare-items.php?id=1&id=2 and here in two different cols to get the values for the items, in the first col the values for the first item, and in the secound col the values from the sec item. How can i achive that? Thank you very much!
  15. Say I have 2 tables. Table 1: Type(type_id, type_name) Table 2: Records(record_id, record_name, record_type) Under the "record_type" column, is it better to use type_id(eg. 10) or type_name(eg. Clothing & Watches)? If the answer is use the name, is it better to use the original name(Clothing & Watches) or a slug name(clothing-watches)?
  16. I have a table With 28 Rows & 18 Columns and I want every column header to be sortable When you click it and sort the column numerically Except for the first column which is the name column which I want to sort alphabetically. I am using a template off W3.CSS So I'm using there W3.CSS Javascript code to sort tables but I can't seem to get it to work. I will include my table code and the code that I tried to use to sort the table. Any help would be appreciated. Here is my html code <!DOCTYPE html> <html lang="en-us"> <head> <title>W3.CSS</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="styles.css"> <script type="text/javascript" src="naddymyscript.js"></script> </head> <body> <div class="w3-container"> <hr> <div class="w3-center"> <h2>Individual Stats 2016-2017</h2> </div> <div class="w3-responsive w3-card-4"> <table class="w3-table w3-striped w3-bordered" id="otcindividualstatsTable"> <thead> <tr class="w3-theme"> <th onclick="sortTable">Name</th> <th onclick="sortTable">Grade</th> <th onclick="sortTable">Wins</th> <th onclick="sortTable">Losses</th> <th onclick="sortTable">Win %</th> <th onclick="sortTable">TD</th> <th onclick="sortTable">OP TD</th> <th onclick="sortTable">TD%</th> <th onclick="sortTable">3 Pt. NF</th> <th onclick="sortTable">2 Pt. NF</th> <th onclick="sortTable">Reversals</th> <th onclick="sortTable">Escapes</th> <th onclick="sortTable">OP Escapes</th> <th onclick="sortTable">Escape %</th> <th onclick="sortTable">Pen. Hm.</th> <th onclick="sortTable">Pen. Opp.</th> <th onclick="sortTable">Pins</th> <th onclick="sortTable">Team Pts.</th> </tr> </thead> <tbody> <tr class="w3-white"> <td>Laredo Bugbee</td> <td>9</td> <td>7</td> <td>14</td> <td>33.33333</td> <td>9</td> <td>24</td> <td>27.27273</td> <td>2</td> <td>0</td> <td>1</td> <td>6</td> <td>4</td> <td>60</td> <td>0</td> <td>0</td> <td>2</td> <td>39</td> </tr> <tr class="w3-gray"> <td>Ben Naddy</td> <td>11</td> <td>38</td> <td>4</td> <td>90.4762</td> <td>23</td> <td>6</td> <td>79.3103</td> <td>8</td> <td>4</td> <td>12</td> <td>10</td> <td>36</td> <td>21.7391</td> <td>1</td> <td>0</td> <td>21</td> <td>255</td> </tr> <tr class="w3-white"> <td>Marc Hendricks</td> <td>11</td> <td>28</td> <td>13</td> <td>68.2927</td> <td>96</td> <td>48</td> <td>66.6667</td> <td>13</td> <td>3</td> <td>7</td> <td>41</td> <td>88</td> <td>31.7829</td> <td>1</td> <td>2</td> <td>4</td> <td>133</td> </tr> <tr class="w3-gray"> <td>Nate Hart</td> <td>11</td> <td>38</td> <td>4</td> <td>90.4762</td> <td>75</td> <td>25</td> <td>75</td> <td>15</td> <td>7</td> <td>11</td> <td>30</td> <td>50</td> <td>37.5</td> <td>1</td> <td>0</td> <td>21</td> <td>239</td> </tr> <tr class="w3-white"> <td>Max Naddy</td> <td>10</td> <td>24</td> <td>16</td> <td>60</td> <td>87</td> <td>22</td> <td>79.8165</td> <td>11</td> <td>3</td> <td>5</td> <td>15</td> <td>62</td> <td>19.4805</td> <td>4</td> <td>1</td> <td>8</td> <td>135</td> </tr> <tr class="w3-gray"> <td>Zane Swanson</td> <td>9</td> <td>21</td> <td>15</td> <td>58.3333</td> <td>22</td> <td>31</td> <td>41.5094</td> <td>3</td> <td>8</td> <td>11</td> <td>16</td> <td>1</td> <td>94.1176</td> <td>0</td> <td>7</td> <td>6</td> <td>112</td> </tr> <tr class="w3-white"> <td>James Holen</td> <td>12</td> <td>15</td> <td>10</td> <td>60</td> <td>34</td> <td>21</td> <td>61.8182</td> <td>7</td> <td>1</td> <td>6</td> <td>21</td> <td>24</td> <td>46.6667</td> <td>2</td> <td>1</td> <td>3</td> <td>74</td> </tr> <tr class="w3-gray"> <td>Alex Erlandson</td> <td>11</td> <td>18</td> <td>13</td> <td>58.0645</td> <td>32</td> <td>33</td> <td>49.2308</td> <td>6</td> <td>3</td> <td>16</td> <td>20</td> <td>18</td> <td>52.6316</td> <td>0</td> <td>1</td> <td>7</td> <td>107</td> </tr> <tr class="w3-white"> <td>Noah Schleske</td> <td>9</td> <td>2</td> <td>2</td> <td>50</td> <td>3</td> <td>7</td> <td>30</td> <td>2</td> <td>0</td> <td>3</td> <td>3</td> <td>5</td> <td>37.5</td> <td>0</td> <td>0</td> <td>1</td> <td>9</td> </tr> <tr class="w3-gray"> <td>Jace Leabo</td> <td>11</td> <td>20</td> <td>23</td> <td>46.5116</td> <td>43</td> <td>41</td> <td>51.1905</td> <td>6</td> <td>4</td> <td>14</td> <td>32</td> <td>45</td> <td>41.5584</td> <td>2</td> <td>1</td> <td>4</td> <td>70</td> </tr> <tr class="w3-white"> <td>Wyatt Thorson</td> <td>9</td> <td>12</td> <td>22</td> <td>35.2941</td> <td>22</td> <td>46</td> <td>32.3529</td> <td>2</td> <td>4</td> <td>13</td> <td>7</td> <td>21</td> <td>25</td> <td>1</td> <td>1</td> <td>3</td> <td>53</td> </tr> <tr class="w3-gray"> <td>Nathan Stavas</td> <td>10</td> <td>2</td> <td>2</td> <td>50</td> <td>1</td> <td>3</td> <td>25</td> <td>0</td> <td>0</td> <td>1</td> <td>1</td> <td>3</td> <td>25</td> <td>0</td> <td>0</td> <td>2</td> <td>10</td> </tr> <tr class="w3-white"> <td>Ramon Lopez</td> <td>11</td> <td>17</td> <td>18</td> <td>48.5714</td> <td>34</td> <td>35</td> <td>49.2754</td> <td>5</td> <td>2</td> <td>3</td> <td>23</td> <td>23</td> <td>50</td> <td>0</td> <td>0</td> <td>10</td> <td>100</td> </tr> <tr class="w3-gray"> <td>Nick Haugen</td> <td>12</td> <td>19</td> <td>25</td> <td>43.1818</td> <td>27</td> <td>34</td> <td>44.2623</td> <td>2</td> <td>2</td> <td>10</td> <td>23</td> <td>16</td> <td>58.9744</td> <td>0</td> <td>1</td> <td>14</td> <td>95</td> </tr> <tr class="w3-white"> <td>RJ Ehlert</td> <td>11</td> <td>13</td> <td>11</td> <td>54.1667</td> <td>11</td> <td>5</td> <td>68.75</td> <td>0</td> <td>0</td> <td>5</td> <td>7</td> <td>6</td> <td>53.8462</td> <td>2</td> <td>0</td> <td>10</td> <td>81</td> </tr> <tr class="w3-gray"> <td>Ben Cole</td> <td>12</td> <td>0</td> <td>3</td> <td>0</td> <td>0</td> <td>5</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>1</td> <td>1</td> <td>50</td> <td>0</td> <td>0</td> <td>1</td> <td>0</td> </tr> <tr class="w3-white"> <td>Michael Fielding</td> <td>11</td> <td>5</td> <td>14</td> <td>26.3158</td> <td>6</td> <td>21</td> <td>22.2222</td> <td>0</td> <td>0</td> <td>3</td> <td>7</td> <td>12</td> <td>36.8421</td> <td>0</td> <td>1</td> <td>0</td> <td>24</td> </tr> <tr class="w3-gray"> <td>Jacob Thompson</td> <td>12</td> <td>2</td> <td>5</td> <td>28.5714</td> <td>3</td> <td>9</td> <td>25</td> <td>3</td> <td>1</td> <td>1</td> <td>7</td> <td>2</td> <td>77.7778</td> <td>1</td> <td>0</td> <td>1</td> <td>16</td> </tr> <tr class="w3-white"> <td>Hunter Doll</td> <td>10</td> <td>6</td> <td>10</td> <td>37.5</td> <td>10</td> <td>17</td> <td>37.037</td> <td>2</td> <td>0</td> <td>6</td> <td>4</td> <td>11</td> <td>26.6667</td> <td>1</td> <td>0</td> <td>0</td> <td>21</td> </tr> <tr class="w3-gray"> <td>Christopher Kenyon</td> <td>12</td> <td>1</td> <td>2</td> <td>33.3333</td> <td>3</td> <td>3</td> <td>50</td> <td>0</td> <td>0</td> <td>2</td> <td>2</td> <td>3</td> <td>40</td> <td>1</td> <td>0</td> <td>1</td> <td>3</td> </tr> <tr class="w3-white"> <td>Jackson Boyum</td> <td>10</td> <td>0</td> <td>1</td> <td>0</td> <td>0</td> <td>3</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>1</td> <td>3</td> <td>25</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> </tr> <tr class="w3-gray"> <td>Matt Hendricks</td> <td>9</td> <td>4</td> <td>7</td> <td>36.3636</td> <td>10</td> <td>11</td> <td>47.619</td> <td>2</td> <td>0</td> <td>1</td> <td>3</td> <td>9</td> <td>25</td> <td>2</td> <td>0</td> <td>2</td> <td>21</td> </tr> <tr class="w3-white"> <td>Kevin Tierney</td> <td>11</td> <td>7</td> <td>15</td> <td>31.8182</td> <td>5</td> <td>24</td> <td>17.2414</td> <td>5</td> <td>0</td> <td>3</td> <td>7</td> <td>2</td> <td>77.7778</td> <td>0</td> <td>0</td> <td>1</td> <td>36</td> </tr> <tr class="w3-gray"> <td>Cian Buehler</td> <td>8</td> <td>3</td> <td>6</td> <td>33.3333</td> <td>3</td> <td>5</td> <td>37.5</td> <td>2</td> <td>0</td> <td>4</td> <td>2</td> <td>2</td> <td>50</td> <td>0</td> <td>0</td> <td>5</td> <td>15</td> </tr> <tr class="w3-white"> <td>Hayden Hart</td> <td>9</td> <td>12</td> <td>10</td> <td>54.5455</td> <td>16</td> <td>13</td> <td>55.1724</td> <td>2</td> <td>1</td> <td>5</td> <td>14</td> <td>13</td> <td>51.8519</td> <td>4</td> <td>1</td> <td>2</td> <td>48</td> </tr> <tr class="w3-gray"> <td>Reed Leabo</td> <td>8</td> <td>1</td> <td>2</td> <td>33.3333</td> <td>1</td> <td>5</td> <td>16.6667</td> <td>0</td> <td>1</td> <td>0</td> <td>1</td> <td>2</td> <td>33.3333</td> <td>0</td> <td>0</td> <td>0</td> <td>6</td> </tr> <tr class="w3-white"> <td>Daniel Ukkelberg</td> <td>12</td> <td>1</td> <td>0</td> <td>100</td> <td>0</td> <td>0</td> <td>100</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>6</td> </tr> </tbody> </table> </div> </body> </html> </body> Here is my javascript code //Sort Table Numerically function sortTable() { var table, rows, switching, i, x, y, shouldSwitch; table = document.getElementById("otcindividualstatsTable"); switching = true; /*Make a loop that will continue until no switching has been done:*/ while (switching) { //start by saying: no switching is done: switching = false; rows = table.rows; /*Loop through all table rows (except the first, which contains table headers):*/ for (i = 1; i < (rows.length - 1); i++) { //start by saying there should be no switching: shouldSwitch = false; /*Get the two elements you want to compare, one from current row and one from the next:*/ x = rows[i].getElementsByTagName("TD")[0]; y = rows[i + 1].getElementsByTagName("TD")[0]; //check if the two rows should switch place: if (Number(x.innerHTML) > Number(y.innerHTML)) { //if so, mark as a switch and break the loop: shouldSwitch = true; break; } } if (shouldSwitch) { /*If a switch has been marked, make the switch and mark that a switch has been done:*/ rows[i].parentNode.insertBefore(rows[i + 1], rows[i]); switching = true; } } }
  17. I use PHPMyAdmin. I have to convert an InnoDB table to a MyISAM table. I then have to add a FULLTEXT index to two of the table's columns. Is this how I should proceed? 1) Backup table by exporting its contents. 2) Go to "Relation view" and drop foreign key constraints. 3) ALTER TABLE `table_name` ENGINE = MyISAM; 4) ALTER TABLE `table_name` ADD FULLTEXT index_name (col1,col2); Is that it? Is it safe? Note that the table contains approximately 3,500 rows.
  18. I am finding that if I have "0"(zero) value in form select option, it won't select this option or submit data. If I change this value to any other number to text, it will work. Is there a way to fix this? I have to have an option where I am able to choose to submit "0" value to the database table. <option value="0" <?php if(empty($_POST['special'])) {} else { if($_POST['special'] == 0) { echo 'selected'; } } ?> >None</option>
  19. Hi everyone, I am still learning PHP, I am getting better a little, but i am still struggle with while and foreach loop to create few columns. I create one column with while or foreach, but I couldn't figure to create few columns intsead of one long column. Can you help me or make any suggest? Thank you so much
  20. Hallo everyone... here is my following code. i am fetching the picture from the file but unable to fetch it. kindly help me. error in bold underline... Thanks <!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> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php session_start(); $uid=''; include("connection.php"); $query=mysql_query("SELECT * FROM users WHERE uid='".$_GET['uid']."'"); $row=mysql_fetch_array($query); $image=$row['images_path']; ?> <form action="edit.php" method="post"> <table border="1px" align="center" width="85%"> <tr> <td colspan="3"><?php include'header.php' ?></td> </tr> <input type="hidden" name="uid" value="<?=$_GET['uid'];?>" /> <tr> <td colspan="3">Welcome <?php echo $_GET['uid']; ?> </td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">User Name</td> <td width="63%"> <input type="text" name="uname" value="<?php echo $row['uname']?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">User Email</td> <td width="63%"> <input type="text" name="email" value="<?php echo $row['email'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Mobile</td> <td width="63%"> <input type="text" name="mob" value="<?php echo $row['mob'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Type</td> <td width="63%"> <input type="text" name="type" value="<?php echo $row['type'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Status</td> <td width="63%"> <input type="text"name="status" value="<?php echo $row['status'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Picture</td> <td><?php echo "<img border=\"0\" src=\"".$row['images_path']."\" width=\"102\" alt=\"your name\" height=\"91\">"; ?></td> </tr> </tr> <tr height="50px;"> <td colspan="3" style="padding-left:350px;"><input type="submit" name="submit" /> <input type="reset" value="Clear" /></td> </tr> <tr> <td colspan="3"><?php include'footer.php' ?></td> </tr> </table> <div align="left"><a href="home_users.php">Home</a></div> </form> </body> </html> ------------------ Thanks in advance
  21. I currently have a fulltext search that works. It matches against a item title column in mysql database. Now I would like to include another column to match against. How can that be done properly? Here's my code. Where it says MATCH, I would like to include the type_1 column as well; like this(type_1.type_1_name). $get_records = $db->prepare("SELECT items.*, type_1.* FROM items LEFT JOIN type_1 ON items.type_1 = type_1.type_1_id WHERE MATCH(items.item_title) AGAINST('$search_query' IN BOOLEAN MODE) ORDER BY items.item_id DESC LIMIT {$limit} OFFSET ".$offset); $get_records->execute(); $result_records = $get_records->fetchAll(PDO::FETCH_ASSOC); if(count($result_records) > 0){ foreach($result_records as $row) { // get results } }
  22. So I've followed this code, corrected about 12 error, talked to my hosting and I am so done. I have tried everything but the error won't go away. The code is pasted below. As it's really late any help would be appreciated that would make my day the next day... <?PHP //connect to server $connect = mysql_connect("localhost","cello10_import","brigite27"); //connection to database mysql_select_db("cello10_import"); //query the database $query = mysql_query("SELECT * FROM users WHERE cover_image = 'http://d1w7fb2mkkr3kw.cloudfront.net/assets/images/book/small/9781/2500/9781250038821.jpg' "); //fetch the results / convert into array WHILE($rows = mysql_fetch_array(query)): $cover_image = $rows['cover_image']; $title = $rows['title']; $author = $rows['author']; echo "$cover_image<br>$title<br>$author<br><br><br>"; endwhile; ?> The error experienced is: Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in /home/cello10/public_html/display.php on line 10 Thanks for your help
  23. I am retrieving data from multiple joined tables that contain around 3,500 rows each. I am only showing limited results but the load time is the same. Like it takes 5 seconds to load the page. I don't want this same issue to continue if I am predicting over 1,000,000 rows from these tables. So what's the best way to fix this? Here is my query. $get_members = $db->prepare("SELECT users.*, approvals.*, sponsors.* FROM approvals LEFT JOIN users ON approvals.user_id = users.user_id LEFT JOIN sponsors ON approvals.user_id = sponsors.sponsored_user WHERE user_id > :user_id ORDER BY user_id DESC LIMIT 20"); $get_members->bindValue(':user_id', 0); $get_members->execute(); $result_members = $get_members->fetchAll(PDO::FETCH_ASSOC); if(count($result_members) > 0) { foreach($result_members as $row) { // show results here } } else { echo 'none'; } if(count($result_members) < 20) {} else { // show-more button here }
  24. I have a questions table and feedback table. I able to foreach the question header but not the feedback. My code as above: <?php $sql2 = "SELECT DISTINCT[question_id],[q_text] FROM [question]"; $ques = array(); $stmt2 = sqlsrv_query($conn, $sql2, $ques); while ($row = sqlsrv_fetch_array($stmt2, SQLSRV_FETCH_ASSOC)) { $ques[$row['question_id']] = $row['q_text']; } $sql = "SELECT [question_id], [Expr3],[Expr2] FROM [feedback] ORDER BY [Expr2] ASC"; $data = array(); $stmt = sqlsrv_query($conn, $sql); while (list($qid, $a, $eid) = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_NUMERIC)) { if (!isset($data[$qid][$eid])) { $data[$qid][$eid] = $newArray2; } $data[$qid][$eid][] = $a; } ?> <div class="container"> <?php // produce table header echo "<table border='1' id='table2excel'>\n"; echo "<tr><th>Employee ID</th>"; // loop over array of questions for the header foreach ($ques as $question) { echo "<th>$question</th>"; } echo "</tr>\n"; foreach ($data as $qid => $question) { foreach ($question as $question => $replies) { echo "<tr><td>$question</td>"; foreach (array_keys($ques) as $q_id) { echo "<td>"; echo $replies[$q_id]; echo "</td>"; } echo "</tr>\n"; echo "</tr>\n"; } } echo "</table>\n"; Questions Table: question_id q_text 1 Do you Like Red Color? 02A Do you Like Yellow Color? 02B Do you Like Blue Color? 3 Do you Like Green Color? 4 What color you like among them? 5 Do you Like Purple Color? 6 Do you Like Gold Color? 7 Do you Like Rose Gold Color? 8 Do you Like Black Color? 9 Do you Like Orange Color? The question 4, might be multiple answer. Feedback Table: question_id Expr2 Expr3 1 EMP1001 Yes 02A EMP1001 No 4 EMP1001 Red 4 EMP1001 Yellow 4 EMP1001 Blue 5 EMP1001 No 6 EMP1001 No 3 EMP1001 Yes 02B EMP1001 Yes 7 EMP1001 Yes 8 EMP1001 Yes 9 EMP1001 Yes 1 EMP1002 Yes 02A EMP1002 No 4 EMP1002 Red 5 EMP1002 No 6 EMP1002 Yes 3 EMP1002 Yes 02B EMP1002 Yes 7 EMP1002 No 8 EMP1002 9 EMP1002 Yes Result: Employee ID Do you Like Red Color? Do you Like Yellow Color? Do you Like Blue Color? Do you Like Green Color? What color you like among them? Do you Like Purple Color? Do you Like Gold Color? Do you Like Rose Gold Color? Do you Like Black Color? Do you Like Orange Color? EMP1001 EMP1002 EMP1001 EMP1002 EMP1001 EMP1002 EMP1001 EMP1002 EMP1001 EMP1002 EMP1001 EMP1002 EMP1001 EMP1002 EMP1001 EMP1002 EMP1001 EMP1002 EMP1001 EMP1002 Expected Result: Employee ID Do you Like Red Color? Do you Like Yellow Color? Do you Like Blue Color? Do you Like Green Color? What color you like among them? Do you Like Purple Color? Do you Like Gold Color? Do you Like Rose Gold Color? Do you Like Black Color? Do you Like Orange Color? EMP1001 Yes No Yes Yes Red No No Yes Yes Yes EMP1001 Yes No Yes Yes Yellow No No Yes Yes Yes EMP1001 Yes No Yes Yes Blue No No Yes Yes Yes EMP1002 Yes No Yes Yes Red No Yes No Yes The question id no.4 will allow multiple choice to select, hence there will be multiple feedback for that particular question. foreach.txt
  25. Is it possible to save history of all my tables from my other site and copy all those history into my new one? I have milions of posts at my site, but since im moving to other one which is a free host, i want to have all those history. I can easily copy main structure but i have like millions of posts and i want to keep them all.
  • 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.