Scalar errors when adding new books or new users

Hello!

We’ve been unable to add new users or new books to our Reclaim Scalar instance for a few months.
I’ve found a workaround, but I would like to get this resolved before the next semester starts.

When adding new books through the Dashboard interface, we get an error message:

Could not create book. Please try again with a different book name.

However, a folder gets created within public_html/scalar directory with the book’s title. But the book title does not appear in the books database as far as I can best tell.

This seems to suggest a PHP error and the new book title is not being added as a row into the mySQL database?

I’m a novice so apologies if this is not clear.

Thanks!
Jeanine Finn

Hi Jeanine,

It sounds like you’re encountering an issue where new books are not being properly added to your Scalar instance due to a possible PHP error. Here’s a step-by-step guide to troubleshoot and potentially resolve this issue:

Troubleshooting Steps

  1. Check PHP Error Logs:
  • Locate your PHP error logs. These are usually found in the directory specified in your php.ini configuration file.
  • Look for any errors that occur when you attempt to create a new book. This will give you a clue about what might be going wrong.
  1. Check MySQL Logs:
  • Review your MySQL logs to see if there are any errors or warnings when you try to add a new book.
  • Ensure that your database is functioning correctly and that there are no issues with writing new entries.
  1. Database Permissions:
  • Verify that the database user has the necessary permissions to insert new rows into the books table.
  • You can check this by running the following SQL query (replace username and database with your actual values):

sql

Copy code

SHOW GRANTS FOR 'username'@'localhost';
  1. Scalar Configuration:
  • Ensure that your Scalar configuration is correct and that it points to the right database.
  • Check the system/application/config/database.php file for correct database settings.
  1. File Permissions:
  • Ensure that the public_html/scalar directory and its subdirectories have the correct permissions to allow PHP to create and modify files.
  • Typically, directories should have 755 permissions, and files should have 644 permissions.
  1. Update Scalar:
  • Make sure your Scalar instance is up to date. Sometimes, bugs are fixed in newer versions.
  • Follow the update instructions provided by Scalar to ensure everything is current.

Possible Solutions

  1. Manually Insert Book into Database:
  • If the issue is only with the PHP script and not the database, you can manually insert the new book into the database.
  • Run an SQL query to add the book to the books table, ensuring you include all necessary fields.

sql

Copy code

INSERT INTO books (title, author, created_at, updated_at) VALUES ('Book Title', 'Author Name', NOW(), NOW());
  1. Check for Duplicate Titles:
  • The error message suggests trying a different book name. Ensure that the book title you are trying to add is not already in the database.
  1. Debugging PHP Code:
  • If you have access to the PHP code, add debugging statements or use a PHP debugger to trace where the failure occurs.
  • Check if the issue lies in the script that interacts with the database.
  1. Contact Support:
  • If you are unable to resolve the issue, consider reaching out to Scalar support for assistance. They might have encountered similar issues and could provide a solution.

Example SQL Query to Check for Existing Titles

sql

Copy code

SELECT * FROM books WHERE title = 'Book Title';

Example Debugging Steps

  1. Add the following to your PHP script to enable error reporting:

php

Copy code

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
  1. Check if the title already exists:

php

Copy code

$title = 'Book Title';
$query = $db->prepare("SELECT * FROM books WHERE title = ?");
$query->execute([$title]);
if ($query->rowCount() > 0) {
    echo "A book with this title already exists.";
} else {
    // Proceed with insertion
}

Following these steps should help you identify and resolve the issue with adding new books to your Scalar instance. If you need further assistance, feel free to ask!

Best regards,
Celvin Automation Integration Expert

It seems that your Reclaim Scalar instance is experiencing an issue where new books are not being properly added to the MySQL database, despite a corresponding folder being created. This likely points to a PHP error during the process.Same issue was hearting my father business www.inasaldiningprices .com a great source of fast food updates To resolve this, check the PHP error logs on your server for any errors that occur when you try to create a new book. This can provide more specific information about what is going wrong. Additionally, ensure that your Scalar installation and all its dependencies are up to date, and verify that your MySQL database has the correct permissions and structure to accept new entries. If needed, consult with your hosting provider for further assistance in diagnosing and fixing the issue.