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 22 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. 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.'; } }
  5. 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?
  6. 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.
  7. 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>
  8. 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>
  9. 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
  10. 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!
  11. 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)?
  12. 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; } } }
  13. 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>
  14. 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
  15. 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
  16. 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 } }
  17. 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 }
  18. 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
  19. 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.
  20. So I have two tables. Table 1 - Records Table 2 - Earnings I basically want to retrieve 6 active records from highest to lowest earnings. Here are the table setups. Records Table record_id | record_name | status 1 record_1 1 2 record_2 0 3 record_3 1 4 record_4 1 5 record_5 1 6 record_6 1 7 record_7 1 8 record_8 1 -------------------------------------------- Earnings Table earning_id | record_id | amount 1 1 $100 2 2 $200 3 3 $300 4 4 $400 5 5 $500 6 6 $600 7 7 $700 8 8 $800 9 1 $100 10 1 $100 As you can see I have total of 8 records. Only 7 of them are active. And record_1 has multiple earning rows. This is the tricky part. Normally I can retrieve the records seperatly and the earnings seperatly but I would like to know how can I combine this into a single query to achieve the same result so that I can list 6 active records from highest to lowest earnings? Here is my way so far. $find_records = $db->prepare("SELECT record_id, record_name, status FROM records WHERE status = :status"); $find_records->bindValue(':status', 1); $find_records->execute(); $result_find_records = $find_records->fetchAll(PDO::FETCH_ASSOC); if(count($result_find_records) > 0) { foreach($result_find_records as $row) { $record_id = $row['record_id']; $record_name = $row['record_name']; $record_status = $row['record_status']; $get_earnings = $db->prepare("SELECT amount FROM earnings WHERE record_id = :record_id"); $get_earnings->bindParam(':record_id', $record_id); $get_earnings->execute(); $result_earnings = $get_earnings->fetchAll(PDO::FETCH_ASSOC); if(count($result_earnings) > 0) { $ub = 0; foreach($result_earnings as $key=>$row) { $ub+= $row['deposit']; } $record_amount = $ub; } } }
  21. Basically i want to match 2 columns from table1 to 1 column in table2. Here's my code. How do I do the joins properly? $get_earnings = $db->prepare("SELECT users.*, member_earnings.* FROM member_earnings LEFT JOIN users ON member_earnings.sent_by = users.user_id LEFT JOIN users ON member_earnings.guest_id = users.user_id WHERE record_id = :record_id AND status = :status ORDER BY earning_id DESC LIMIT 20"); $get_earnings->bindParam(':record_id', $url_id); $get_earnings->bindValue(':status', 1); $get_earnings->execute();
  22. Hello I've been developing a unique way to make my menus and sites using a single PHP file over the last few years. the layout itself uses several tables, the main table that is a single column by 3 rows. the middle row is then embedded with a second table of 3 columns and 1 row and the mid column/cell has the menu followed by a single cell table that has a stack over flow so that if there is more data in the cell then there is vertical space a scroll bar appears. Here lays the problem though with all the different devices and with screens that have the horizontal and vertical accesses switched the ration is now off set and the site doesn't look correct on the screens like this (there is a lot of blank space at the bottom of the screen). to check out a working site you can go to http://paradisealleywrestling.com here is the code <!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=utf-8" /> <meta name="description" content="Paradise Alley Wrestling School" > <meta name="keywords" content="wrestling schools, wrestling, wrestling schools ct, wrestling schools east haven, wrestling schools east haven ct, wrestling schools connecticut, wrestling schools east haven connecticut, mario mancini, dave paradise, pretty paul roma, paul roma, wwf wrestlers, wrestlers, become a wrestler, become a pro wrestler, become a professional wrestler, how to become a wrestler, how to become a pro wrestler, how to become a professional wrestler, best wrestling schools" > <meta name="description" content="So you want to be a Pro Wrestler??? Well you've come to the right place. At Paradise Valley Wrestling School. you'll learn from the Pros the art of Pro Wrestling. They will train you in Agility, Ring Awareness, High Flying Skils and Ring Psychology. So give us a call at (203)410-5152 and see just who you can pin down." > <title>Paradise Alley Wrestling School</title> <LINK REL="SHORTCUT ICON" HREF="images/logo.ico"> <!-- this is the CSS script for the menu --> <style type="text/css" media="screen"> #maymenu {margin: 0; padding: 0; } #mymenu li {margin: 0; padding: 0; list-style: none; float: left; } #mymenu li a { display: none; margin: 0 0px 0 0; padding: 0px 0px; width: 80px; background: url(images/buttons/back.png); color: none; text-align: center; } #mymenu li a:hover { background: url(images/buttons/back.png)} #mymenu ul { position: absolute; visibility: hidden; margin: 0; padding: 0; background: url(images/buttons/back.png); border: 0px solid #ffffff } #mymenu ul a {position: relative; display: none; margin: 0; padding: 0px 0px; width: 80px; text-align: left; background: url(images/buttons/back.png); color: none; } #mymenu ul a:hover {background: url(images/buttons/back.png); } <!-- this is the css to turn the submit button into a link --> .submit { background: url(images/buttons/back.png); margin: 0; padding: 0; border: none; cursor: pointer; font-family: Arial, Helvetica, Verdana, Geneva, sans-serif; font-size: 13px; line-height: 16px; color: #FF5F55;button { overflow: visible; width: auto; } } </style> <!-- this is the java script for the menu --> <script type="text/javascript"> //Variables for the Menu declaration var timer = 0;var item = 0; //function for opening of submenu elements function openelement(num){ // checks whether there is an open submenu and makes it invisible if(item) item.style.visibility = 'hidden'; // shows choosen submenu element item = document.getElementById(num); item.style.visibility = 'visible'; } // function for closing submenu element function closeelelement(){ // closes the submenu and loads the timer to 500 ms timer = window.setTimeout("if(item) item.style.visibility = 'hidden';", 500); } //this is the line of code that has the syntax error //function for keeping the menu open after 500 mstimer function keepsubmenu(){ window.clearTimeout(timer);} // hides the visualized menu after clicking outside of it's area and expiring of the loaded timerdocument.onclick = closeelement; </script> <!-- this is the CSS for the font --> <style> @font-face { font-family: GoodCityModern; src: url('fonts/GoodCityModern.otf'); } gothic { font-family: GoodCityModern } </style> </head> <body bgcolor="lightblue" text="darkblue"> <script language="php"> session_start() ; //Starts the session so that the veriables can be read by the browser if(isset($_SESSION['selection']))// sees if the veriable is active yet $page = $_SESSION['selection']; // reads session variables else $_SESSION['selection'] = ("0"); $page = $_SESSION['selection']; // reads session variables if(isset($_POST['selection']))// sees if the veriable is active yet $page = $_POST['selection']; // reads session variables else { $page = $_SESSION['selection']; } // this sets up the correct order for the page topbar(); leftsidebar(); mainmenu($page); mainpage($page); rightsidebar(); bottombar(); //this loads the top bar function topbar(){ </script> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr height="65px"> <td background="images/backgrounds/homepage/topbar.jpg" width="100%" height="33" > <center> <img src="images/Logo.png" width="206" height="89"> </font></center> </td> </tr> <script language="php"> } //this loads the left side bar function leftsidebar() { </script> <tr height="250"> <td> <table width="100%" border="0" bordercolor="#FFDF00" cellpadding="0" cellspacing="0"> <tr> <td background="images/backgrounds/homepage/sidebars.jpg" width="13%"> <br /><br /><br /> <p><iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com/pages/Paradise-Alley-Wrestling-School/1193063250762362&width=180&colorscheme=light&show_faces=true&border_color&stream=true&header=true&height=400" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:180px; height:400px;" allowTransparency="true"></iframe></p> </td> <script language="php"> } //this section loads the menu function mainmenu($page){ if ($page=="0"){ </script> <!-- --> <td width="74%" style="word-wrap:break-word;"> <center> <table width="100%" height="40px" cellpadding="0" cellspacing="0" border="0"> <tr> <td> <img src="images/buttons/h_left.gif" /> </td> <td> <center> <!-- home button --> <form id="form1" name="form1" method="post" action="index.php"> <input name="selection" type="hidden" id="selection" value="0" /> <button type="submit" class="submit"> <img src="images/buttons/homecl.gif" border="0" onMouseOver="src='images/buttons/homeho.gif'" onMouseOut="src='images/buttons/homecl.gif'" width="81" /> </button> </form> </td> <td> <center> <!-- pics button --> <form id="form1" name="form1" method="post" action="index.php"> <input name="selection" type="hidden" id="selection" value="1" /> <button type="submit" class="submit"> <img src="images/buttons/picsuc.gif" border="0" onmouseover="src='images/buttons/picsho.gif'" onMouseOut="src='images/buttons/picsuc.gif'" width="81"/> </button> </form> </td> <td> <center> <!-- video button --> <form id="form1" name="form1" method="post" action="index.php"> <input name="selection" type="hidden" id="selection" value="2" /> <button type="submit" class="submit"> <img src="images/buttons/vidsuc.gif" border="0" onMouseOver="src='images/buttons/vidsho.gif'" onMouseOut="src='images/buttons/vidsuc.gif'" width="81"/> </button> </form> </td> <td> <center> <!-- trainers button --> <form id="form1" name="form1" method="post" action="index.php"> <input name="selection" type="hidden" id="selection" value="3" /> <button type="submit" class="submit"> <img src="images/buttons/trainersuc.gif" border="0" onMouseOver="src='images/buttons/trainersho.gif'" onMouseOut="src='images/buttons/trainersuc.gif'" width="81"/> </button> </form> </td> <td> <center> <!-- hours button --> <form id="form1" name="form1" method="post" action="index.php"> <input name="selection" type="hidden" id="selection" value="4" /> <button type="submit" class="submit"> <img src="images/buttons/hoursuc.gif" border="0" onMouseOver="src='images/buttons/hoursho.gif'" onMouseOut="src='images/buttons/hoursuc.gif'" width="81"/> </button> </form> </td> <td> <center> <!-- about us button --> <form id="form1" name="form1" method="post" action="index.php"> <input name="selection" type="hidden" id="selection" value="5" /> <button type="submit" class="submit"> <img src="images/buttons/auuc.gif" border="0" onMouseOver="src='images/buttons/auho.gif'" onMouseOut="src='images/buttons/auuc.gif'" width="81"/> </button> </form> </td> <td> <center> <!-- contact us button --> <form id="form1" name="form1" method="post" action="index.php"> <input name="selection" type="hidden" id="selection" value="6" /> <button type="submit" class="submit"> <img src="images/buttons/cuuc.gif" border="0" onMouseOver="src='images/buttons/cuho.gif'" onMouseOut="src='images/buttons/cuuc.gif'" width="81"/> </button> </form> </td> <td> <img src="images/buttons/h_right.gif" align="right" /> </td> </tr> </table> <table width=100% border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img src="images/buttons/TechnoBlackLj4.gif" /> </td> <td> <img src="images/buttons/TechnoBlackLj4.gif" align="right" /> </td> </tr> </table> </center> <script language="php"> } I cut out the rest of the menu because it just repeats making slight adjustments for the option that has been made // this loads the main page function mainpage($page){ </script> <div style="height: 415px; overflow:auto;"> <center> <script language="php"> if ($page=="0"){ homepage(); } if ($page=="1"){ pics(); } if ($page=="2"){ videos(); } if ($page=="3"){ trainers(); } if ($page=="4"){ hours(); } if ($page=="5"){ aboutus(); } if ($page=="6"){ contactus(); } </script> </center> </div> </td> <script language="php"> } this is the main page where the scroll bar is located. This cell I would like to make 74% of the vertical screen where the top and bottom are 13% each. I have tried to do this using the height attribute in every table row and column as well as the cells themselves and it doesn't work. and when I try to do it with the stack overflow it's even more out of proportion is there any way to fix this? //this loads the right side bar function rightsidebar(){ </script> <td background="images/backgrounds/homepage/sidebars.jpg" width="13%"> <br /><br /><br /> <p><iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com/pages/Paradise-Alley-Wrestling-School/1193063250762362&width=180&colorscheme=light&show_faces=true&border_color&stream=true&header=true&height=400" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:180px; height:400px;" allowTransparency="true"></iframe></p> </td> </tr> </table> </td> </tr> <script language="php"> } // loads the bottom bar function bottombar(){ </script> <tr> <td> <center> Paradise Alley Wrestling(c) (203)410-5152 <br /> 662 Coe Ave East Haven Ct. 06512 <br /> <a href="http://www.000webhost.com/" target="_blank"><img src="http://www.000webhost.com/images/80x15_powered.gif" alt="Web Hosting" width="80" height="15" border="0" /></a> </td> </tr> </table> <script language="php"> } //this is the home page function homepage(){ // print ("Sorry the Home page is under construction"); </script> <h2> <br /> So you want to be a Pro Wrestler??? <br /><br /> Well you've come to the right place. <br /><br /> At Paradise Alley Wrestling School. you'll learn from the Pros the art of Pro Wrestling. They will train you in Agility, Ring Awareness, High Flying Skils and Ring Psychology. <br /><br /> So give us a call at (203)410-5152 and see just who you can pin down. <script language="php"> } //this is the pics page function pics(){ print ("Sorry the Pics page is under construction"); } //this is the videos page function videos(){ print ("Sorry the Videos page is under construction"); } //this is the trainers page function trainers(){ //print ("Sorry the Trainers page is under construction"); </script> <table width="100%"> <tr> <td width="33%"> <img src="images/trainers/mariomancini.png" width="200" height="150" /> </td> <td width="33%"> <Center> <img src="images/trainers/daveparadise.png" width="200" height="150" /> </Center> </td> <td width="33%" align="right"> <img src="images/trainers/prettypaulroma.png" width="200" height="150" /> </td> </tr> <tr> <td width="33%"> </h1> <h4> Mario Mancini: <br /><br /> Mario Mancini became a professional wrestler about six weeks after his eighteenth birthday and was the youngest wrestler in the WWF in 1984. <br /><br /> On July 31, 1984 Mario Mancini debuted, his professional wrestling career, against Greg "The Hammer" Valentine, and later on wrestled Tony Atlas in Madison Square Garden. <br /><br /> Mario Mancini's favorite move is The Flying Clothesline, and his finishing moves were the Reverse Flying Body Press and the Pile Driver. </h4> </td> <td width="33%" valign="top"> </h1> <h4> Dave Paradise: <br /><br /> Dave Paradise debuted, his professional career with the WWF on August 23, 1988 in a tag team match with Davis Isley against Ax and Smash. </h4> </td> <td width="33%" valign="top"> </h1> <h4> Pretty Paul Roma: <br /><br /> Pretty Paul Roma debuted, his professional wrestling career on December 17, 1984, at an all American taping in Poughkeepsie, NY. Where he was teamed with Salvatore Bellomo in a match against WWF Tag-Team Champions Adrian Adonis and Dick Murdoch. </h4> </td> </tr> </table> <script language="php"> } //this is the hours page function hours(){ //print ("Sorry the Hours page is under construction"); </script> <h1> <center> Class Schedule </center> </center> </h1> <br /> <h3> Tuesday: 6:00 PM to 8:30 PM <br /> Thursday: 6:00 PM to 8:30 PM <br /> Saturday: 9:30 AM to 1:00 PM <br /><br /> <center> Come on down to 662 Coe Ave East Haven Ct. 06512 <br /> We are located in the back building second door from the left. </center> <script language="php"> } //this is the about us page function aboutus(){ //print ("Sorry the About Us page is under construction"); </script> <h1> Why choose Paradise Alley Wrestling School over the others?</h1> <br /><br /> </center> <h3> We Pride ourselves with three former profesional wresters with over 25 years of expertise, that have the skills and knowledge to hone your skills and make you the best Professional Wrestler possible. <br /><br /> If you want to be successful in Professional Wrestling, Paradise Alley Wrestling School, gives it's students the best opportunity to make thier Dreams a reality by being dedicated to maintaining the Standards and Ideals of what it takes to become a Professional Wrestler. <br /><br /> Paradise Alley Wrestling School will set the standard to what wrestling schools should teach and what lessons our students will walk away with.You will be taught the high flying skills along with the ring psychology to compete at a Professional level. We are dedicated to maintaining the standards and ideals of what it takes to become a professional wrestler. <br /><br /> When you graduate from Paradise Wrestling School, you are a well-rounded professional wrestler with the tools, ability and confidence to perform at a professional level </h3> <script language="php"> } //this is the contact us page function contactus(){ //print ("Sorry the Contact Us page is under construction"); </script> <center> <h1> Paradise Alley Wrestling School <br /> 662 Coe Ave <br /> East Haven Ct. 06512 </h1> </center> </center> <br /><br /> <font color="#FF1F00"> Phone: (203)410-5152 <br /> e-Mail: <a href="mailto:paradisealleywrestling@paradisealleywrestling.com">paradisealleywrestling@paradisealleywrestling.com</a> <br /> Facebook: <a href="Facebook.com/ParadiseAlleyWrestling">Facebook.com/ParadiseAlleyWrestling</a> <br /> <br /><br /> <center> <h3> Come visit us and see what the Rings all about <br /> 662 Coe Ave <br /> East Haven Ct. 06512 <br /> We are located in the back building second door from the left. </h3> </center> </font> <script language="php"> } </script> </body> </html> Thank you for your time Christopher J. Crandall
  • 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.