vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Database fields (https://vborg.vbsupport.ru/showthread.php?t=141952)

CooganA 03-13-2007 02:28 PM

Database fields
 
Hiya

Anyone know what the database table names are and what the fields are?

Anyone have a list of this anywhere? I just want to know which field contains the true/false value for the board being on/offline.

Thanks
Adam

Marco van Herwaarden 03-13-2007 02:54 PM

That is stored in 2 tables: setting & datastore

nexialys 03-13-2007 04:08 PM

basically, there is a "setting" table that store "officially" the settings you set on the adminCP... but in the essence, these settings are stored in the cache called "datastore", so they are loaded quicly at the startup of the process... they can also be stored in the datastore_file if you decide to store them in file... (complicated part)...

even if you edit the "setting" table with your proper detail, the board will continue to read the datastore element only, so you have to enter your admincp and save a setting to make the update.

CooganA 03-13-2007 04:21 PM

I'm new to PHP, so how would I update the datastore database? Does anyone have a little example of updating a table?

And do you know what the field name for the Turn On/Off setting would be?

Thanks
Adam

Marco van Herwaarden 03-14-2007 08:57 AM

Please see: http://www.vbulletin.com/forum/showthread.php?t=213135

CooganA 03-14-2007 09:47 AM

Hi

After lots of trial and error, I finally hacked together some code that turned the board off/on.

Looking at the link you sent me, the code looks a lot cleaner then the one I put together last night.

But all i'm just getting an error:
Parse error: parse error, unexpected T_STRING in myfile.php on line 3

This is the code I'm now trying to use, if you want a laugh the code I hacked together is below that.
PHP Code:

require_once(DIR '/includes/adminfunctions_misc.php');
$query1 sprintf("UPDATE datastore SET data=REPLACE(data,'"bbactive";i:1;','"bbactive";i:0;') WHERE title='options'");
$query2 sprintf("UPDATE setting SET value=0 WHERE varname='bbactive'");
mysql_query($query1);
mysql_query($query2);
?> 

My hacked code:
PHP Code:

<?php
// ########################## REQUIRE BACK-END ############################

require_once(DIR '/includes/adminfunctions_misc.php');


// Formulate Query
// This is the best way to perform a SQL query
// For more examples, see mysql_real_escape_string()
$query sprintf("SELECT data FROM datastore WHERE title='options'");

// Perform Query
$result mysql_query($query);

if (!
$result) {
   echo 
'Could not run query: ' mysql_error();
   exit;
}
/**/ if (mysql_num_rows($result) > 0) {
   while (
$row mysql_fetch_assoc($result)) {
       
print_r($row);
       print 
"<BR><BR><BR>";
       Print 
$result[data];
       
$tempDataStore str_replace('"bbactive";i:1;','"bbactive";i:0;'$row['data']);
       Print 
$tempDataStore;
      
// echo $row['data'];
   
}
}

mysql_free_result($result);

$query sprintf("UPDATE datastore SET data = '$tempDataStore;' WHERE title='options'");

// Perform Query
$result mysql_query($query);

?>


Marco van Herwaarden 03-14-2007 09:58 AM

Is that the full myfile.php?

PS Why do you use sprintf() to assign a variable?

CooganA 03-14-2007 10:04 AM

Yup, thats the full file at the moment.

The reason I use sprintf() is becuase it seemed to work last night on the code I use. I'm not a PHP developer and this is the first time I've ever had to use PHP.

I'm a Coldfusion and Actionscript 2 developer... so this is all foreign to me at the moment. So any help is grantful!!

Marco van Herwaarden 03-14-2007 10:42 AM

Could you please copy&paste the full error message, as i don't see a line 3 in your code.

CooganA 03-14-2007 11:13 AM

This is line 3:
$query1 = sprintf("UPDATE datastore SET data=REPLACE(data,'"bbactive";i:0;','"bbactive";i: 1;') WHERE title='options'");

PHP Code:

<?php
require_once(DIR '/includes/adminfunctions_misc.php');
$query1 sprintf("UPDATE datastore SET data=REPLACE(data,'"bbactive";i:0;','"bbactive";i:1;') WHERE title='options'");
$query2 sprintf("UPDATE setting SET value=1 WHERE varname='bbactive'");
mysql_query($query1);
mysql_query($query2);
?>



All times are GMT. The time now is 03:52 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00970 seconds
  • Memory Usage 1,746KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete