Jump to content

bskauge

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bskauge's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you, ashly, that did the trick. I don't have the slightest clue why this worked before, it just did. Solved now.
  2. This was working some time ago about, but suddenly, without any changes, it didn't work anymore. This should be pretty basic, but I have no idea why this isn't working. I have a form that asks for three numbers, and based on these numbers there will be a mathematical operation, and the answer will be given on the same page when you hit "beregn!" ("calculate" in english). The problem is that the answer doesn't show up, can anyone help me find out why? My host is running php version 5.2.0, this may have been upgraded, can't remember the last version. The page is located here: http://www.onlymalts.com/v2/tools/kalkistest.php And this is some of the code: <?php $alc2 = 1.00; ?> <div id="Layer1" style="position:absolute; left:210px; top:306px; width:472px; height:160px; z-index:7;"> <span class="tekst"> <form id="form2" name="form2" method="post" action=""> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="25%">Antall cl: </td> <td width="75%"><input name="cl" type="text" size="4" /></td> </tr> <tr> <td>Alkoholnivå i %:</td> <td><input name="alc" type="text" size="4" /></td> </tr> <tr> <td>Ønsket styrke i %:</td> <td><input name="styrke" type="text" size="4" /></td> </tr> </table> <br /> <input type="image" src="/v2/bilder/beregn.jpg" /> </form> <?php if ($cl == NULL) echo ' '; elseif ($styrke == 0) echo 'Vann finner du i springen!'; elseif ($alc==0) echo 'Vi skulle gjerne hjulpet deg med å gjøre vann om til whisky, vi jobber med saken. I mellomtiden anbefaler vi å ta turen innom polet.'; elseif ($cl==0) echo 'Har du ikke whisky? Ikke en eneste dråpe?!'; elseif ($styrke>$alc) echo 'Du må tilsette sterkere whisky for å få mer alkohol. Dette er en vannkalkulator!'; elseif ($alc>96) echo 'Det er vel lite sannsynlig at du har fått tak i noe som er sterkere enn 96%.'; elseif ($styrke>0) { $alc2 = &$styrke; $resultat = $cl*($alc/$alc2)-$cl; echo 'Du må tilsette ' .number_format($resultat,1).' cl vann i '.$cl.' cl med '.$alc.'% whisky for å få '.$alc2.'%.'; } ?> </span> <br /><br /><? include("../disclaimer.php") ?> </div>
  3. Nevermind, I found the solution: "SELECT * FROM table_a WHERE MATCH(name) AGAINST ('$table_b[listofnames]' IN BOOLEAN MODE) ORDER BY merke ASC"
  4. [quote]SELECT * FROM table_a a, table_b b WHERE a.name = b.name AND b.field1 = "x"[/quote] a.name contains just one name, b.name is a long list of names. a.name = b.name will only match if b.name contains just one name. So I want to get all the records from table a where that one name from a.name is mentioned in the b.name list.
  5. Hm, still don't get it. What is the "a" in table_a a supposed to represent? I tried this, but couldn't get it to work. Hoping for further help. regards Bjorn Skauge
  6. Hello, I thought this should be easy, but I just can't figure it out. I have two tables, and I want to list every record from table A where 'name' is mentioned in a list of names in table B. I've tried something like SELECT * FROM table_a WHERE name IN ('$table_b[listofnames]') and SELECT * FROM table_a WHERE name LIKE '%$table_b[listofnames]%' This works when $table_b[listofnames] only contains one name, but there is a comma separated list of names in that field. I see that $table_b[listofnames] returns the whole list, so the wildcards won't work since they are put at the beginning and at the end of the list. How do I do this? And what should I eventually do about double fornames (like "John Henry")? I really hope someone can help me out? Kindest regards, Bjorn Skauge Norway
  7. Hi, I woudl like to pass multiple variables from different forms into one url. This is some of my code: [quote]$merke_search = "%"; if (isset($_GET['var1'])) {   $var1_search = (get_magic_quotes_gpc()) ? $_GET['var1'] : addslashes($_GET['var1']); } $smoke_search = "%"; if (isset($_GET['var2'])) {   $var2_search = (get_magic_quotes_gpc()) ? $_GET['var2'] : addslashes($_GET['var2']); } mysql_select_db($database_db, $db); $search = mysql_query("SELECT * FROM table WHERE name LIKE '%$var1_search%' AND course LIKE '%$var2_search%'", $db) or die(mysql_error()); $row_search = mysql_fetch_assoc($search); $totalRows_search = mysql_num_rows($search);[/quote] 'var1' is from one form, and 'var2' is from another. How can I combine these two, so I can get a url like [b]page.php?var1=1&var2=2[/b] as a result? It works when I enter the full url manually, but I want the forms to generate the url. I really hope you can help me out with this. I'd be thankful for any suggestions.  :) The "form-code" is like this: [quote]<form id="form1" name="form1" method="get" action="/v2/tools/pollista2.php">     <label> <? echo 'Name: '; ?>     <input name="var1" type="text" id="var1" size="19" />     </label> </form> <form id="form2" name="form2" method="get" action="/v2/tools/pollista2.php">     <label> <? echo 'Course: '; ?>     <input name="var2" type="text" id="var2" size="19" />     </label> </form>[/quote] When I fill in both forms, only the parameter from form2 is passed to the url, like [b]page.php?var2=2[/b], var1 is not included.
×
×
  • 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.