help with mysql_error()
Posted on
16th Feb 2014 07:03 pm by
admin
Hi,
I am trying to insert data into a table, but I am not able to insert it. I wanted to see what the error was using mysql_error() function, but it does not return any error string for me. I have pasted the code below. Any ideas where I am going wrong would be greatly appreciated.
Did you know?Explore Trending and Topic pages for more stories like this.
global $error;
$link = mysqli_connect('localhost','root','');
if($link) {
$dbName = 'movieStore';
if(mysqli_select_db($link, $dbName)) {
$query = "INSERT INTO Movie(movieName,movieID, movieDescription) VALUES ('$movieName', '$movieID', '$movieDescription')";
$result = mysqli_query($link, $query);
if($result) {
$error = "Movie: $movieName successfully created";
}
else {
$error = "Error in your SQL: $query";
echo mysql_error();
}
}
else {
$error = "Unable to connect to $dbName";
}
}
}
echo $error;
It echoes that "Error in your SQL:INSERT INTO Movie(movieName,movieID, movieDescription) VALUES ('gg', '1', '') "
However, it does not print our what the error was while inserting.
Thanks a lot for looking into this
No comments posted yet
Your Answer:
Login to answer
141
10
Other forums
How to limit the calls to an API
Hello, in my simple script I call an api which effectively involves me getting an xml file.
H
urldecode question
How would I format this line of code properly?
<?php echo urldecode($_GET['Title']); ?
Change image filetype on upload?
Hi,
I've got a form which uploads an image to the server.
Is it possible to change the image t
Pagination
Hi All,
I think I'm finally getting somewhere with pagination!
I can now submit a quer
help removing unwanted graphic
How do I remove the small elongated rectangular shape between the "Latest post" and "
re calling a function without including file
Hi,
i am new to programming in php, i was just checking the wordpress code and found out in the w
Unable to customise toolbar in FCK
SAP Logon Failed
I tried to login to SAP through MMC.
When i click start and give password.
it
Create or replace package is ending ORA-21700
Database 9.2.0., patch 8 (9.2.0.8.0).
I trying run
create or replace package ....etc.
Sum of Values in an Array
This is probably really simple... but it's been years since I've written anything, so bare with me!<