1
fo-fo
Re: Adding points to users
  • 2005/11/27 15:55

  • fo-fo

  • Just popping in

  • Posts: 34

  • Since: 2005/4/13


you probably know by now...

echo "$points";
will print the value of $points on a .php page.
if you want it to show in the member account section, that'd need some hacking I guess.

adding plus points>
1. first you query the row 'points' associated with MikeJones
2. +100 to $result
3. update row

Quote:

$points = mysql_query("SELECT points FROM ".$xoopsDB->prefix("userpoints")." WHERE username="MikeJones");
$result = mysql_fetch_array( $points );

$pointsnew = $result + 100 ;

mysql_query("UPDATE ".$xoopsDB->prefix("userpoints")." SET points='$pointsnew' WHERE username='MikeJones'");



2
fo-fo
Re: Adding points to users
  • 2005/11/16 19:39

  • fo-fo

  • Just popping in

  • Posts: 34

  • Since: 2005/4/13


you can do it in .php coding. look up 'mysql' and you'll find a lot of snippets you can use.

1. you'll need to set up a database row 'userpoints' manually (e.g. in phpAdmin) or by php code

2. then list your users

Quote:

$result = mysql_query("SELECT * FROM ".$xoopsDB->prefix("users")." ");
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$user = mysql_result($result, $i, "user");
echo "<tr><td>";
echo "<a href=\"addpoints.php\">$user";
echo "</td>";
$i++;
}


3. add points on 'addpoints.php' (this adds 100 points to MikeJones)

Quote:

$addpoint = 100;
mysql_query("UPDATE ".$xoopsDB->prefix("userpoints")." SET points='$addpoint' WHERE username='MikeJones'");


there are many ways to do it, you know how you need them
these examples might contain syntax errors and are only approximately correct



3
fo-fo
Re: tracking users
  • 2005/7/28 18:20

  • fo-fo

  • Just popping in

  • Posts: 34

  • Since: 2005/4/13


I thought {$xoops_uname} in custom modules is non-usable...

...or was it the blocks...



4
fo-fo
Re: tracking users
  • 2005/7/28 8:45

  • fo-fo

  • Just popping in

  • Posts: 34

  • Since: 2005/4/13


cookie?



5
fo-fo
Re: Lyrics module (need help)
  • 2005/6/17 16:07

  • fo-fo

  • Just popping in

  • Posts: 34

  • Since: 2005/4/13


"adding lyrics by guests and registered users (need approval)"

try looking into the news module's code. I think if you modify that, you'd get most of the problems solved.



6
fo-fo
Re: Relational database question
  • 2005/6/10 10:58

  • fo-fo

  • Just popping in

  • Posts: 34

  • Since: 2005/4/13


I don't use the AMS module, but it's relatively easy to with an sql query.
let's say a database table 'joints' with 'country', 'hotel', 'restaurant' rows.
you want to look up all hotels in Brazil, you do:

...
echo "<tr><th>BRAZIL</th></tr>";

$result = mysql_query("SELECT hotel FROM ".$xoopsDB->prefix("joints")." WHERE country='BRAZIL'");
while($row = mysql_fetch_array($result))
{

$hotel = mysql_result($result, "hotel");

echo "$hotel";
}
...

you want to look up all hotels in all countries, you do:

...

$result = mysql_query("SELECT * FROM ".$xoopsDB->prefix("joints").");
while($row = mysql_fetch_array($result))
{
$country = mysql_result($result, "country");
$hotel = mysql_result($result, "hotel");

echo "$country";
echo "$hotel";
}
...

this code seq may have bugs in it.



7
fo-fo
Re: Displaying data from a table?
  • 2005/5/29 12:49

  • fo-fo

  • Just popping in

  • Posts: 34

  • Since: 2005/4/13


$segment1 = mysql_result($result, "segment1");
$segment2 = mysql_result($result, "segment2");
$segment3 = mysql_result($result, "segment3");

?

WHERE segment='yes'... this is your_row=something_you_want_to_select



8
fo-fo
Re: everything goes center
  • 2005/5/28 9:52

  • fo-fo

  • Just popping in

  • Posts: 34

  • Since: 2005/4/13


it could be the server coding...



9
fo-fo
Re: Displaying data from a table?
  • 2005/5/27 21:01

  • fo-fo

  • Just popping in

  • Posts: 34

  • Since: 2005/4/13


try this:

<?php
global $xoopsDB, $xoopsUser;
if ($xoopsUser)
{
$lognom = $xoopsUser->uname();
}

$result = mysql_query("SELECT * FROM ".$xoopsDB->prefix("segments_table")." WHERE segment='yes'");
while($row = mysql_fetch_array($result))
{

$segment1 = mysql_result($result, "t_row1");
$segment2 = mysql_result($result, "t_row2");
$segment3 = mysql_result($result, "t_row3");

echo "<table border='1'>";
echo "<tr><th><FONT FACE=arial> segment1 </th> <th><FONT FACE=arial> segment2 </th> <th><FONT FACE=arial> segment3 </th></tr>";
echo "<tr><td>";
echo "<FONT SIZE=1>$segment1</FONT>";
echo "</td><td>";
echo "<FONT SIZE=1>$segment2</FONT>";
echo "</td><td>";
echo "<FONT SIZE=1>$segment3</FONT>";
echo "</td></tr>";
}
?>



10
fo-fo
Re: Module for clubs
  • 2005/5/20 19:24

  • fo-fo

  • Just popping in

  • Posts: 34

  • Since: 2005/4/13


You need more modules to do this

1: I want to give the registered members on my site the ability to setup a club.

try setting up custom blocks or hack existing ones to act as a 'gateway' to one club. then try customizing a guestbook is my guess.

2: They will have the following admin rights over the club. Setting up a "Home page" for that club to inform other members about the club.

xoops admin preferences?

3: Aurothorising or declining members to join there club.

I think several modules have an 'authorizing' feature. the news module has it.

4: Have the ablity to send all the club members an email.

? but even at yahoo you can send group mails.

5: With in the club you will have a diary system that will allow them to set dates for events for the members to attend an event and for the members to search the calander for forth comming events of interest.

mrbs module.




TopTop
(1) 2 3 4 »



Login

Who's Online

138 user(s) are online (95 user(s) are browsing Support Forums)


Members: 0


Guests: 138


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits