Jump to content

idos

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

idos's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm creating a fulltext search where i want to search a set of columns of sertain keywords. So far ...i 'm stuck with the search query (Parse error: parse error, unexpected ';' in) [code]<?php // if search form has been submitted if (isset($_POST['submit'])) { $key = $_POST['key']; echo "$key"; if (!$con)   {   die('Could not connect: ' . mysql_error());   } mysql_select_db("rekvisita", $con); $result = mysql_query($sql = "SELECT * FROM `rek` WHERE MATCH (fag,kategori,navn,beskrivelse,forsok) AGAINST ('$key');"; echo "<table border='1' cellspacing='0' cellpadding='2' bgcolor='#ffff99'> <tr> <th>Fag</th> <th>Kategori</th> <th>Navn</th> <th>Beskrivelse</th> <th>Plassering</th> <th>Dato</th> </tr>"; while($row = mysql_fetch_array($result))   {   echo "<tr>";   echo "<td>" .  $row['fag'] . "</td>";   echo "<td>" .  $row['kategori'] . "</td>";   echo "<td>" .  $row['navn'] . "</td>";   echo "<td>" .  $row['beskrivelse'] . "</td>";   echo "<td>" .  $row['plassering'] . "</td>";   echo "<td>" .  $row['dato'] . "</td>";   echo "</tr>";   } echo "</table>"; } else { echo "Legg inn filter eller søk"; } ?>[/code] Help .. .. i'm lost here
  2. Tnx ..  ;D This worked: [code]$result = mysql_query( $sql = 'SELECT SUM(score) as scoretotal FROM ruter WHERE Navn= \'idar\' ORDER BY `Grad` DESC LIMIT 0,20 '); $row=mysql_fetch_array($result); echo $row['scoretotal'];[/code]
  3. I can't display the output from a query function.. [quote][code=php:0] <?php include 'config.php' ?> <?php if(isset($_COOKIE['ID_my_site'])) { $username = $_COOKIE['ID_my_site']; } else { echo 'du er ikke logget inn'; } $con = mysql_connect($host,$dbuser,$dbpass); if (!$con)   {   die('Could not connect: ' . mysql_error());   } mysql_select_db("klatrereg", $con); $result = mysql_query( $sql = 'SELECT SUM(score) FROM ruter WHERE Navn= \'idar\' ORDER BY `Grad` DESC LIMIT 0,20 '); // here i need some code to display the SUM(score) mysql_close($con); ?>[/code][/quote] I have tried several things but none seem to work.. .HELP :P
  4. Hmm well i still can't get it to work. But i have  altered the form and insert.php to insert  the score in the database. I can get the  total score in MyPHPadmin  using this quiery: [quote][code=php:0][code=php:0]$sql = 'SELECT SUM(score) FROM `ruter` WHERE Navn = \'"username"\' ORDER BY `Grad` LIMIT 0,20';[/code][/quote] So my question is: How can i display the SUM(score) result from the database...
  5. I'm making a script where i want to multiply  from 2 columns in a mySQL database and sum the product. 1 User submit values in a form  (grade and accent style(in climbing)) (they see a string but the values are  int.) 2 Theese values are stored in a db 3 i use a quiery to display them in a table but now and the numbers are converted to strings from an array. 4 i multiply the grade and the accentstyle integers and get the individual score the route produced.. so far so good 5 i now want to sum the individual route score to a scoretotal for each person, but so far i haven't managed to both multiply the  2 columns and sum them.  i have tried to create a multidimentional array and use array_product($multidimarray)  but with no luck so far... can some one please help...  [attachment deleted by admin]
×
×
  • 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.