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.
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
141
10
Other php-forum
show random images
hey guys
can someone please suggest a way in which the following code can be edited so it onl
Stats of viewers
Hello. I have a website in php and people can login. I want to make an admin control panel where u c
tag inside php... hi
Code: <?php echo "<td width="$columnWidth%" align=&Search in the PHP Files have to search asterisk(*) in the php code of the php files .
In the html page one text box making web pages for accounts Hello, I would like to make pages for accounts on my website im making (its not a real website..im j date function help i need help with date function
Code: [Select]<!DOCTYPE HTML PUBLIC "-//W3C//DTD H Check if another session of the page is running? I want to keep people from opening multiple tabs, or sessions of my Facebook app. Is it possible to Rand() help needed Hi all,
Can someone explain and give me a quick example of how I would go about this?
urldecode question How would I format this line of code properly?
<?php echo urldecode($_GET['Title']); ? Mail Script Problems I have created a PHP mail script. I am having a problem though. In $body i am trying to put two va
|