Using Mysqli bind_param with date and time columns?
How do you insert data into a MySQL date or time column using PHP mysqli and bind_param? ...
How do you insert data into a MySQL date or time column using PHP mysqli and bind_param? ...
Hi, I'm repeatedly getting this in my server error log for MySQld. On my PHP (MySQLi) or SQL client (not sure what they use, maybe MySQLi as well) calling some (not all) stored procedures, this happens and I get the error message "Lost connection to MySQL server during query" (repeatedly). This procedure did actually work yesterday ;(. T...
I am trying to implement NOT NULL constraint in the customer table which is created as: CREATE TABLE CUSTOMER( cust_id INT(5) NOT NULL AUTO_INCREMENT, PRIMARY KEY(cust_id), first_name VARCHAR(25) NOT NULL, last_name VARCHAR(25) NOT NULL, email VARCHAR(25) NOT NULL, password VARCHAR(25) NOT NULL, gende...
Hey everyone, I was wondering, if I have some code such as: $result = $db->query($sql); // dont worry, its escaped $myData = (array)$result->fetch_assoc(); where $result->fetch_assoc(); returns a mysqli result object. Is casting it like this right away good practice? I would imagine this is an expensive call - is this true? It...
SOLVED: I wrote and tested a PHP script on the local server. (Nothing fancy, just 2 consecutive SQL inserts in the same database, but different tables). Both servers run PHP5 & MYSQL 5. On the local server, both queries are processed correctly. On the live server, only the first query works, but not the second and I can't figure out ...
Hello, my mysqli_fetch_array(mysqi_query($db, $query)) doesn't appear to be getting the correct information from the database, and therefore, the PHP application is not working as it should. Here are the queries, <?php if($_GET){ $current = mysqli_fetch_array(mysqli_query($db, "SELECT * from `tbl_user` WHERE `userid` = '".$_GET['useri...
Java has the PreparedStatement addBatch + executeBatch to do multiple insertions efficiently. What is the fasted way to do a batch of inserts using php's mysqli extension? Thanks! ...
Say one were looking at transitioning a codebase from using the basic PHP mysql_* functions to a mysqli implementation. Can connections to the same database be used side-by-side in both interfaces, or is there some way in which they can interfere with one another? ...
Error: Fatal error: Call to a member function bind_param() on a non-object in /var/www/web55/web/pdftest/events.php on line 76 Code: public function countDaysWithoutEvents(){ $sql = "SELECT 7 - COUNT(*) AS NumDaysWithoutEvents FROM (SELECT d.date FROM cali_events e LEFT JOIN cali_dates d ON e.event_...
I have two machines on amazon ec2, one with a drupal installation and another one with the mysql database. I wonder if it's worth to patch drupal to activate mysql client compression. Are there any caveats? ...
I don't understand the concept of the fetch function. I am doing a tutorial from 'PHP Solutions' book and i am using MySQL Improved to update something in the database. Here is the code: if (isset($_GET['article']) && !$_POST) { $sql = 'SELECT article_id, title, article FROM journal WHERE article_id = ?'; $stmt = $conn->stmt...
Hello, I'm currently trying to extract data from a table, and am using this: $online = mysqli_fetch_field(mysqli_query($db, "SELECT `online` FROM `tbl_system` WHERE `property` = 'extranet'")); However, it's not working as echoing $online give "Array". Here's a var_dump from $online object(stdClass)#3 (11) { [...
I'm playing around with MySQLi at the moment, trying to figure out how it all works. In my current projects I always like to echo out a query string while coding, just to make sure that everything is correct, and to quickly debug my code. But... how can I do this with a prepared MySQLi statement? Example: $id = 1; $baz = 'something'; ...
Below is the mysqli query that is being performed, anyone know what I get such error: $sql = mysqli_query($db, "INSERT INTO `tbl_bugzilla` (`id`, `by`, `title`, `content`, `date`, `application`,`priority`, `assigned`, `status`) VALUES (NULL, '".$_SESSION['exp_user']['username']."', '" .$_SESSION['exp_user']['username']...
Hi, this is a simple question. With PHP and MySQL, I'm trying to build a bug reporting application. Currently, the user can post bugs and a list of bugs is portrayed to the technician/administrator. How do I make it so that many technician or administrators can reply to the report (thread?) As in both mysql table layout and PHP codi...
Hello, I am trying to stop the data in the following table from continuing to repeat itself, as in looping on the same data, crashing the browser: Here's the query: $posts = mysqli_fetch_assoc(mysqli_query($db, "SELECT * from tbl_bugresponse WHERE bugid = $id ORDER BY time")); And here's the table code: <table width="100%" class="tb...
The user comes to this page from a different page where they click on a link and it is appended with a ?photo_id= and then the id number. I want certain information to be available to the viewer when they arrive at this page. I want them to be able to see the photo, the photo name, and the photographers name. The first two are not a pro...
Can anyone recommend a good wrapper class or extension to PHP's mysqli extension that allows the equivalent of mysql->fetch_assoc() for a prepared statement. That is ideally it condenses down into a single statement the tedious complexity of the init/prepare/bind/fetch-loop. ...
I have a form with two fields with the name attribute of 'photo_title' and 'photographer_name', and a hidden field named 'photo_id'. When the user pushes the submit button, i want it to update two separate tables in the database. I can get it to update a single table, but as soon as I try to leftjoin the second table, it doesn't like it....
I have a sql query and a mysqli prepared statement: $sql = 'SELECT photographers.photographer_id, photographers.photographer_name FROM photographers'; $stmt = $conn->stmt_init(); if ($stmt->prepare($sql)) { $stmt->bind_result($photographer_id, $photographer_name); $OK = $stmt->execute(); $stmt->fetch(); } How can...