Advertisement:

Author Topic: Database Changes in SMF 2.0 - Part 2  (Read 140236 times)

Nordoelum

  • Guest
Re: Database Changes in SMF 2.0 - Part 2
« Reply #60 on: March 04, 2008, 07:11:46 PM »
GoPHP5.org

Birger :)

Offline Dannii

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 10,212
  • Mind the volcano!
    • curiousdannii on GitHub
Re: Database Changes in SMF 2.0 - Part 2
« Reply #61 on: March 18, 2008, 06:55:42 AM »
Question, will these changes mean that I no longer need to use addslashes() before updateSettings()?
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Offline Grudge

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 10,742
  • Gender: Male
  • Unofficial nuisance
Re: Database Changes in SMF 2.0 - Part 2
« Reply #62 on: March 18, 2008, 07:15:05 AM »
Dannii, that is correct.
I'm only a half geek really...

Offline Dannii

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 10,212
  • Mind the volcano!
    • curiousdannii on GitHub
Re: Database Changes in SMF 2.0 - Part 2
« Reply #63 on: March 18, 2008, 07:17:34 AM »
Thanks. That's a fairly easy change to make thankfully.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,627
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
Re: Database Changes in SMF 2.0 - Part 2
« Reply #64 on: March 18, 2008, 06:33:35 PM »
SMF 2.0 doesnt understand my chat integration. How do i change this:

Code: [Select]
$chatrequest = db_query("
            SELECT COUNT(*) AS numb
            FROM  fc_connections
            WHERE userid IS NOT NULL", __FILE__, __LINE__);
         list ($chatcount) = mysql_fetch_row($chatrequest);   
         mysql_free_result($chatrequest);
     
if ( $chatcount == "1" ) {
$singularplural2 = "";
} else {
$singularplural2 = "ä";
}
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Offline Thantos

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 16,163
  • Gender: Male
Re: Database Changes in SMF 2.0 - Part 2
« Reply #65 on: March 18, 2008, 06:42:55 PM »
Code: [Select]
$chatrequest = $smcFunc['db_query']('', '
            SELECT COUNT(*) AS numb
            FROM  fc_connections
            WHERE userid IS NOT NULL');
         list ($chatcount) = $smcFunc['db_fetch_row']($chatrequest);   
         $smcFunc['db_free_result']($chatrequest);
     
if ( $chatcount == "1" ) {
$singularplural2 = "";
} else {
$singularplural2 = "ä";
}

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,627
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
Re: Database Changes in SMF 2.0 - Part 2
« Reply #66 on: March 18, 2008, 06:45:08 PM »
"Fatal error: Function name must be a string in "
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Offline codenaught

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 14,653
  • Gender: Male
  • Formerly Known As akabugeyes
Re: Database Changes in SMF 2.0 - Part 2
« Reply #67 on: March 18, 2008, 06:47:25 PM »
Owdy, do you have $smcFunc globaled?
Dev Consultant
Former SMF Doc Coordinator

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,627
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
Re: Database Changes in SMF 2.0 - Part 2
« Reply #68 on: March 18, 2008, 06:52:35 PM »
?? I have no idea what it is.

I have another one

Code: [Select]
// array for the member ID's
$team = array();

// get all members of group 1 (administrators)
$group = 2;
$res = db_query("SELECT ID_MEMBER
                FROM members
                WHERE ID_GROUP = $group ", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($res))
        $team[] = $row['ID_MEMBER'];
mysql_free_result($res);
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Offline metallica48423

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,842
  • Gender: Male
  • Professional Multislacker!
    • Zentendo
Re: Database Changes in SMF 2.0 - Part 2
« Reply #69 on: March 18, 2008, 07:10:06 PM »

Code: [Select]
global $smcFunc;

$chatrequest = $smcFunc['db_query']('', '
            SELECT COUNT(*) AS numb
            FROM  fc_connections
            WHERE userid IS NOT NULL');
         list ($chatcount) = $smcFunc['db_fetch_row']($chatrequest);   
         $smcFunc['db_free_result']($chatrequest);
     
if ( $chatcount == "1" ) {
$singularplural2 = "";
} else {
$singularplural2 = "ä";
}

Try that (same code as what thantos posted, but with $smfFunc globaled.
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

Quote
Microsoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"

Useful Links:
Online Manual!
How to Help us Help you   
Search
Settings Repair Tool
     

Offline codenaught

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 14,653
  • Gender: Male
  • Formerly Known As akabugeyes
Re: Database Changes in SMF 2.0 - Part 2
« Reply #70 on: March 18, 2008, 07:16:58 PM »
For the second query, you could try something like this:

Code: [Select]
// array for the member ID's
$team = array();

// get all members of group 1 (administrators)
$group = 2;
$res = $smcFunc['db_query']('', 'SELECT id_member
                FROM {db_prefix}members
WHERE ID_GROUP = {int:group}',
array(
'group' => $group,
)
);
while ($row = $smcFunc['db_fetch_assoc']($res))
        $team[] = $row['id_member'];
$smcFunc['db_free_result']($res);

Edited: Fixed mistake causing it not to work.
« Last Edit: March 18, 2008, 07:21:14 PM by akabugeyes »
Dev Consultant
Former SMF Doc Coordinator

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,627
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
Re: Database Changes in SMF 2.0 - Part 2
« Reply #71 on: March 18, 2008, 07:45:18 PM »
First one worked :)

Second one:

Fatal error: Function name must be a string in /var/www/fs1/0/public_html/foorumi/Sources/Load.php(1857) : eval()'d code on line 45
« Last Edit: March 18, 2008, 08:16:29 PM by Owdy »
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Offline Thantos

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 16,163
  • Gender: Male
Re: Database Changes in SMF 2.0 - Part 2
« Reply #72 on: March 18, 2008, 08:10:50 PM »
Please start a topic in the SMF Coding Discussion board.  Thanks

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,627
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
Re: Database Changes in SMF 2.0 - Part 2
« Reply #73 on: March 18, 2008, 08:14:11 PM »
Okay. Sorry T for hijacking this topic.
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0