Jump to content

Search the Community

Showing results for tags 'query'.

  • 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. To start off with I am really sorry if the title doesn't necessarily describe what I am trying to accomplish here and really didn't know how to title it. What I have is a form that user inputs information and then when they hit submit it takes them to the page with the code to insert the information into the sql server database. This page also, will send an email out with the some of the information based on one of the fields the user input information into. When the information is inserted into the database, I have a column named RefNumber, that the column settings for it are as follows: [RefNumber] [int] IDENTITY(1,1) NOT NULL I want to have this RefNumber displayed out to the user as well as have it in the emails that are sent out as a confirmation for that the email is associated with. Here is my code that I currently and if any let me know if I need to explain anything more clearly: <?php session_start(); if (!(isset($_SESSION['forteid']) && $_SESSION['forteid'] != '')) { header ("Location: login.php"); exit(); } ?> <?php error_reporting(E_ALL ^ E_NOTICE); include 'includes/db_connect.php'; $CallDispo = $_POST['disposition']; $NewNotes = str_replace("'", "", "$_POST[notes]"); if (trim($CallDispo) == "Revision" or trim($CallDispo) == "Revision/Save" or trim($CallDispo) == "Revision/Collection" or trim($CallDispo) == "Reinstatement") { $to = "dawn.okeefe@srb1.com"; $subject = "Revision - $_POST[appnumber]"; $message = "<Table border='1px' cellpadding='5' style='border:1px solid black; text-align: Left;'> <TR style='border:1px solid black; text-align: Left;'><td>ForteID:</td><td>$_POST[ForteID]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>AppNumber:</td><td>$_POST[appnumber]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Date:</td><td>$_POST[date]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Contract Number:</td><td>$_POST[Con_Number]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Finance Number:</td><td>$_POST[Finance_Num]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Phone Number:</td><td>$_POST[Phone_Num]</td></tr> <TR style='border:0px solid black; text-align: Left;'><td></td><td></td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Discount Amount:</td><td>$_POST[Disc_Amount]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>New Total Cost:</td><td>$_POST[Total_Cost]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Total Monthly Payments:</td><td>$_POST[Total_MP]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>New MP Amount:</td><td>$_POST[New_MP_Amt]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>New DP Amount:</td><td>$_POST[New_DP_Amt]</td></tr> <TR style='border:0 solid black; text-align: Left;'><td></td><td></td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Notes:</td><td>$NewNotes</td></tr>"; } elseif (trim($CallDispo) == "Escalation"){ $to = "jeremy.nemens@srb1.com"; $subject = "Escalation - $_POST[appnumber]"; $message = "<Table border='1px' cellpadding='5' style='border:1px solid black; text-align: Left;'> <TR style='border:1px solid black; text-align: Left;'><td>ForteID:</td><td>$_POST[ForteID]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>AppNumber:</td><td>$_POST[appnumber]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Date:</td><td>$_POST[date]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Contract Number:</td><td>$_POST[Con_Number]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Finance Number:</td><td>$_POST[Finance_Num]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Phone Number:</td><td>$_POST[Phone_Num]</td></tr> <TR style='border:0px solid black; text-align: Left;'><td></td><td></td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Notes:</td><td>$NewNotes</td></tr>"; } elseif (trim($CallDispo) == "Email Contract"){ $to = "jeff.starke@srb1.com"; $subject = "Email Contract - $_POST[appnumber]"; $message = "<Table border='1px' cellpadding='5' style='border:1px solid black; text-align: Left;'> <TR style='border:1px solid black; text-align: Left;'><td>ForteID:</td><td>$_POST[ForteID]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>AppNumber:</td><td>$_POST[appnumber]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Date:</td><td>$_POST[date]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Contract Number:</td><td>$_POST[Con_Number]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Phone Number:</td><td>$_POST[Phone_Num]</td></tr> <TR style='border:0px solid black; text-align: Left;'><td></td><td></td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Notes:</td><td>$NewNotes</td></tr>"; } elseif (trim($CallDispo) == "Send Contract/Invoice"){ $to = "nicole.lehew@srb1.com"; $subject = "Send Contract/Invoice - $_POST[appnumber]"; $message = "<Table border='1px' cellpadding='5' style='border:1px solid black; text-align: Left;'> <TR style='border:1px solid black; text-align: Left;'><td>ForteID:</td><td>$_POST[ForteID]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>AppNumber:</td><td>$_POST[appnumber]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Date:</td><td>$_POST[date]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Contract Number:</td><td>$_POST[Con_Number]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Finance Number:</td><td>$_POST[Finance_Num]</td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Phone Number:</td><td>$_POST[Phone_Num]</td></tr> <TR style='border:0px solid black; text-align: Left;'><td></td><td></td></tr> <TR style='border:1px solid black; text-align: Left;'><td>Notes:</td><td>$NewNotes</td></tr>"; } $headers = 'From: nick.curran@srb1.com' . "\r\n" . 'Reply-To: nick.curran@srb1.com' . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); //Insert to form data into database $tsql = "INSERT INTO logs(ForteID, disposition, appnumber, Finance_Num, num_payments, ach_cc, date, notes, Phone_Num, Cancel_Disposition, Con_Number, Post_Date, Total_Cost, Total_MP, New_MP_Amt, New_DP_Amt, Disc_Amount, Callback) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; $parameters = array( $_POST[ForteID], $_POST[disposition], $_POST[appnumber], $_POST[Finance_Num], $_POST[num_payments], $_POST[ach_cc], $_POST[date], $NewNotes, $_POST[Phone_Num], $_POST[Cancel_Disposition], $_POST[Con_Number], $_POST[Post_Date], $_POST[Total_Cost], $_POST[Total_MP], $_POST[New_MP_Amt], $_POST[New_DP_Amt], $_POST[Disc_Amount], $_POST[Callback]); $stmt = sqlsrv_query($connection, $tsql, $parameters); // Send Email if(mail($to, $subject, $message, $headers)) echo "Email sent!<br>"; else echo "No email to be sent!<br>"; /* Free statement and connection resources. */ sqlsrv_free_stmt( $stmt); sqlsrv_close( $connection); header( "refresh:2;url=index.php" ); echo 'Your entry has been saved!'; exit(); ?> Thanks in advance!
  2. Right now I have a code that outputs results into a table: <?php include 'includes/db_connect.php'; $List = $_GET['List']; if( $connection === false ) { echo "Unable to connect.</br>"; die( print_r( sqlsrv_errors(), true)); } $query = " SELECT LISTCODE, YEAR, COUNT(YEAR) AS Count FROM Names GROUP BY LISTCODE, RIGHT(LISTCODE, 2), YEAR HAVING (RIGHT(LISTCODE, 2) = '$List') ORDER BY LISTCODE, YEAR "; $result = sqlsrv_query($connection,$query); // each array key is the database column name, the corresponding value is the legend/heading to display in the HTML table // the order of the items in this array are the order they will be output in the HTML table $fields = array('LISTCODE'=>'ListCode','YEAR'=>'Year','Count'=>'Count'); // start table and produce table heading echo "<table>\n<tr>"; foreach($fields as $legend){ echo "<th>$legend</th>"; } echo "</tr>\n"; // output table data while($row = sqlsrv_fetch_array( $result,SQLSRV_FETCH_ASSOC)) { echo "<tr>"; foreach($fields as $key=>$not_used) { echo "<td>$row[$key]</td>"; } echo "</tr>\n"; } echo "</table>\n"; sqlsrv_free_stmt ($result); sqlsrv_close( $connection); ?> That all works great and the attached picture originalqueryoutput is what it looks like. Just a little hard to read. What I would like to is have the output look something like the attached picture wantedqueryoutput, which I just did in excel to show an example of what I am going for. Is this possible? And how would I even begin to manipulate the data rows from the query to the table? Thanks in advance for the help!
  3. Hello all, I am working on this query to show past records of data for all of the records in this particular table. This is an archive table so there are multiple entries of the same person in the database. The difference is the date that they were entered, which is an auto entry value added on the date it is uploaded. Here is the query: "SELECT politicians.id, politicians.`Last Name`, politicians.`First Name`, politicians.`District`, archive.`firstname`, archive.`lastname`, archive.rank, archive.era FROM politicians, archive WHERE politicians.`Last Name`=archive.lastname AND politicians.`First Name`=archive.firstname ORDER BY date LIMIT 150"; The problem is that I only need the latest entry from the persons information and I am getting multiple from past dates. They need to be ordered by their past rank, but from the last date of the entry. Any ideas?? P.S I know I already posted this in the applications section. I posted it there by accident
  4. I would like to run a simple query one time without user input. Can I just use a query? Or is there benefit to doing it another way?
  5. I have other things that work, but for some reason when trying this one is does not want to put the results into the table. Here is my code: echo "<table border='1px' cellpadding='5' style='border:3px solid black; text-align: center;'> <tr> <th style='border:3px solid black;'>Rep</th> <th style='border:3px solid black;'>Pmts Collected</th> </tr>"; while ($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) { [code] echo "<tr> <td>{$row['Rep']}</td> <td>{$row['Num_Payments']}</td> </tr>"; } echo "</table>"; sqlsrv_free_stmt ($result); sqlsrv_close( $connection); ?> [/code] When I view source of the page this part is not in there: echo "<tr> <td>{$row['Rep']}</td> <td>{$row['Num_Payments']}</td> </tr>"; So I know I have the while part of the code wrong in the table somehow but not sure how to make it work. Let me know if I need to provide more information. Thanks in advance!
  6. <h1>View Log</h1> <?php $timezone = "America/Chicago"; date_default_timezone_set($timezone); $today = date("Y-m-d"); ?> <?php $serverName = 'Server\SQLEXPRESS'; $connectionInfo = array('Database'=>'database', 'UID'=>'username', 'PWD'=>'password','ReturnDatesAsStrings'=>true,); $connection = sqlsrv_connect($serverName, $connectionInfo); $query = ' SELECT ForteID FROM database.dbo.Reps ORDER By ForteID'; $result = sqlsrv_query($connection,$query); // Move the data to a simple array to simplify presentation code. $resultAsArray = array(); while ( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_ASSOC )) { $resultAsArray = $row; } ?> <form method="get" action="getlog.php"> <select> <?php foreach ($resultAsArray as $row): ?> <option value="<?php= $row['ForteID'] ?>"><?php= $row['ForteID'] ?></option> <?php endforeach; ?> </select> <BR> <table> <tr> <td>Start Date:</td> <td><input name="start_date" type="date" value="<?php echo $today;?>" autocomplete="off" required="required"></td> </tr> <tr> <td>End Date:</td> <td><input name="end_date" type="date" value="<?php echo $today;?>" autocomplete="off" required="required"></td> </tr> </table> <br> <input type="submit" name="getLog" value="Get Log"><br><br> <input type="button" value="Back to Form" onclick="window.location.href='index.php';"> <br> </form> </html> My result for the drop down box is nothing. I believe something is wrong with the while ( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_ASSOC )) Thanks in advance for the help.
  7. Hi, I know this is a very basic query but most of the tutorials etc. I can find seem to focus on querying multiple tables rather than one table. I want to filter the data from one table (Mutation) by three variables (prot_name, no_changes and amyloid) (all in this one table). In my main HTML page I have the form: <p><b>Advanced Search:</b>search for subgroups of mutations associated with a particular protein</p> <form action= "adv_mutationsearch.php" method='post'> <select name="result1"> <option value="alpha synuclein">alpha synclein</option> <option value="amyloid precursor protein">amyloid precursor protein</option> <option value="apolipoprotein A-1 precursor">apolipoprotein A-1 precursor</option> <option value="apolipoprotein A-1V precursor">apolipoprotein A-1V precursor</option> </select> <p><b>AND</b></p> <select name="result3"> <option value="amyloid">Amyloid</option> <option value="amorphous">Amorphous</option> <option value="non-amyloid">Non-amyloid</option> <option value="oligomers">Oligomers</option> <option value="undetermined">Undetermined</option> </select> <p><b>AND</b></p> <select name="result2"> <option value="single">Single</option> <option value="double">Double</option> <option value="multiple">Multiple</option> <option value="wild">Wild (original sequence)</option> </select> <br> <br> <input type='submit' value = 'filter'> </form> in my php file: <html><head> <link rel="stylesheet" type="text/css" href="tabs.css" media="screen" /> <title>Amyprot Table Viewer</title></head><body> <?php $db_host = '********'; $db_user = '********'; $db_pwd = '*********'; $database = 'amyprotdb'; $table = 'Mutation'; //receiving results from form submission and allocating to variables for query $query1 = $_POST['result1']; $query2 = $_POST['result2']; $query3 = $_POST['result3']; // connect to database if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); // query for sorting mutations by protein, number of changes and amyloidogenicity and printing result $result = mysql_query("SELECT * FROM {$table} WHERE prot_name_id={$query1} AND no_changes={$query2} AND amyloid={$query3}"); //to show results in table the current problem lies with the code below, the above code dows not show errors so need to undertsand the below sections. or change it to ordinary print out. $fields_num = mysql_num_fields($result); echo "<h1>Table: {$table}</h1>"; //echo "<table border='1'><tr>"; echo '<table cellpadding="0" cellspacing="1" class="db-table">'; // printing table headers for($i=0; $i<$fields_num; $i++) { $field = mysql_fetch_field($result); echo "<td>{$field->name}</td>"; } echo "</tr>\n"; // printing table rows while($row = mysql_fetch_row($result)) { echo "<tr>"; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo "<td>$cell</td>"; echo "</tr>\n"; } //mysql_free_result($result); ?> <div class="search"> <p>Return to database search page <a href="database.php"><span>Search</span></a></p> <p>Return to full mutations table <a href="mutationtable.php"><span>Mutation table</span></a></p> </div> </body></html> The error I get states that $result (when I am trying to print the table of results) is null meaning the whol post submission hasnt worked. I am an early learner as you can see, I have tried multiple ways to do this.. The set up above has been pared right back to the basics as I tried to clean up my code to see where the fault lay and now I am stuck. Thanks in advance x
  8. heres my code: $sql=" INSERT INTO `a8392424_pets`.`users` ( `user_id` , `user_name` , `user_pass` , `user_email` , `user_date` , `user_level` , `posts` , `married` , `cash` , `tokens` ) VALUES ( NULL, '" . mysql_real_escape_string($_POST['user_name']) . "', '" . sha1($_POST['user_pass']) . "', '" . mysql_real_escape_string($_POST['user_email']) . "', NOW(),'0', 'noone', '10000', '10')"; $result = mysql_query($sql); if(!$result) { //something went wrong, display the error echo 'Something went wrong while registering. Please try again later.'; //echo mysql_error(); //debugging purposes, uncomment when needed } When I execute it, using my signup form, the query fails. my connection to database is GOOD.
  9. I am passing user inputs from a page called add_product.php. There is a drop down menu that CONCATs two table fields to form one name ($category). After passing $category to the product_created.php page, I can break this back down into the two respective fields using explode() on but how do I create variable out of the results? Here is the snippet from add_product.php <?php //Grab the Product Category name and Bucket name from productcategory and bucket tables in DB $qry=mysql_query("SELECT CONCAT(bucket.b_name, ' : ', productcategory.name) AS category FROM productcategory, bucket, product WHERE product.category_id = productcategory.id AND productcategory.bucket_id = bucket.id", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } ?> <p>Category: <select name="category" id="category"> <?php //take the responses from the query above and show then in a drop down menu while($row=mysql_fetch_array($qry)) { echo $category = "<option value='".$row['category']."'>".$row['category']."</option>"; } ?> </select> I then pass that to product_created.php and this is what I have so far and where I am stuck: //This gets all the other information from the form $category=$_POST['category']; // Explode category variable to get bucket.b_name and productcategory.name list($b_name, $pc_name) = explode(":", $category); echo $b_name.'<br/>'; // bucket.b_name echo $pc_name.'<br/>'; // productcategory.name //the above code works and prints the separate category names onscreen $categories = array($b_name,$pc_name); print "The product category name is $pc_name"; //test two: this code works and prints just the productcategory name //Define the query to grab the product category id where pc_name equals the product category name $sql = "SELECT id FROM productcategory WHERE name = '$pc_name'"; //submit the query and capture the result $result = mysql_query($sql) or die(mysql_error()); echo $result; //find out how many rows were retrieved $numRows = mysql_num_rows($result); //current result is 0 and should be 1 if successful //this is my attempt to convert the productcategory id into a variable that can be passed back into the DB $sql_q = "SELECT id FROM productcategory WHERE name = '$pc_name'" or die(mysql_error()); $sql = mysql_fetch_array($sql_q); //above sets the category_id array //example usage: $sql['mysql_col_name'] echo $sql['category_id']; //the above prints the category_id foreach ($sql as $category_id) { //echo $category_id.'<br/>'; } //Define query to add product to DB $qry=mysql_query("INSERT INTO product(name,category_id,slug,old_price,price,description,video_url,status,date_posted)VALUES('$name','$category_id','$slug','$o_price','$price','$desc','$video','$status','$date')", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } else { echo "<br/>"; echo "Product Added Successfully"; echo "<br/>"; } I know some of this is redundant but I am trying to teach myself how to solve this and this was the best way for me to learn. I feel like I am really close, but that I have gone round and round at this point and have just confused myself. I understand that there may be other issues with my code as it is written, but I really need to focus on resolving this first. Any help, advise, teaching, would be most appreciated.
  10. Hello, I am doing a kind of financial calculator which gives you results about the best alternatives to choose from. I do a sql query to the table having the banks data. After that i create a bunch of variables in php and echo the results. These variables are math operations consisting in sql results variables and user input variables. I know how to order sql results, but the problem is that my criteria of sorting is from the php variables created later (which consist of math oparations between sql and user input variables). I have tried sorting it by sql rows....but the dynamic php variables created later are sometimes negatively related to the sql data....so the result does not always get the same. I have an idea like putting the dynamic php variables in an array/arrays and than sorting them according to one of the php variables. But i have no idea how it can be done. Here is a partial code, just to give you an idea of what i mean. <form method="post" action="calc2.php" /> <input name="ss" class="highlight"/> <input class="highlight" name="nn" size="5" /> </form> <?php if (isset($_POST['ss']) && $_POST['nn']>5) { $target = $_POST['ss']; $result = mysql_query("SELECT * FROM list1 WHERE minimum <= {$target} ORDER BY i_rate DESC LIMIT {$number_result}"); if (mysql_num_rows($result) > 0){ while($row = mysql_fetch_array($result)) { $s = $target-$support+$pu+$pv; // according to this variable i want to sort the results, and $pu, $pv are created from user input, which i don't have it here, $traget is sql output. $s is a mix. } } } ?> PLS HEEELP, i have searched everywhere for this and cennot find nothing about exactly what i want.
  11. Ok, i think this is the best place for this question. I have the following problem that no matter what i do the number doesn't add to the sql variable. $i=interest rate, which is a row in sql database, i need to add 1 to it. The result is 1. Which should have been for example 1.01 if $i=1. Here is the code: $result1 = mysql_query("SELECT interest_rate FROM list1") or die(mysql_error()); $row1 = mysql_fetch_array($result1); $i = $row1['interest_rate']; echo $i . "<br/>"; echo $i+1 . "<br/>"; On echo $i i get the row values. On $i+1 i get only 1 in a column repeated vertically. WHY?? PLSSSSS help!!!!
  12. Hey there, Hoping someone can help me. I am trying to create a page on a wordpress site that will enable users to select 4 seperate fields from 4 drop down lists, hit a submit button and then be presented with search results from a MYSQL query based on their selections from the drop down list. I am a complete noob at php and MYSQL having not touched either since Uni. Please help out if you can. Here is the code. I have omitted the database connection details for obvious reasons. //Select City from Users table $queryCity = "SELECT City FROM Users"; $resultCity = mysql_query($queryCity) or die(mysql_error()); //Select AO from Users table $queryAO = "SELECT AO FROM Users"; $resultAO = mysql_query($queryAO) or die(mysql_error()); //Select Job from Users table $queryJob = "SELECT Job FROM Users"; $resultJob = mysql_query($queryJob) or die(mysql_error()); //Select Skills from Users table $querySkills = "SELECT Skills FROM Users"; $resultSkills = mysql_query($querySkills) or die(mysql_error()); //Create City dropdown list object $dropdownCity = "<select name='selectCity'>"; while($rowCity = mysql_fetch_assoc($resultCity)) { $dropdownCity .= "\r\n<option value='{$rowCity['City']}'>{$rowCity['City']}</option>"; } $dropdownCity .= "\r\n</select>"; //Create AO dropdown list object $dropdownAO = "<select name='selectAO'>"; while($rowAO = mysql_fetch_assoc($resultAO)) { $dropdownAO .= "\r\n<option value='{$rowAO['AO']}'>{$rowAO['AO']}</option>"; } $dropdownAO .= "\r\n</select>"; //Create Job dropdown list object $dropdownJob = "<select name='selectJob'>"; while($rowJob = mysql_fetch_assoc($resultJob)) { $dropdownJob .= "\r\n<option value='{$rowJob['Job']}'>{$rowJob['Job']}</option>"; } $dropdownJob .= "\r\n</select>"; //Create Skills dropdown list object $dropdownSkills = "<select name='selectSkills'>"; while($rowSkills = mysql_fetch_assoc($resultSkills)) { $dropdownSkills .= "\r\n<option value='{$rowSkills['Skills']}'>{$rowSkills['Skills']}</option>"; } $dropdownSkills .= "\r\n</select>"; //Print the drop downlists on the page echo "Please choose from the following fields below:"; echo "Location &nbsp&nbsp&nbsp"; echo $dropdownCity; echo "AO Level &nbsp&nbsp&nbsp"; echo $dropdownAO; echo "Occupation &nbsp&nbsp&nbsp"; echo $dropdownJob; echo "Skills &nbsp&nbsp&nbsp"; echo $dropdownSkills; ?> <form method="post" action="mypage.php"> <input type="submit" value="submit" name="Submit"> <?php //This code is for retrieving the results of the drop down selections after the submit button is clicked $selectionCity = $_POST["selectSkills"]; $selectionJob = $_POST["selectJob"]; //SQL query from retrieved results //SQL query from retrieved results $sqlresults = "SELECT * FROM Users WHERE City='"$selectionCity"' AND Job='"$selectionJob"'"; $sqlpost = mysql_query($sqlresults) or die(mysql_error()); echo $sqlpost; ?> I know the page looks horrible, trying to tackle one issue at a time and get this functional. Thanks for any and all help.
×
×
  • 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.