Jump to content

Search the Community

Showing results for tags 'select'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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 (PhpStorm, VS Code, 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. Hello..this is my first attempt to ask a question on this forum..I am trying to be as descriptive as possible what I have is select option in 'chart.php' page and once I select the value,it's passed to another 'getvalue.php' page using get. this 'getvalue.php' page will connect and run sql query with the value I sent and make table from the result and send it back using AJAX callback..it works fine for this concept so far. Now, I am trying something else. I am using google charts to visualize the data. So the thing is I run php code from 'chart.php' page where I manually enter the value for the query to take in and create a result for associative array. This array is linked to a variable myurl[]. Afterwards, in this same page 'chart.php'..I am in my Javascript calling this will variable because there is an option for arraytoDatatable in google charts. once all of this is done, the chart is displayed and everything is fine and happy. Now, what I want to do is select a value from the options and send that value in the same 'chart.php' page and run the query and update the google charts...so far I haven't been able to figure out why can't it send the value to the same page. I am not even sure if php can refer to its own self and call the value. Here's the code: <html> <form id="myform" method="GET" action="<?php echo $_SERVER['$PHP_SELF'];?>"> Select a orbital period (in days) <select id="sf" name="star"> <option value="0">0</option> <option value="0.5">0.5</option> <option value="10">10</option> <option value="100">100</option> <option value="365">365</option> </select> </form> <?php $o = intval($_GET['star']); /*$o = '10';*/ echo "$o<br>"; $con = mysqli_connect('localhost','username','password'); if (!$con) { die('Could not connect: ' . mysqli_error($con)); } mysqli_select_db($con,'mydatabase'); $sql="SELECT * FROM exoplanetdb WHERE pl_orbper >= '".$o."' "; $result = mysqli_query($con,$sql); $myurl[] = "['Mass','Mass,Radius(J)']"; while($row = mysqli_fetch_assoc($result)) { $mass=$row['pl_masse']; $radj=$row['pl_radj']; $myurl[] = "[".$mass.",".$radj."]"; } mysqli_close($con); ?> <!--make the chart--> <script src="https://www.google.com/jsapi"></script> <script> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ <?php echo(implode(",",$myurl));?> ]); var options = { selectionMode: 'multiple', title: 'Mass vs Size(times Jupiter radius)', hAxis: {title:'Mass(times Earths)'}, vAxis: {title:'Radius(times Jupiter)'} }; var chart = new google.visualization.ScatterChart(document.getElementById('chart_div')); chart.draw(data, options); } </script> </html> if something is unclear..plz ask me..I will try to explain..Thank you for your time
  2. I have a function that reads from a database and list to a webpage the results. What I want is to have the selected item on a list box show when a PHP variable is found, here is my code I have so far: <?php while ($row = db2_fetch_assoc($stmt)){ $WHMARK = $row['WHMARK']; $WHHOTEL = $row['WHHOTEL']; $WHSTATUS = $row['WHSTATUS']; if ($WHSTATUS == 1) { $Status = "Active"; } else{ $Status = "In-Active"; } echo '<tr>'; echo '<td>'.$WHMARK.'</td>'; echo '<td>'.$WHHOTEL.'</td>'; echo '<td>'.$Status.'</td>'; echo '<td>'; echo '<label>'; echo ' <select name="hotelActive" id="hotelActive">'; echo ' <option value="1"' <?php if($WHSTATUS == 1) ? 'selected="selected">';?>' echo '>Active</option>'; echo ' <option value="0"' <?php if($WHSTATUS == 0) ? 'selected="selected">';?>' echo '>In-Active</option>'; echo ' </select>'; echo '</label>'; echo '</td>'; echo '</tr>'; } ?> I need option value 1 selected if the variable '$Status' is 1 and option value 2 selected if the variable '$Status' is 2. This is PHP embedded in a HTML table.
  3. Hello all, I have created a database with 2 tables table1 and table2 like this (except desc, all columns are integer type and the leftmost column is always the primary key): table1: pid desc ================ 1001 Apple 1002 Orange 1003 Papaya table2: key pid cat ===================== 10001 1001 101 10002 1001 102 10003 1002 101 10004 1003 102 In other words, item 1001 (Apple) belongs to categories 101 and 102, while item 1002 (Orange) belongs to cat 101 only, and item 1003 (Papaya) belongs to cat 102 only. Now I would like to make a SELECT statement that returns the name of the item(s) that belong to both categories 101 and 102 (in the above case, Apple). Any simple way (using as few statements as possible) to do this? Thanks! -- Pengi.
  4. I need some assistance changing a single select into a multiple select form drop-down. I am having issues with the multiple selections storing. Thank you for your help! $var = " <script type='text/javascript'> jQuery(function(){ jQuery('form').attr('method', 'get'); jQuery('form').after('<input type=\"submit\" id=\"doaction_k2\" class=\"button-secondary action\" value=\"Apply Folder Access\" style=\"background: red; color: #fff;\">'); var thisurl = ''; var thaturl = ''; jQuery('#doaction_k2').live('click', function(){ jQuery('.new_file_access').each(function(){ thisurl = thisurl + '|' + jQuery(this).attr('userid') + '~' + jQuery(this).val(); }); jQuery('.new_file_readwrite').each(function(){ thaturl = thaturl + '|' + jQuery(this).attr('userid') + '~' + jQuery(this).val(); }); jQuery.post(document.URL, { update_access: 1, file_access: thisurl, file_readwrite: thaturl }, function(){ window.location = document.URL; }); return false; }); }); </script>"; } $var .= "<select multiple='yes' id='file_manager_accessk".$user_id."[]' class='new_file_access' userid='$user_id'><option value='' $noaccess>No Access</option>"; foreach($ACCESS_ARRAY as $key=>$value) { $key = str_replace('\\', '/', $key); $keys = $key .'~'. $urls.'/'.$value; $keys = substr($keys, 0, strlen($keys)-1); $keys1 = base64_encode($keys); $var .= "<option value='$keys1' $select[$keys]>$value</option>"; } $var .= "</select>"; return $var; ~ Sarah
  5. Good Day I was wondering if anyone could help me mysql does not seem to be working correctly MySQL server version: -- 5.5.24 the raw MySQL statement in question [mysql_query ("UPDATE ".$db_prefix."banner SET `shown`=0");] any errors that MySQL returns to the client [No ERROR just not updating] the table structure & column indexes of the relevant tables [-- -- Database: `second` -- -- -------------------------------------------------------- -- -- Table structure for table `shc_banner` -- CREATE TABLE IF NOT EXISTS `shc_banner` ( `idx` int(10) unsigned NOT NULL AUTO_INCREMENT, `banner_type` char(3) NOT NULL DEFAULT '', `cat_id` int(10) NOT NULL, `dir_id` char(3) NOT NULL, `banner_order` varchar(255) NOT NULL, `banner_file` varchar(255) NOT NULL DEFAULT '', `banner_title` varchar(255) NOT NULL DEFAULT '', `banner_url` varchar(255) NOT NULL DEFAULT '', `viewslimit` int(11) NOT NULL COMMENT 'After this amount of views has been reached, the ad will be expired. - 0 To disable', `clickslimit` int(11) NOT NULL COMMENT 'After this amount of clicks has been reached, the ad will be expired. - 0 to disable', `banner_target` varchar(255) NOT NULL, `banner_width` int(4) NOT NULL, `banner_height` int(4) NOT NULL, `banner_owner` varchar(255) NOT NULL DEFAULT '', `banner_dir` varchar(1000) NOT NULL, `banner_cat` varchar(1000) NOT NULL, `banner_hits` varchar(255) NOT NULL, `banner_clicks` varchar(255) NOT NULL, `show` int(1) DEFAULT NULL, PRIMARY KEY (`idx`), KEY `banner_type` (`banner_type`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Random Banner' AUTO_INCREMENT=170 ; -- -- Dumping data for table `shc_banner` --] the EXPLAIN output for your query: the query should update the database table but it does not in attached file line 64-67 a clear and concise description of what you want this statement to achieve: That the statment should update my table but it does not a description of what it's currently doing that's not to your liking: its not updating the table/ not even sowing up in debug mode localhost not live if anybody can help I'm new to this and could not find any solution at all Regards Rhino window.php
  6. Hello i need some help on how to select like this here below. Do i need somthing like not equal or greater than ? C. ------------------------------------ Ca Car Cars ..........................................<<< this is good ------------------------------------ H. ------------------------------------ Ho Hom Home........................................ <<< this is good Home G Home Ga Home Garden............................<< < this is good ------------------------------------ And the result should be like that C. ------------------------------------ Cars ------------------------------------ H. ------------------------------------ Home Home Garden ------------------------------------ Thanks for any help !
  7. I'm haveing a heck of a time trying to figure this out. All I want to do is save a SELECT array (mysql) to a CSV file. Here's what I'm trying. It $result = "SELECT product.reference AS sku, product.price - specific_price.reduction AS price, stock_available.quantity, marketplace_product_option.asin1 AS 'product-id', 'ASIN' AS 'product-id-type', product.condition AS 'condition-type' FROM product, specific_price, stock_available, marketplace_product_option WHERE product.id_product = specific_price.id_product AND product.id_product = stock_available.id_product AND product.id_product = marketplace_product_option.id_product;"; $fp = fopen('/home/aonewebs/public_html/amazon-export.csv', 'w+'); if ($fp && $result) { while ($row = mysql_fetch_row($result)) { fputcsv($fp, array_values($row)); } } creates an empty file (even though therer are 3000 lines to that array. I'm sure I'm missing something obvious. Any and all help greatly appreciated. Ron
  8. rseigel

    SELECT help

    I'm trying to run the following SELECT to get the data I need from my database. SELECT product.reference AS sku, product.price - specific_price.reduction AS price, stock_available.quantity, product.ean13 AS 'product-id', 'ASIN' AS 'product-id-type', product.condition FROM product, specific_price, stock_available WHERE product.id_product = specific_price.id_product = stock_available.id_product; PRoblem is that it takes too long to execute. I'm sure it's because I'm pulling from 3 different tables. Does anyone have a way to optimize this so it will work. I know all the field names are correct and everything worked until IO added that third table. Thanks,
  9. Hi all, Im trying to populate a drop down list from a php table but for some reason im getting stuck. The table structure is: Table name: Par1AddPatients_dynlist_items Columns: ID, listid, name, value I am trying to populate the list with names and corresponding values from the table, where the list id is ‘1’. <select name="ward_list"> <?php $connect = mysql_connect("localhost","username ","password "); if (!$connect) { die("MySQL could not connect!"); } $DB = mysql_select_db('jasperss_par1pats'); if(!$DB) { die("MySQL could not select Database!"); } $ward_list = mysql_query("SELECT name AND value FROM Par1AddPatients_dynlist_items WHERE listid = '1'"); while ($row = mysql_fetch_array($ward_list)){ echo '<option value="'. $row['value'] .'">'. $row['name'] .'</option>'; } ?> </select> At the moment I’m just getting an empty drop-down box. Any ideas where i'm going wrong? Thanks in advance for any help with this, Matt
  10. I have a program with 3 select statements, each of which will be populated based on the selected value of the previous one. but for some reason it's not working, and I am tearing my hair out trying to figure out what I am doing wrong. The values of the selects are blank when the page loads, I have a script that detects the page has loaded, and this calls a task that populates the first dropdown. This works fine. I have a script that follows this which detects a change in the selected value of the first dropdown and is supposed to call a task to populate the second dropdown. This does not trigger at all. The only way I can get it to trigger is if I comment out the first script (initial load). I'm sure it's something simple, but for my simple mind (when it comes to JS at least) it's proving an impossible task, and I'm all Googled out. The input form code is as follows: <form method="POST" id="Form1" name="Form1" action="TIMINGTOOL.pgm?task=dspitems"> <span id="first-choice-code"> <select id='first-choice'> <option value='null'>Select A Manufacturer</option> </select> </span> <br> <span id="second-choice-code"> <select id='second-choice'> <option value='null'></option> </select> </span> <br> <span id="third-choice-code"> <select id='third-choice'> <option value='null'></option> </select> </span> <br> <div id="FirstError" style="color:red"></div> <div id="SecondError" style="color:red"></div> <div id="ThirdError" style="color:red"></div> <input type="image" src="images/GO_Up.gif" name="Go1" border="0" align="absbottom" id="Go1" /> </form> The scripts (which are just above the page footer) are as follows: <script> // Populate First Select On Page Load $(window).load(function(){ $.get("TIMINGTOOL.pgm?task=first" , function(data) { $("#first-choice-code").html(data); }); alert("select loaded"); }); </script> //script> // Populate Second Select On First Change //$("#first-choice").change(function() { // $.get("TIMINGTOOL.pgm?task=second&choice="+$("#first-choice").val() , function(data) { // $("#second-choice-code").html(data); //}); //}); ///script> <script> // Populate Second Select On First Change $("#first-choice").change(function(){ alert("The new value is: " + $(this).val()); }); </script> The "real" second script has been commented out in the above code, and replaced by one that detects a change in the dropdown and displays an alert. The first script is also set to display an alert so I can tell which is triggered. Any thoughts please. I know it could probably be coded better, but I am trying to keep it simpler based on my limited knowledge of Javascript and my even more limited knowledge of Jquery. Thanks in advance.
  11. hello everyone, im new here and i need help to complete a job. the thing is: i need a form that pulls data from database and then after the submit button it will save it to another table. the form will have 3 selects that are connected, all of them are filled with a table info. when the first one is choosen the second one will appear and so on. also the form will have to save the text from the selects, not the value: echo ("<option value=\"$row[cod_ano]\ " . ($ano == $row["cod_ano"]? " selected" : "" ) . "> ".$row['nome_ano'] . "</option>"); i need to save the .$row['nome_ano'] but it saves the .$row['cod_ano'], and if i change it the 2nd one doenst work. this is getting my crazy allready... can any1 help??? thanks.
  12. Hello, i want to excuse for my english beforehand since i know for sure i'll be making mistakes but i hope to at least be clear enough to pass the main ideas. This is gonna be my first post in the forum and i'm very excited to be learning php from you guys. I'm new to this programing world but i'm a very passionate learner and certainly am eager to get my projects running. I'd love to help other people too, whenever i get in such a position. So let me start with some background. There's a free... i don't know how you call it... billing software?... called Factusol out there, which happens to have an open source web module so that you can put up a little shop online with all your stored data. It's a pretty basic e-shop, nothing fancy going on in there but the fact that you can upload all your inventory, clients, agents, etc from Factusol itself, with just a click, is pretty handy. So firstly i was wondering if maybe there be some other people here already aware of Factusol and interested in working around the php website aspect, improving its features, adding some more item details to be shown. Hopefully we can get together and pull something out. Anyway. I'll get to specifics now. I said it before, i'm a newbie but i've been looking through some of the php code and trying to add extra functionality to the site, specifically, i'm working in adding 2 new item description fields, be them size and color. So i've managed to make them appear in two separated select drop down menu instances. What i want to do now is to make the price field show different prices depending on the size or color selection. All my efforts have barely taken me as far as to have the suspicion that an Onchange event may have to be thrown somewhere around the code... but then again i'm lost. I'll appreciate whatever input you can give me. This is the sizes select section of the code: //Tallas if($conf['MDECFG'] == 1) { echo('<td width="100" align="center" bgcolor="' . $colorcelda . '">'); echo('<select name="talla">'); echo('<option value="-1">TODOS</option>'); for($i=0; $i<=(mysql_num_rows($rs5) - 1); $i++) { $codtallas = mysql_fetch_array($rs5); //convertimos los códigos de las tallas a las descripciones que queremos que se muestre $ssql = 'SELECT DESCE1 FROM F_CE1 WHERE CODCE1=\'' . $codtallas['CE1LTC'] . '\''; $rs6 = mysql_query($ssql, $conn); $tallas = mysql_fetch_array($rs6); //presentamos el menu desplegable con las descripciones obtenidas echo('<option value="'. $codtallas['CE1LTC'] . '"' . $selected . '>' . $tallas ['DESCE1'] . '</option>'); $selected = NULL; } echo('</select>'); echo('</td>'); } Please point out whatever you see wrong,
  13. Hello, I want to select all records in php code with mysql database. I have a table called "Customer", it has 2 fields "Name", "Number" How to select all records ? If I write select * from customer; It does not return me anything If I write select name,number from customer; It does return all records. Can some one tell me what to do here..............
  14. Hello, I am trying to run MySQL query that will take a bunch of letters and do a couple things. First: If they enter "drea" then I want to search for all words in my DB that contain those letters and only those letters. So the result will be" read dear ear red etc..... Next I want to run another query that would have Exactly the letters in the word. So the same query "drea" would only come up with: read dear Any help would be greatly appreciated! Thanks!
  15. MySQL server version: 5.1.60-rel13.1 "SELECT `id`, `sub_topic`, `url`, `info` FROM `links No errors are being thrown. The structure of my database is visible here == Table structure for table links |------ |Column|Type|Null|Default |------ |//**id**//|int(11)|No| |topic|varchar(150)|No| |sub_topic|varchar(150)|No| |info|text|No| |url|varchar(255)|No| == Dumping data for table links Hi, after completing a dropdown tutorial I am trying to convert code for my purpose which is dropdown1 make selection from topics which upon valid selection triggers dropdown2 to be enabled and populate with subtopics then upon selection from dropdown2 (final choice) a textarea will be populated with the relevant information and hyperlink. The issue at the moment is that I am getting all information in sub_topics rather than the ones linked to the main topic selected in dropdown1 which means my statement is incorrect but I cannot work out what I am missing. I know what I want to do but not sure how to get it/write it. I have been working on this for several hours, my statement started out as SELECT * FROM `categories` WHERE `master` = ? from the tutorial to SELECT `id`, `topic`, `sub_topic`, `info`, `url` FROM `links` WHERE `id` = ? GROUP BY `topic` Reasoning for the GROUP BY was that I wanted to remove duplicates, for example I have 'web design' as a topic but this is same for over 20 records, I don't want 'web design' in the list 20+ times. I went through a few other statements before I got to "SELECT `id`, `topic`, `sub_topic`, `url`, `info` FROM `links Now this has meant that I am getting data populating the 2nd box and the trigger is enabling the box however now I am getting all the records (everything). I realise I have not got the statement right but cannot work out how to write it. Link to the code being used. The MySQL db I would appreciate it if someone could advise as to where I have gone wrong and possibly how I correct it so only the correct options show in the 2nd box. Thanks
  16. I have 2 tables, one named donations and the other named costs. Both have a common column, Amount, I want to Sum each column then take costs away from donations. Is this possible? Thanks for any help. Robbie
  17. I need a list for a form that will be used to register children to their legal guardian. The list is a drop down menu, which will eventually be sorted alphabetically, if php can do that . However, the current problem is that there are single parents out there, way current way the code is set up works, but it looks off when there is a random '&' with no second parent name. When I try to do a ternary operation, it completely stops all options from appearing from the drop down. Here is the code that WORKS: echo "<option value=" . $row_list["parentID"] . ">" . $row_list["parentOneFirstName"] . " " . $row_list["parentOneLastName"] . " & " . $row_list["parentTwoFirstName"] . " " . $row_list["parentTwoLastName"] . "</option>"; Here is the code with the ternary operation: echo "<option value=" . $row_list["parentID"] . ">" . $row_list["parentOneFirstName"] . " " . $row_list["parentOneLastName"] . ((!empty($row_list["parentTwoFirstName"])) and (!empty($row_list["parentTwoLastName"]))) ? " & " . $row_list["parentTwoFirstName"] . " " . $row_list["parentTwoLastName"] . "</option>" : "</option>"; Anyone know what the problem is, or even better, how to fix it? I appreciate any and all input, thank you.
  18. can anyone help me with this I do not know if this is safe, if not can someone tell me how I can do this? $id //* is pagination $per_page //* how many i show per page $getquery = mysql_query("SELECT * FROM `videos` WHERE $construct ORDER BY date DESC LIMIT $id, $per_page"); Any help is appreciated
  19. Ok so more on my lil comic app... (and all was going so well) GOAL: Trying to take a value from a form and create sql statement to look for that comic title in the DB and show what has been entered. (I.E search for Spider-Man -> Shows all Rows that Pertain to Spider-Man) So I can't figure out what is wrong with my code. Soon as I enter in my while statement my php failes however my query seems to be doing just fine. I've used the same kind of template on other pages and it works just fine the only difference is when I added a WHERE statement to my sql query. * NOTE: If I take the output of my query and plug it into mysql workbench I get the correct tables and results so I'm yeah kinda confused. * NOTE: The way I retrieve the $data variable is from a query from the form page which pulls all the comic names from the DB and displays in a drop down so the values that it passes are the exact same names / titles from the DB itself. <?php require('./scripts/con_db.php'); // Query DB for Comic_Names // $data = $_POST['comic_name']; $query = "SELECT * FROM `comic_db`.`comic_db` WHERE `comic_name`='$data'"; $com_sql = mysqli_query($comic_connect, $query); if (!$com_sql){ echo "Failed to connect to db" . mysqli_errorno(); } ?> <body> <p align="center"><img src="./images/comic_front.png" /></p> <table align="center"> <tr> <?php while($row = mysqli_fetch_array($com_sql)) { echo "<td>" .$row "</td>"; } ?> </tr> </table> <br /> <br /> <?php require('./scripts/footer.php'); ?> I should also say i've tried these other passes as well with no luck : <?php while($row = mysqli_fetch_assoc($com_sql)) { echo "<td>" .$row "</td>"; } ?> while($row = mysqli_fetch_assoc($com_sql)) { echo "<td>" .$row['comic_name'] "</td>"; } ?> <?php while($row = mysqli_fetch_assoc($com_sql)) { echo "<td>" .$row['$data'] "</td>"; } ?> I've also tried something I found in a book that says to do extract($row) then do my echo "<td>" .$row "</td>"; but that didn't work either so I'm missing something here is what the output for the SELECT string gives me as well from the browser which seems to be fine and again if I plug into mysql workbench it displays what I need.. SELECT * FROM `comic_db`.`comic_db` WHERE `comic_name`='Iron Man - V5' TY for help guys I've try to keep the ??'s down but I'm missing something (probably pretty obvious) so I need some guidence.
  20. Hello, i dont know ho to select from more tables. How to ad more tables in to this ? ("SELECT * FROM tabel_1 WHERE channel LIKE '%funny%' ORDER BY date DESC LIMIT $id, $per_page"); And is this safe ? if not how can i make it safe ? Thanks.
  21. I have 8 Tables, each contain the same 8 columns, I want to select all of these tables that have a value not equal to zero from one of these columns; the queries I've been able to jumble together from SQL I've found online output each of the tables three times; can anyone help me find the SQL query I need? Thanks. Amongst other things I've tried: SELECT tableC.column6, tableF.column6 FROM tableC, tableF WHERE tableC.column6!=0 OR tableF.column6!=0
  22. please help i have assignment to selecting tables by joining them.. how do i use join, or inner join? is there another option selecting 3 tables by using foreign key? Here's the table this one is user table here is article category and this is content of article i was willing to choosing article_news table = article_id, category_article_id, user_type_id, user_id, judul(title), artikel, photo, tag, tanggal tcategory_article = category_article_id, category_article tuser = user_type_id, firstname, lastname thank you
  23. Hi, I am trying to write a query, but it is not giving the correct results. I have 2 mysql tables: roomsbooked = records the date (date datatype) and userID of who has a room booked rooms = a list of all rooms What I need to do is look at the roomsbooked table for a given date and create an array of any rooms from the rooms table that are not included for that date in roomsbooked. Essentially, I am trying to find out what rooms are still available. I have written a query, but it is not giving me the correct data: $sql3 = mysql_query("SELECT * FROM rooms, roomsbooked WHERE roomsbooked.event_date = '$currentDate' && rooms.roomID != roomsbooked.roomID"); $numrows3 = mysql_num_rows($sql3); echo $numrows3; while($row3 = mysql_fetch_array($sql3)) { $rooms[] = $row3['rooms.roomnum']; } print_r($rooms); The problem is that when I echo numrows3 I get zero. I know that there is a record in the roomsbooked table for the event_date I am querying and I have lots of room in the rooms table. Please can someone kindly point me in the right direction. Many Thanks, John
  24. Sorry this could sound simple but not getting it. I need help on writing mysql query $sql=mysql_query("SELECT * FROM TABLE WHERE id = ("some array")"); the above query need to be run with id matches with a array of values,the array is say not of definite size. please could someone help
  25. Hi guys, i have a db in mysql and a script in php gets data from the db and prints a table. The script is the following $connection = mysql_connect("localhost", "Litsa", "integratorgold"); echo $connection; mysql_select_db("mattrix"); $data = mysql_query("SELECT fNo, FieldA, FieldB FROM matin ORDER BY fNo DESC"); Print "<table border cellpadding=3>"; Print "<tr><th>No</th>"; Print "<th>Field A</th>"; Print "<th>Field B</th>"; Print "</tr>"; while($info = mysql_fetch_array( $data )) { Print "<tr>"; Print "<td>".$info['fNo'] . "</td> "; Print "<td>".$info['FieldA'] . "</td> "; Print "<td>".$info['FieldB'] . "</td> "; Print "</tr>"; } Print "</table>"; Obviously, it's not my invention. The above code appears in many tutorials and although being a rookie i made it work. The file "pict-single.JPG" shows the output of the script. Nothing special, it works as expected. The file "pict-double.JPG" shows what i need to do. The $data variable contains the results of the query. It is an array containing the output records sorted as requested. The while part of the code navigates from the first record of the #data variable to the last.Is it possible to address a specific record in $data?
×
×
  • 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.