
perficut
Members-
Posts
70 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
perficut's Achievements

Member (2/5)
0
Reputation
-
I would think would have been an easier way. What if you grouped all the rows by the solicitation number and then picked out the row by the contractor which that had the lowest Roads value?
-
Thanks Ill give that a try. Thanks.
-
This is probably a simple task but I cant seem to get it. I've tried a hundred different configs. First thing I need to do is get is all the data in the record containing the solicitation# and where ContractorID is a particular value. Then I need to figure out how to get the data in the record that contains the lowest value in the ROADS field. Table Example ------------------------------------------------------- |Solicitation|ContractorID| Roads | Walkways | Patios | ------------------------------------------------------- 1 |255290 |910 | 19.00 | 25.00 | 30.00 | 2 |255290 |910 | 12.00 | 12.00 | 14.00 | 3 |255290 |850 | 8.000 | 21.00 | 12.00 | 4 |255290 |850 | 11.00 | 14.00 | 26.00 | ------------------------------------------------------- I want to be able to grab all the data in row#2 where the ContractorID(910) has bid the lowest amout in the Roads Column for this solicitation. Then display it to the screen so he/she can see what their lowest offer was. heres where im at. It seams to only want to return the first row. $sql="SELECT * , MIN(Roads) FROM ProcurementBids WHERE Solicitation='$property' AND ContractorID='{$contractor_id}' " or die(mysql_error()); ; $result=mysql_query($sql); //$row = mysql_fetch_array( $result ); $lowestbidroads = $row['Roads']; $lowestbidwalkways = $row['Walkways']; $lowestbidasphaltdeice = $row['AsphaltDeice']; $lowestbidwalkwaydeice = $row['WalkwayDeice']; while($row = mysql_fetch_array($result)){ echo $row['Solicitation']. " - ". $row['Roads']. " - ". $row['Walkways']. " - ". $row['AsphaltDeice']." - ". $row['ContractorID']; echo "<br />"; }
-
Getting confused...mysql query with multiple requirements
perficut replied to perficut's topic in MySQL Help
thanks but I think my SELECT query gets what the same data. I just cant figure out how to now search those records for the one that has the lowest value in bid1, unless I can use the MIN in the SELECT query along with the other parameters. Didnt try that, but will. I thought there might be a for while loop to get that record. -
I'd like to get all the records in my database that have the same Solicitation# which is also the propertyid in another database (hense the reference), and out of those records find out if the current user has submitted a bid. If so, i'd like to assign those bids to variables to be called on later in the page. The dbase has the following fields Solicitation ContractorID bid1 bid2 bid3 $sql2="SELECT * FROM ProcurementBids WHERE Solicitation='$propertyid' AND ContractorID='$contractor_id'" or die(mysql_error()); ; $result=mysql_query($sql2); $existingbid = ($result); If the user has entered several bids for the same solicitation, How do I get to the record that has the lowest bid1 value? I hope this makes sense.
-
I cant seem to figure out the right syntax for doing this. If I use the following it displays the users name which was passed into this file from another php file. echo $_SESSION[ 'u_name']; I want to open my database and get the rest of the users info based on the users name. Heres what I have, that obviously doesnt work. $userdata = mysql_query("SELECT * FROM ILContractors WHERE username=$_SESSION['u_name']") or die(mysql_error()); $userinfo = mysql_fetch_array( $userdata );
-
Thank you this worked great. The script I am running, checks the username entry when they tab out of the form box, if the name is already used, they must enter a unique name to continue. This if im not mistaken, should prevent duplicate entries before the the program tries to actually write the data, and at the same time informs the user of the availability. Thank you again, I appreciate the help.
-
PFM: I get what your saying. No sense on actually grabbing all the data to then sift through it. Using a query with specific peramaters will do that. However, I think the rest of the javascript need the information to process it. Heres the sample program. Which in its entirety works fine. But it only has 3 names which are manually entered into the array which to compare against for availability. <?php // Developed by Roshan Bhattarai // Visit http://roshanbh.com.np for this script and more. // This notice MUST stay intact for legal use //this varible contains the array of existing users $existing_users=array('roshan','mike','jason'); //value got from the get metho $user_name=$_POST['user_name']; //checking weather user exists or not in $existing_users array if (in_array($user_name, $existing_users)) { //user name is not availble echo "no"; } else { //user name is available echo "yes"; } ?> What I was trying to do is grab all the existing usernames in the database and put them into that same array so now the program will check availability against whats in the database and not just the three names. Heres where Im at. Its returning a 'YES' even if the username is in the database. So somethings not quite right. <?php // Developed by Roshan Bhattarai // Visit http://roshanbh.com.np for this script and more. // This notice MUST stay intact for legal use $link = mysql_connect("localhost","login","pw"); mysql_select_db("my_database",$link); $sql="SELECT username FROM ILContractors"; $result=mysql_query($sql); $row=mysql_fetch_array($result); //this varible contains the array of existing users $existing_users=array($result); //value got from the get metho $user_name=$_POST['user_name']; //checking weather user exists or not in $existing_users array if (in_array($user_name, $existing_users)) { //user name is not availble echo "no"; } else { //user name is available echo "yes"; } ?>
-
This is a snipit of an ajax code I D/L which check to see if a USERNAME currently exists, when my users try to register. It return, obviously, a yes or no, the reste of code, then diplays a message telling them that name is used already, or it just lets them finish entering their registration info.
-
This is simple I'm sure, but I cant get the syntax right for it to work. I need to fill the $existing_users array with all the username's in my database. In the code below I have inserted 3 names manually for testing purposes, but as you can see, I need to be able to put all the currently registered user names in this array for validation purposes. $sql="SELECT username, FROM ILContractors WHERE username='".$user_name."'"; $result=mysql_query($sql); $row=mysql_fetch_array($result); //this varible contains the array of existing users $existing_users=array('roshan','mike','jason'); //value got from the get metho $user_name=$_POST['user_name']; //checking weather user exists or not in $existing_users array if (in_array($user_name, $existing_users)) { //user name is not availble echo "no"; } else { //user name is available echo "yes"; } ?>
-
When the user logs into my members page via htaccess, I'd like to retain the username so that I can call upon his account info later. Is there a way to save his user name in a cookie (or some other means)?
-
Thank you. I almost had it but I couldnt get the '.' to work in the link. Thank you so much.
-
I have a short program that lists all the data in my database which works great. What I need help figuring out, is how to make the Company Name a hyperlink, to a file called propertyinfo.php i think its just a matter of adding the html hyperlink tag to the echo line for the company name field, but I can figure out the right syntax to make it work. // Get all the data from the "example" table $result = mysql_query("SELECT * FROM ILCustomers") or die(mysql_error()); echo "<table align='center' border='0'>"; echo "<tr bgcolor='#ffcc99'> <th>Request Date</th> <th>Business Type</th> <th>Company Name</th> <th>Site Location</th> <th>City</th> <th>State</th> <th>Closed Date</th></tr>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table $date_requested=date("F j, Y ", strtotime($row['ReqDate'])); $date_closed=strtotime(date("F j, Y ", strtotime($date_requested)) . " +10 days"); $closed=date("F j, Y ",$date_closed); echo '<font size="9">'; echo "<tr align='center', cellspace='2', cellpadding='1', bgcolor='#eeeeee'><td><FONT size=2>"; echo $date_requested; echo "</td><td><FONT size=2>"; echo $row['Commercial_Type']; echo "</td><td><FONT size=2>"; echo $row['Business_Name']; echo "</td><td><FONT size=2>"; echo $row['Address']; echo "</td><td><FONT size=2>"; echo $row['City']; echo "</td><td><FONT size=2>"; echo $row['State']; echo "</td><td><FONT size=2>"; echo $closed; "</td></tr>"; } echo "</table>"; ?>
-
Thanks Sean, but isnt that what this line is suppose to do? $date_closed=strtotime(date("F j, Y ", strtotime($date_requested)) . " +1 week"); I couldnt figure out how to get his way to work. While trying to research it I found this way, which got me closer.
-
Heres what I have, and I what I am getting. I cant figure out how to convert the closed_date to show the right data. while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table $date_requested=date("F j, Y ", strtotime($row['ReqDate'])); $date_closed=strtotime(date("F j, Y ", strtotime($date_requested)) . " +1 week"); echo "<tr><td>"; echo $row['City']; echo "</td><td>"; echo $row['State']; echo "</td><td>"; echo $date_requested; echo "</td><td>"; echo $date_closed; "</td></tr>"; } echo "</table>"; Heres what I get City State Request Date Closed Date tinley park IL October 28, 2009 1256709600 Chicago IL October 12, 2009 1255327200 Deerfield IL October 22, 2009 1256191200 addison IL November 30, 1999 943945200 Kildeer IL November 30, 1999 943945200