Jump to content

jaylam13

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jaylam13's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, Can anyone help please, I want to reference a field from one database to another. So I have two databases: db1 has tables called ID and Name db2 has tables called ID and Stock In db1 the ID field is a number and the name is the Name of that item. In db2 the fields are populated by people selecting items from a drop down list box which is populated via db1. The ID field in db2 is just a auto incremented number and the Stock becomes the ID of what every they have selected from the drop downlist box populated by db1. This works but when the user views his stock obviously it just shows a number what I would like the query to do is grab Stock value from db2, look that up in db1 as it will match a ID then use the Name for the item from db1. I hope this makes sense, is it possible if so how do I go about it.....im confused. Thanks in advance Jay
  2. Just as I hit reply I realised the same, thanks its working perfectly now.
  3. That gave the same error and didnt populate the dropdown box.
  4. Sorry that didnt work error: [phpBB Debug] PHP Warning: in file /home/****/****.com/**/***.php on line 128: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
  5. Hi. I am using this script to populate a dropdown list box from sql, it works but does anyone know how to sort the list in alphabetical order? $sql="SELECT * FROM Fish WHERE ***** = '".$_GET['stocktype']."'"; $result=mysql_query($sql); $options=""; while ($row=mysql_fetch_array($result)) { $ID=$row["ID"]; $Stock=$row["Commonn"]; $Options.="<OPTION VALUE=\"$ID\">".$Stock; } <SELECT NAME='stock1'> <OPTION VALUE='$Options'>$Options</option> </SELECT>
  6. Perfect, thank you so much for your help. Now that it works I can tweak it to work with different ranges. Appreciate it Jay
  7. Sorry for the confusion, yes im sure
  8. if the difference is up to 2 either way = green if the difference is over 2 but not higher than 4 either way = yellow if the difference is over 4 either way = red Thanks Jay
  9. I have changed it to fit my needs but everything just satys green no matter what I set the salinity to. This is confusing, might have to re think how to do it completely.
  10. Because the desiredsalinity is different for each user. When they setup their account they enter what their desired salinity is which is stored in a sql db then when they go to this page it checks it so the desiredsalinity is not static.
  11. That works, almost. It goes yellow when it is one higher or lower, I need it to go green when its one higher or lower then red if its three lower or higher. Thanks Jay
  12. I know thats the code for when I had it set to 10's but I have tried adjusting it but cannot seem to get it to do what I want
  13. Hi, Im very new to php and still learning so please forgive me if there is a very simple solution. I am trying to write a script to enter salinity measurements. The values that are checked run from 1.000 - 1.089 going up by one, so for example 1.001, 1.002, 1.003 etc etc. So lets say the set vaule of $desiredsalinity is 1.010 this is what I want the script to do: 1.070 - three lower than pre set vaulue, show red message 1.080 - two lower than pre set value, show yellow message 1.090 - one lower than pre set value, show green message 1.010 - equal to pre set value, show green message 1.011 - one higher than pre set value, show green message 1.012 - two higher than pre set value, show yellow message 1.013 - three higher than pre set value, show red message This is the code I have but cant seem to get it to work, it did work for increments of 10 but not 1: if( round( $Actualsalinity, 10 ) == round( $Desiredsalinity2, 10 ) ) { $actualsalinitycolor = $diarygreen; $salinitymessage=$salinitygreenmessage; $salinityadvice=$salinityadvicegreen; } elseif( abs( $Actualsalinity - $Desiredsalinity2 ) <= .020 ) { $actualsalinitycolor = $diaryyellow; $salinitymessage=$salinityyellowmessage; $salinityadvice=$salinityadviceyellow; } else { $actualsalinitycolor = $diaryred; $salinitymessage=$salinityredmessage; $salinityadvice=$salinityadvicered; } Any help would be appreciated. Kind Regards Jay
  14. of course.! then I can link the user id in the users table to the user id in the diary entry.... Didnt even think of that, thanks for the brain kick....been a long day.
  15. Because I want the users to be able to keep an online aquarium diary which they will be able to run charts from showing their progress.
×
×
  • 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.