Catchable fatal error: And what is it? - mysqli

<?php
$con=mysqli_connect("localhost","root");
if (!$con){
die("X");
}
$select=mysqli_select_db("$con","template1");
if (!$select){
die("XX");
}
?>
Catchable fatal error: Object of class mysqli could not be converted to string in C:\xampp\htdocs\login\login.php on line 7
So basically it is just a try out however i get the above error on my laptop and i would like to know why it happen.
Thanks in advance

Here's the line that needs to be fixed.
$select=mysqli_select_db("$con","template1");
By doing "$con" you're trying to convert $con to string. Just remove the quotes.
$select=mysqli_select_db($con,"template1");

Related

Problem with PayPal checkout and Braintree class

I am trying to set up a PayPal checkout with this tutorial:
https://developer.paypal.com/docs/checkout/integrate/#
I am facing a problem with step 6. Verify the transaction
The php script throws:
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /vendor/braintree/braintreehttp/lib/BraintreeHttp/HttpClient.php on line 38
in the Browser console.
function __construct(Environment $environment)
{
$this->environment = $environment;
$this->encoder = new Encoder();
$this->curlCls = Curl::class;
}
The last line is 38. Anybody an idea what is going wrong here?
I had the same error and commented out line that sets curlCls
$this->curlCls = Curl::class;
It looks it is not used anywhere and the basic PayPal example started to work.

createInstantRoom throwing error in strophe.muc.js

I'm trying to create muc room using createInstantRoom method in strophe.muc.js, but its throwing error. can anyone plese tell me what is the format of room name given as input to createInstantRoom method
I tried this:
this.globalConnection.muc.createInstantRoom('testGroup#conference.localhost/879FKQVK0NZVMWRYQ8#localhost', this.onSuccess, this.onFailure);
This is the error call backfunction response:
…
I don't know about strophe, but this sounds wrong:
testGroup#conference.localhost/879FKQVK0NZVMWRYQ8#localhost
If that argument is the room JID, then it's probably better something like:
testGroup#conference.localhost

JasperReports: report parameter as an argument for message bundle lookup

How to look up a particular internationalized property based on a report parameter?
This works, but is static:
$R{some_literal_string}
This works too, but is not internationalized:
$P{key_to_parameters_map_element}
What I need is:
$R{$P{key_to_parameters_map_element}}
Unfortunately, I get a pile of error messages:
Caused by: net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. Syntax error on token "}", delete this token
value = str("$P{key_to_parameters_map_element")}; //$JR_EXPR_ID=13$
This doesn't change anything:
$R{$P{key_to_parameters_map_element}.toString()}
Is this possible at all?
It's
str($P{key_to_parameters_map_element})
Quite intuitive, isn't it?

Perl Error: Can' t call method 'Mangle' on an undefined value

I am trying to execute a perl script in that we have statement like this-
# Calculate password using PwdMangler
$PwdMangler = Win32::OLE->new('PWDMangler.Mangler');
unless($password = $PwdMangler->Mangle($user , $password_plain))
{
print $log_file "Error occured in PwdMangler\n";
exit (1);
} # End Unless
but this perl is giving an error like this-
Can't call method 'Mangle' on an undefined value.
So, i tried to print $user and $password_plain values and i am able to capture these values.
Any suggestion for this error.
From CPAN: The new() class method starts a new instance of an OLE Automation object. It returns a reference to this object or undef if the creation failed.
You should check if the PWDMangler.Mangler is a proper program id.
P.S.: Don't want to look dumb, but are you sure that PWDMangler should not be PWDManager?

symfony2 embedded collection edit form

I created an embedded collection of another entity in a form, the idea would be that when you edit or erase up to 'demand' also would edit the 'products' that belong to it, my creating form is ok, but the editing it gives the error :
Catchable Fatal Error: Argument 1 passed to MaisAlimentos\DemandaBundle\Entity\Demanda::setProdutosDemanda() must be an instance of Doctrine\Common\Collections\ArrayCollection, instance of Doctrine\ORM\PersistentCollection given, called in /var/www/maa/vendor/symfony/src/Symfony/Component/Form/Util/PropertyPath.php on line 347 and defined in /var/www/maa/src/MaisAlimentos/DemandaBundle/Entity/Demanda.php line 130
I read on some forums, the solution is remove type of the setter, I got other error:
Catchable Fatal Error: Object of class Doctrine\ORM\PersistentCollection could not be converted to string in /var/www/maa/src/MaisAlimentos/DemandaBundle/Entity/Demanda.php line 136
my code
http://pastebin.com/WeGcHyYL
OK, so you've found the solution for your original problem.
The second one comes from a typo/copy-paste error.
In the line 162 on your pastebin code:
$this->$produtosDemanda = $produtosDemanda;
should be
$this->produtosDemanda = $produtosDemanda;
So no $ sign after $this->.