Jump to content

How to solve "Uncaught Error: Call to a member function bind_param() on bool " ?


sashavalentina

Recommended Posts

I want to submit my data to the notifications table, I am not sure why do i got this type error. Can anyone lend me a helping hand and help me with this problem? 

 $product_name = $row['cart_name'];
              $cn_product_name = $row['cn_cart_name'];
              $m_product_name = $row['m_cart_name'];
              $variable00 = 'New';
              $variable01 = '新订单';
              $variable02 = 'Pesanan Baharu';
              $variable03 = '<b>Order No: #';
              $variable04 = '</b><br>';
              $variable05 = 'for';
              $variable06 = 'is Placed Successfully';
              $variable07 = '<b>订单号: #';
              $variable08 = '</b><br>已成功下单';
              $variable09 = ' 的';
              $variable10 = '<b>Nombor Pesanan: #';
              $variable11 = '</b><br>Pesanan untuk';
              $variable12 = 'anda sudah berjaya';
              $variable13 = 0;
              
              $nQuery = "INSERT INTO notifications (notification_title, cn_notification_title, m_notification _title, notification_date, 
              notification_text, cn_notification_text, m_notification_text, user_id, seller_id, order_id, product_id, user_notify, 
              seller_notify, admin_notify) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
              $stmt= $conn->prepare($nQuery);
              $stmt->bind_param("sssssssiiiiiii",$variable00.$order_type, $variable01, $variable02, $now, 
              $variable03.$order_id.$variable04.$order_type.$variable05.$quantity.$quantity_unit.$product_name.$variable06, 
              $variable07.$order_id.$variable07.$quantity.$quantity_unit.$variable09.$cn_product_name,
              $variable10.$order_id.$variable11.$quantity.$quantity_unit.$m_product_name.$variable12,
              $user_id, $seller_id, $order_id, $product_id, $variable06, $variable06, $variable06);
              $stmt->execute();

 

Link to comment
Share on other sites

As Mac_gyver has said, "where is the data"?  One doesn't (usually) store html code or 'literals' in a table - that is the place for pure data.  What you are storing here is boilerplate - the labels, names, punctuation and presentation material, not 'information' that can't be stored elsewhere.  Such a waster of time to make up a query to store this stuff when a couple of lines of html and it's done!  Plus what's with the long concatenated value you are creating after the "now" variable?  That alone is so against the RDBMS book that it is laughable.

You need to re-think your approach (or understanding?) to data storage and database design and usage.  It will be good reading and much improve your use of this technology.  Enjoy the learning process.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.