Fatal error showing - php-7

Fatal error: Uncaught Error: Call to undefined function mysqli_result() in /home/prasanth/projects/ishen1/index.php:49 Stack trace: #0 {main} thrown
how to slove this

according to this answer https://stackoverflow.com/a/17707384/8284461 that function is inefficient, you can use mysqli_fetch_assoc() instead. for example:
while($row = mysqli_fetch_assoc($result)) {
$id = $row['ID'];
$name = $row['name'];
etc..
}

Related

How to resolve jsons.map is not a function error in Redis?

I have a simple array as such :
qux > [1,2,3]
upon deleting the array via Client.json.arrPop('qux', '.' , 1) I receive
F:\vite-multiple-chat\backendofmultiplchat\node_modules\.pnpm\#node-redis+json#1.0.1_#node-redis+client#1.0.1\node_modules\#node-redis\json\dist\commands\index.js:87
return jsons.map(transformRedisJsonNullReply);
^
TypeError: jsons.map is not a function
at Object.transformRedisJsonNullArrayNullReply (F:\vite-multiple-chat\backendofmultiplchat\node_modules\.pnpm\#node-redis+json#1.0.1_#node-redis+client#1.0.1\node_modules\#node-redis\json\dist\commands\index.js:87:18)
at transformCommandReply (F:\vite-multiple-chat\backendofmultiplchat\node_modules\.pnpm\#node-redis+client#1.0.1\node_modules\#node-redis\client\dist\lib\commander.js:100:20)
at Commander.commandsExecutor (F:\vite-multiple-chat\backendofmultiplchat\node_modules\.pnpm\#node-redis+client#1.0.1\node_modules\#node-redis\client\dist\lib\client\index.js:160:54)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
The element is popped successfully however the error is thrown anyway. How can I resolve this issue?

Uncaught PodioBadRequestError: "Must specify either 'embed' or 'url'"

I need to set value for an embed field in Podio, and this is my code:
$field_id='pdf-property-information';
$options=$item->fields[$field_id]->values;
if(empty($options))
$item->fields[$field_id] = new PodioEmbedItemField($field_id);
// Create embed
$embed = PodioEmbed::create(array('url' => $pdf_property_information));
// Set using object
$item->fields[$field_id]->values = $embed;
// Set using associative array
$item->fields[$field_id]->values = array('embed_id' => $embed->embed_id);
And this is the error I get:
Fatal error: Uncaught PodioBadRequestError: "Must specify either
'embed' or 'url'" Request URL: http://api.podio.com/item/826141668
Stack Trace: #0
/home/apibind/public_html/mail_chimp/podio-php-4.3.0/lib/Podio.php(355):
Podio::request('PUT', '/item/826141668', Array) #1
/home/apibind/public_html/mail_chimp/podio-php-4.3.0/models/PodioItem.php(183):
Podio::put('/item/826141668', Array) #2
/home/apibind/public_html/mail_chimp/podio-php-4.3.0/models/PodioItem.php(66):
PodioItem::update(826141668, Array, Array) #3
/home/apibind/public_html/sourcingplatform/trunk/add.php(403):
PodioItem->save() #4 {main} thrown in /podio-php-4.3.0/lib/Podio.php
on line 289
You have to pass the embed_id with array key "embed". Here your final line will be like,
// Set using associative array
$item->fields[$field_id]->values = array('embed' => $embed->embed_id);

compiler error using tryRecv

I have the following Nim program:
import threadpool
var channel: TChannel[string]
proc consumer(channel: TChannel[string]) =
let (flag,msg) = tryRecv(channel)
if flag:
echo msg
channel.open()
spawn consumer(channel)
channel.send("hello")
channel.close()
sync()
When I try to compile it, it gives me this error message:
testchannels.nim(6, 27) Error: type mismatch: got (TChannel[system.string])
but expected one of:
system.tryRecv(c: var TChannel[tryRecv.TMsg])
I don't understand what the error message is trying to tell me...
Ahh, I think I got it now!
The important part of the error message was the var in system.tryRecv(c: var TChannel[tryRecv.TMsg]): tryRecv expects the channel variable to be mutable, which it wasn't in the above code.
The solution is to remove the parameter from the consume proc:
import threadpool
var channel: TChannel[string]
proc consumer() {.gcsafe.} =
if peek[string](channel) != -1:
echo recv(channel)
channel.open()
spawn consumer()
channel.send("hello")
channel.close()
sync()

Making a delete DAO -> Uncaught exception 'PDOException'

I'm trying to make a dao which can delete a specific item once you click on the X
How did I try this? I'll begin with showing you the DAO:
public function delete($iddelete){
$sql = "DELETE FROM `wanthave`.`wanthave_items` WHERE `wanthave_items`.`id` = `iddelete` = :iddelete LIMIT 1";
$stmt = $this->pdo->prepare($sql);
$stmt->bindValue(':iddelete', $iddelete);
$stmt->execute();
return $stmt->fetch(PDO::FETCH_ASSOC);
}
This is how I setup my if structure in a controller:
if(isset($_GET['iddelete'])){
$this->itemDAO->delete($_GET['iddelete']);
}
Once I click on the X near the item I want to delete it goes to a page with in the end "&iddelete=(id of the item)". So actually when iddelete is set it's going to delete it.
But unfortunately I get this error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'iddelete' in 'where clause'' in /Applications/MAMP/htdocs/wanthave/dao/ItemDAO.php:56 Stack trace:
#0 /Applications/MAMP/htdocs/wanthave/dao/ItemDAO.php(56): PDO->prepare('DELETE FROM `wa...')
#1 /Applications/MAMP/htdocs/wanthave/controller/ItemController.php(198): ItemDAO->delete('89')
#2 [internal function]: ItemController->delete()
#3 /Applications/MAMP/htdocs/wanthave/controller/Controller.php(9): call_user_func(Array) #4 /Applications/MAMP/htdocs/wanthave/index.php(69): Controller->filter()
#5 {main} thrown in /Applications/MAMP/htdocs/wanthave/dao/ItemDAO.php on line 56
Line 56 = $stmt = $this->pdo->prepare($sql);
Any help?
public function delete($id){
$stmt = $this->pdo->prepare("DELETE FROM wanthave_items WHERE id = ?");
return $stmt->execute([$id]);
}

Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]:

<?php
include('connect.php');
$date = $_POST['date'];
$student_ID = $_POST['student_ID'];
$full_name = $_POST['full_name'];
$year_section = $_POST['year_section'];
$payment_description = $_POST['payment_description'];
$amount = $_POST['amount'];
$received_by = $_POST['received_by'];
// query
$sql = "INSERT INTO transaction (date,student_ID,full_name,year_section,payment_description,amount,received_by) VALUES (:sas,:asas,:asafs,:offff,:statttt,:dot,:rd,:ft)";
$q = $db->prepare($sql);
$q>execute(array(':sas'=>$date,':asas'=>$student_ID,':asafs'=>$full_name,':offff'=>$year_section,':statttt'=>$payment_description,':dot'=>$amount,':rd'=>$received_by));
header("location: index.php");
?>
I get the following error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables
does not match number of tokens' in
C:\xampp\htdocs\recordmanagement\main\reg.php:15 Stack trace: #0
C:\xampp\htdocs\recordmanagement\main\reg.php(15):
PDOStatement->execute(Array) #1 {main} thrown in
C:\xampp\htdocs\recordmanagement\main\reg.php on line 15
In the code I am also unsure about the meaning of these values:
(:sas,:asas,:asafs,:offff,:statttt,:dot,:rd,:ft);
I downloaded it from sourcecode, so it was not written by me.
There seems to be a field to much in the query. This:
$sql = "INSERT INTO transaction
(date,student_ID,full_name,year_section,payment_description,amount,received_by)
VALUES (:sas,:asas,:asafs,:offff,:statttt,:dot,:rd,:ft)";
should probably be:
$sql = "INSERT INTO transaction
(date,student_ID,full_name,year_section,payment_description,amount,received_by)
VALUES (:sas,:asas,:asafs,:offff,:statttt,:dot,:rd)";
as there is no matching value for the :ft field.
Whether this is because your missing an item in the values or if it's not needed I can't say.