Error 245 in mysql prepare - php

I am trying to get a database to work for my app where I want to save results in a database. I have set up a set of php-files which I call from my android application. Everything works as long as the table does not have any columns with json data, but I want to save a json file in my database. The error I get is
mysqli::prepare(): Unknown type 245 sent by the server. Please send a report to the developers in <b>/Users/usrname/LearnPhP/Documents/android_login_api/include/DB_Functions.php</b> on line <b>59</b><br />
Line 59 in DB_Functions:
$stmt = $this->conn->prepare("SELECT * FROM users WHERE email = ?");
I have googled but not found anything. I am working on my MacBook, when using Windows 10 it works perfectly. However, it should work on Mac as well, secondly the next step is to set up a server which is on my desktop computer and then I need to work from my Mac to test it properly.
SOLUTION:
Thanks to the tip in the comments I found out that there was a mismatch between php and mysql. I have mysql 5.7.12 and now I use php 7 and that works fine.
I followed this to update my php.

Related

How to make database able to read & write "ÆØÅ"?

So the problem is that i'm trying to upload a "new ico", my site is all about cryptocurrency. Everything is working as it did locally on my computer, but when im trying to upload a new ico it says this:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '�rdi, whitepaper, social, avatar) VALUES ('KickCoin','Random','Random','Random'' at line 1"
�rid = Should be saying "Værdi".
I read that the problem defiantly is something connection based with the database or so (because i didn't have the problem local)? But how do i fix it, so that my website will show "ÆØÅ" and how do i make the database able to understand "ÆØÅ", so that i can upload?
Thanks in advance,
Victor
You can change the database collation to
latin1_swedish_ci/utf8mb4_bin
This will work. Its working fine for my sites.

WordPress Migration - Trouble with Import of MySQL Dump

I'm currently moving sites from one server to another. In doing this, I'm setting up new dev environment to help test any issues we may have in moving the site.
I've already moved one site, quashing all issues. I've had some issues with the latest two sites.
My work flow normally is:
1) Export
2) Edit to dev URL in Sublime Text via find/replace
3) Import to DB
Importing a MySQL dump first gave me an error such as
"ERROR at line XXX: unknown command YYY"
In one such scenario, this seems to be caused by an encoding issue (STX) for some unknown character.
I can get such errors to go away by using MySQL flags such as:
-default-character-set=latin1 for the mysqldump and NOT using --default-character-set=utf8 with the import.
This gets me further in the process, as things seem to be working, except no images show in Media (just default.png) for the thumbs. I've verified that the files exist on the server and checked permissions. When clicking on an image in Media, I can copy/paste the URL and the image shows properly in a browser.
Another example of where the data isn't fully transferring is that the template used for a page isn't being retained.
I'm at a loss at this point on how to properly export/format/import the MySQL dump. I've even tried the WordPress repair database utility without any change in results.
O. Jones comment mentions a plugin called Duplicator. I didn't utilize this given our situation so I cannot speak to whether or not it would. If that would work correctly, I would imagine that the ideal solution for most.
The solution that I've utilized is simple but may not work for those without access to or unfamiliar with MySQL.
The steps are:
Export via "mysqldump -u {user} -p {databaseName} >
{filename.sql}
Import like usual (without issues)
Log into the new MySQL database where the import was completed, use that database and run the following queries:
UPDATE wp_options SET option_value = replace(option_value, '{oldURL}', '{newURL}');
UPDATE wp_posts SET guid = replace(guid, '{oldURL}', '{newURL}');
UPDATE wp_posts SET post_content = replace(post_content, '{oldURL}', '{newURL}');
UPDATE wp_postmeta SET meta_value = replace(meta_value, '{oldURL}', '{newURL}');
These four queries may need to be run for each variation of "http://oldwebsite.com", "http://www.oldwebsite.com", "https://oldwebsite.com", and "https://www.oldwebsite.com".

How to access elements in laravel using pgsql as database?

I am currently learning laravel with pgsql as the defaut database.
I was reading the laravel tutorial online and I am in the chapter "Working with database".
I copy pasted the code for retrieving records but it doesn't work so I am assuming that it is probably because the tutorial uses MySQL while I'm using postgres.
I modified the code a bit and ended up with these:
StudentController.php
stud_view.php
All I'm getting is a table with headers but it's empty.
I noticed that as I add more tuples in the student table the table being showed by the stud_view is getting bigger but still empty so the Studentontroller must be correct right? The $user->id line of code must then be wrong. Well how do I access the elements then? By the way my student table has attributes name and id only. Thanks for the help.
I realized that my mistake was the filename! I should've saved it as stud_view.blade.php After doing so it worked. I don't understand why though because I thought blade was just used for styling.

Trouble with this "Update" command

I was given an sql database that I was supposed to do some stuff on, and I want to clean it up, given that they have stuff with "special characters" as values, such as carcaças. Notice the `ç.
My Update command just simply doesn't want to work. I've checked in a million times and the weird part is on the webservice that I'm creating using that database the line seems to do nothing, but when I go on phpmyadmin it works perfectly. It has nothing to do with permissions given that its all being hosted on my computer.
So here you go the code:
function filter($stockconn){
mysqli_query($stockconn,"UPDATE produtos SET familiaprod='Carcacas' WHERE familiaprod='Carcaças'") or die(mysql_error());
mysqli_close($stockconn);
}
So far its all very simple, simple connection file (which is working correctly 100%) being pulled towards that function.

Pull data from MySQL and reuse for a pingscript in PHP

I'm usually not the "scripting" guy
but I have been given a task, to create a script, that ping all our network equipments. (~300 devices) so I have come so fat, we can manage and edit the Excel and export as CVS into MySQL database, so far...
I have been searching around for a valid example to directly use the "IP" table from the database into my pingscript or to pull the SQL data and insert into a Array..
However, I have contact with the database, but I am unable to print the array data into my ping script however.
When I do a ECHO ['$databasename']; I get the result out, but I don't figure how to correctly input the table "IPaddr" into pingscript as a foreach from array...
I hope you can help me clearing this issue or correct me where I'm wrong :)
I can't post the code here, the site gives an error, so i posted on Pastebin:
PHP script can be seen here

Categories