Ok, I don't use php often enough to remember it when I wander back into it. I'm going a bit crazy with this one. I'll post the code below but a few quick explanations. con.php is a php file that creates the database connection $wkHook. There is no issue at all with the connection, so that is not my problem. Basically, I am selecting...
hey i want to make a search feature with mysql stored procedures and php.
how can i do this? i know how to call proc but how to send "q" input to procedure? thank you
...
Hi, I'm working on learning to use prepared statements with mysqli in PHP and usually, if I'm having a problem with a query I just echo it to the screen to see what it looks like as a first step.
How can I do that with a prepared statement?
I'd like to see the SQL statement after the variables are substituted.
...
I'm having some trouble using MySQLi to insert values into a database. I don't get any errors, but the values being inserted are not correct at all. One of the TEXT fields is always empty, and the other one always has the value "ý". The INT field always contains the value 50396416. I am using utf8_general_ci.
CREATE TABLE events (
i...
Here's the problem: I started a swap today to use mysqli. No biggie, just had to change a few statements. Everything went fine, no errors... Except that I can't get it to execute any queries at all. I have double and triple checked my syntax. I even started creating situations where it SHOULD return an error (Trying to get it to INSERT t...
I've built the following query programatically, but I have confirmed the query as being what is sent through the MySQLi query function.
SELECT * FROM `movie_cast`
JOIN `movie_x_movie_cast` ON
`movie_id` = "7" AND `movie_role_id` = "2" AND `movie_cast`.`id` = `movie_x_movie_cast`.`movie_cast_id`
ORDER BY `surname` DESC
The p...
Hi there i'm trying to convert a site to use prepared mysql statements, however i'm having some trouble replacing my use of fetch_array().
The comments on php.net offer a solution which I would have thought should work but for some reason i'm getting strange undefined constant errors when calling a function via call_user_func_array() ca...
I'm sure this will somebody no time at all.
I know that MySqli works on this server as i have tried inserts and they work fine.
I also know that the information I'm trying to obtain is in the database and i can connect to the database without any problems. But I can't for the life of me figure out why this isn't working. I've tried b...
I have a variable called $description that has a paragraph of information in it. Some of these descriptions are a sentence or 2, some are long, so im using blobs to save this instead of var char. This statement executes without a problem, but nothing actually gets saved. No errors reported.
$query = "UPDATE event SET description=? WHERE...
I am fairly new to PHP and I have found that a lot of my functions require access to the database. The problem is I currently connect to the database in a file that I require at the top of every page like so:
$db = new mysqli("localhost", "my_user", "my_password", "world");
The problem I find is then when I want to access it within a ...
Below is the code I am using. Separately they both do what they are supposed to but when I try to use the result from the first statement in the second it doesn't return anything. I know that The first statement always returns the correct data. Can someone tell me what it is I'm doing wrong? Thanks
$connection = mysqli_connect($hostname...
I'm having some issues using mysqli to execute a script with SELECT,DELETE,INSERT and UPDATE querys. They work when using norm mysql such as mysql_connect but im getting strange results when using mysqli. It works fine with a lot of the SELECT querys in other scripts but when it comes to some admin stuff it messes up.
Its difficult to e...
Hi,
I run PHPunit tests via Apache, ou directly in Eclipse (ZendStudio in fact). All run well via Apache, but under Eclipse i have this error :
zend mysqli statement execute error no
data supplied parameters prepared
statement
The php version is the same (5.2.10), ZendFramework is 1.9 and here is the code
function isValidPr...
hello,
I am having a wee problem, and I am sure there is a more convenient/simpler way to achieve the solution, but all searches are throw in up a blanks at the moment !
I have a mysql db that is regularly updated by php page [ via a cron job ] this adds or deletes entries as appropriate.
My issue is that I also need to check if any...
I've got a site that requires manual creation of the database tables on install. At the moment they are saved (along with any initial data) in a collection of .sql files.
I've tried to auto-create using exec() with CLI MySQL and while it works on a few platforms it's fairly flakey and I don't really like doing it this way, plus it is h...
Hello,
I am inserting a lot of records using mysqli commit statement, using this code from http://www.php.net/manual/en/mysqli.commit.php#88857. I then check affected rows using:
$mysqli->affected_rows
but even though all records have been inserted, I get zero affected rows.
How can I check when commit failed and retrieve the error?
Tha...
im tracking down a weird bug where a variable i have is being changed at some point, and this is where I found the problem:
echo "2. page is $page<br>";
$h = $page;
//Ok everything is done. Now need to update the view counter
$query = "UPDATE pages SET views=views+1 WHERE id=? LIMIT 1";
if($stmt = $db -> prepare($query))
{
$stmt -> ...
I'm using prepared statements and MySQLi, and am currently getting this error.
PHP Catchable fatal error: Object of class mysqli_stmt could not be converted to string in /Users/me/path/to/project/ModelBase/City.php on line 31
The code it's coming from (full function):
function select($query, $limit)
{
$query = "%".$query."%"...
I'm trying to loop over a set of results using MySQLi and the bind / fetch.
static function getConnection()
{
if (!isset(self::$db_conn))
{
self::$db_conn = new mysqli(self::$DBSERVER,self::$DBUSER,self::$DBPASS, ModelBase::$DBNAME) or die(mysql_error(0)." Error handling database connection. ");
}
return self::...
I have a table 'account' (id, email, pass) in MySQL database.
I have stored procedure:
DELIMITER $$
CREATE PROCEDURE `LoadAccount`(email_p VARCHAR(100))
BEGIN
SELECT pass FROM account WHERE email = email_p;
END$$
DELIMITER ;
And here's the code:
function loadAccount($email, $pass)
{
// connect to DB
// ...
$query = "CA...