Jump to content

jaco

Members
  • Posts

    22
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://www.pumpfundamentals.com
  • ICQ
    http://www.chordsandguitar.com

Profile Information

  • Gender
    Not Telling
  • Location
    Montreal, Canada
  • Interests
    pumps and tennis

jaco's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. My God! Son of a gun! You're right. I guess what through me off is that it works well with a single string with no blanks. What a ya gonna do. Thanks a bunch. Jacques
  2. Hi, the problem is that when you selct a term with a blank i.e. "South africa" the get function only returns the first part i.e. "South" which is not what is required to make an ID. Pikachu seems to me I do have options tags, can you be more specific. Thanks, Jacques
  3. Hello everyone, this is a rather peculiar problem that I have been banging my head against for a while. I am using an MS database that has pump information, it is converted to a MYSQL database and stored on the server. I use a field of the db to populate an html select widget to select the country of origin this then is used to display more info. Here is a short part of the code that produces the error: <?php // standard html web header require 'header.html'; // html user data input form require 'dbpump.php'; ?> <font size="14"><b>PumP search</b></font> <br /> <br /> <?php $query = "SELECT DISTINCT home_office FROM data ORDER BY home_office ASC"; if(!($connection = @ mysql_connect($hostName,$username,$password))) die("Could not connect"); //select database to edit if(!(@ mysql_select_db($databaseName, $connection))) showerror(); if(!($result = @ mysql_query($query))) showerror(); if(isset($_get['headoffice'])) { //required to recover from server the previous selection $headoffice = $_get['headoffice']; } ?> <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <b>Home office country:</b> <select name="headoffice"> <option value="All">All</option> <?php //cycles through all the home office countries in db and lists them in the html select while($row = mysql_fetch_array($result)) { if ($headoffice == $row['home_office']) echo "<option SELECTED value=".$row['home_office'].">".$row['home_office']."</option>"; else echo "<option value=".$row['home_office'].">".$row['home_office']."</option>"; } ///end while mysql_free_result($result); if ($headoffice == "New Jac territory") echo "<option SELECTED value=\"New Jac territory\">New Jac territory</option>"; else echo "<option value=\"New Jac territory\">New Jac territory</option>"; echo "</select>";?> <input type="submit" value="SEARCH"> </form> <br /> <?php //echo $headoffice;?> <?php // standard html web page footer require 'footer.html';?> you run from this web site: http://www.pumpfunda...base2/test2.php What happens is when you select South Africa and you click the Search button, the get function will only transmit the first part of the term or "South" so that you can't do a match to display further information. I typed the country "New Jac territory" directly in the html as the last html select item to appear in the list; this has a couple of blanks and works fine. So it seems that html does not interpret correctly the value coming from the mysql db. I hope I explained this properly. Thanks, Jacques
  4. Hi guys, thank for any help. This does not appear like a difficult problem but it has me stymied. I have several selects, the 1st item of each is "--Specify--" so that the user has to specifically choose an item. Once an item is selected on any select the others should be set to the 1st item or "--Specify--" to avoid confusion. If you want to see the complete code it on this web page: http://chordsandguitar.com/progressions-test.php The relevant code is: if ($prog1_menu != "--Specify1--") { $prog2_menu = "--Specify--"; echo "set prog2 to Specify"; } if ($prog2_menu != "--Specify2--") { $prog1_menu = "--Specify--"; echo "set prog1 to Specify"; } echo "<form action = \"progressions-test.php?s_sort_all=$sort_all&s_prog1_menu=$prog1_menu&s_prog2_menu=$prog2_menu&s_prog1_trigged=$prog1_trigged&s_prog2_trigged=$prog2_trigged\" method = \"GET\">"; //also stores the values of the drop-downs when Select button is pushed so they can be retrieved when the web page is loaded again echo " Ascending bass line"; echo "<br />"; echo "Select a progression: <a href=\"http://www.chordsandguitar.com/progressions-test.php?s_sort_all=All&s_prog1_menu=--Select--&s_prog2_menu=--Select--\"\"><big>ALL</big></a>"; echo " "; echo "<select name=\"prog1_menu\" onchange=\"this.form.submit();\">"; echo "<option value=\"--Specify1--\">--Specify--</option>"; if ($prog1_menu == "ii-iii-IV-V progression") echo "<option SELECTED value=\"ii-iii-IV-V progression\">ii-iii-IV-V progression</option>"; else echo "<option value=\"ii-iii-IV-V progression\">ii-iii-IV-V progression</option>"; if ($prog1_menu == "I-ii-IV-V progression") echo "<option SELECTED value=\"I-ii-IV-V progression\">I-ii-IV-V progression</option>"; else echo "<option value=\"I-ii-IV-V progression\">I-ii-IV-V progression</option>"; if ($prog1_menu == "I-iii-IV-V progression") echo "<option SELECTED value=\"I-iii-IV-V progression\">I-iii-IV-V progression</option>"; else echo "<option value=\"I-iii-IV-V progression\">I-iii-IV-V progression</option>"; echo "</select>"; echo " "; echo "<select name=\"prog2_menu\" onchange=\"this.form.submit();\">"; echo "<option value=\"--Specify2--\">--Specify--</option>"; if ($prog2_menu == "I-sharpIo7-ii7-sharpIIo7 progression") echo "<option SELECTED value=\"I-sharpIo7-ii7-sharpIIo7 progression\">I-#Io7-ii7-#IIo7 progression</option>"; else echo "<option value=\"I-sharpIo7-ii7-sharpIIo7 progression\">I-#Io7-ii7-#IIo7 progression</option>"; if ($prog2_menu == "I-sharpIo7-ii7-V7 progression") echo "<option SELECTED value=\"I-sharpIo7-ii7-V7 progression\">I-#Io7-ii7-V7 progression</option>"; else echo "<option value=\"I-sharpIo7-ii7-V7 progression\">I-#Io7-ii7-V7 progression</option>"; echo "</select>"; echo "</form>"; I am trying to identify which select box has been used so that I can set all the other boxes to the 1st item but I wind up re-setting all the boxes. Cheers, Jacques
  5. Hi, I am just recently getting this error message:Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/XXX/chordsandguitar.com/index.php:46) in /home/jchords/chordsandguitar.com/index.php on line 48 this is no doubt related to the fact that my site has been hacked along with 1000's of others that are on dreamhost. I don't know if it's related to php file permissions some of my files may have had had their permission set for read-write when they should not have been. They have all been changed to the more restrictive 755 or 644. So here is how I am using the session_start to store some variables: session_start(); if (!isset($_SESSION["count"])) { $_SESSION["count"]=0; } else $_SESSION["count"]++; if ($_SESSION["count"] == 0) { $scale_menu = 'C'; $variation_menu = 'maj'; $code_id = '1'; } else { //allows retreiving the value of the drop-downs after the Select button has been pushed // has to be skipped on the first access or overwrites starting vars. to null if (isset($_GET['s_menu'])) $scale_menu = $_GET['s_menu']; else $scale_menu = $_GET['scale_menu']; } So any ideas why I am getting this error? Thanks, Jacques
  6. Right, I was trying to make it simple, but you're right. The data is file names that represent chords (see www.chordsandguitar.com). In the new version I am making which is still in test I am adding inversions which is another form of guitar chord based on a master chord. A chord can have 1, 2 or 3 inversions but sometimes there is no 2nd or 3rd inversion. When there is no inversion, it means there are no values in the db, so the chord name that I am looking for just does not exist. So in fact it is a null value but the mysqlfetcharray won't return a null value. I want to be able to skip the display of chords when the inversion does not exist therefore I need to detect a NULL value return which is my problem. I hope this is more clear. Jacques
  7. Hi, this is a question that may have been asked but a search does not reveal anything. I am trying to identify a null result from a select and mysqlfetcharray command, As we know mysql ignores null result from a SELECT command. Here is the code: $query = "SELECT * FROM chords_".$scale_menu."_2nd_inv WHERE int_number = $i AND sort_name = '$variation_menu'"; //run the query on the server if (!($result = @ mysql_query ($query, $connection))) showerror(); $row = mysql_fetch_array($result); //required to test for null value $query2 = "SELECT * FROM chords_".$scale_menu."_2nd_inv WHERE int_number = $i AND sort_name = '$variation_menu' IS NULL"; //run the query on the server if (!($result2 = @ mysql_query ($query2, $connection))) showerror(); $row2 = mysql_fetch_array($result2); echo $row; if (!isset($row2['file_name'])) { echo "there is no 2nd inversion for this chord"; break; } // do something else } //end of while } There are 2 SELECTS in a row, the second one tries to identify if the result is NULL and break out of the loop. But it doesn't work. Any ideas? Thanks, Jacques
  8. Yep, it's not working for me, I have to use a submit button to make sure the user knows what to do and this screws things up. I will try using the SESSION var. to keep the memory of the form selection.
  9. If this works I should be able to refresh the web page and keep the selection value of the select. In other words, the page comes up for the fist time, I change the selection in the drop-down, this causes the select form to submit it's value to the server. When I hit the refresh button it checks to see if there is a value on the server and then provides that value to the select thereby preserving the memory of the change, is that correct?
  10. I got it, it's a condensed if else statement used in Perl/PHP. It means if $check exists return it's value otherwise return the value of $alternate. Thanks, again very ingenious code.
  11. Very ingenious, thank you very much. The key seems to be that the select will POST it's data if there are any changes. However, I am not quite sure I understand how the function works, can you elaborate a bit.
  12. Thanks. Someone on another forum has recommend looking into SERVER variables which I will do.
  13. Hello everyone, I know this is probably an oft asked question but I have been struggling with it for quite some time. I have a web page that has select boxes for user input and of course select buttons that send the data to the server via url. I want the user to have the same page returned with new information based on his selection, see: http://www.musiconguitar.com/chords.php Everything works fine except when you use the REFRESH or BACK button of the browser, this causes the data to be lost. What is the best way to solve this problem? Cheers, Jacques
  14. Thank you very much, seems the problem was with the use of the singlw quote. The following mods. work: echo "<a href=\"test.php?p_type=$searchpumptype\">"."<b><big>Next </big></b></a>>"; this works: echo "<a href=\"test.php?p_type={$searchpumptype}\">"."<b><big>Next </big></b></a>>"; and this works: $value = urlencode($searchpumptype); echo "<a href=\"test.php?p_type={$value}\">"."<b><big>Next </big></b></a>>";
  15. Right you are Matthew. Here is a shortened version of the code that shows the behavior. The dropdown has two selections: a single word and a two word string with a blank space. If you select the single word and press the Display button you get it back as is. If you press the Next link you also get the word back as is. If you select the double word and press Next you get back the first part of the word only. Code: <?php // standard html web header require 'header.html'; // html user data input form echo "<form action =". $_SERVER['PHP_SELF']." method = \"GET\">"; if (isset($_GET['p_type'])) $searchpumptype = $_GET['p_type']; else $searchpumptype = $_GET['searchpumptype']; echo "<br />"; echo "searchpumptype is: ".$searchpumptype; echo "<br />"; echo "<b>Pump type</a>: "; echo "<select name=\"searchpumptype\">"; if ($searchpumptype == "bellows") echo "<option SELECTED value=\"bellows\">bellows</option>"; else echo "<option value=\"bellows\">bellows</option>"; if ($searchpumptype == "centrifugal horiz") echo "<option SELECTED value=\"centrifugal horiz\">centrifugal horiz</option>"; else echo "<option value=\"centrifugal horiz\">centrifugal horiz</option>"; echo "<br />"; echo "<input type=\"submit\" value=\"Display\" title =\"Hit this button whenever you change any of the above\">"; echo "</form>"; echo '<a href=test.php?p_type=' . $searchpumptype .'><b><big>Next </big></b></a>>'; // standard html web page footer require 'footer.html'; ?> You can run the script on my web site here: http://www.lightmypump.com/pumpdatabase2/test.php Cheers, J
×
×
  • 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.