The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
Coding source - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28)
+--- Forum: Documentation (https://userspice.com/forums/forumdisplay.php?fid=30)
+--- Thread: Coding source (/showthread.php?tid=248)



Coding source - picassoo - 09-08-2016

Hi! You can post all the elements for INSERT, SELECT, EDIT(UPDETING), DELETE and COUNT funcs? separete from the all the script. userspace from userusercake is diferent built, and I cant not undesturd Sad

I will like to cont tiket (1) readand not (0) read.

<pre>
Code:
function counthelptiket()
{
    global $mysqli,$db_table_prefix;
    $stmt = $mysqli->prepare("SELECT COUNT(*) FROM ".$db_table_prefix."help_tiket
</pre>
WHERE st_ne_citit = 0 ");
$stmt->execute();
$stmt->bind_result($st_ne_citit);
while ($stmt->fetch()){
$row[$page] = array('st_ne_citit' => $st_ne_citit);
}
$stmt->close();
if (isset($row)){
return ($row);
}
}`


Coding source - mudmin - 09-08-2016

What version of UserSpice or UserCake are you using? This is done differently in different versions.


Coding source - picassoo - 09-08-2016

I have UserCake



Coding source - mudmin - 09-08-2016

Here's how I would handle that. The UserSpice 4 classes are more secure and more universal with PDO and they're also better documented.

1. I would download the latest userspice 4.1.4
2. Go to users/classes/DB.php and copy that class to your usercake folder somewhere.
3. Edit the class lines 26-30 from
Code:
$this->_pdo = new PDO('mysql:host=' .
Code:
Config::get('mysql/host') .';dbname='.
Code:
Config::get('mysql/db'),
Code:
Config::get('mysql/username'),
Code:
Config::get('mysql/password'),
to
Code:
$this->_pdo = new PDO('mysql:host=YOURHOSTNAME,;dbname=YOURDBNAME,YOURdbUSERNAME,YOURdbPASSWORD,

4. Then include the new DB class into your project. It shouldn't affect how the core usercake stuff works and then for all the stuff you do moving forward, you can use the modern PDO way of doing things that are documented here.

http://userspice.org/documentation-db-class-2/

If that doesn't work, let me know.