I Want Help in MySQL

Started on the old forum in July 2011 · view the original in the archive · old links redirect here

3 replies · 452 views · started 15 years ago · 1 min read

4 participants
jayasrilanka Junior · 12 posts #1

Please i want to prevent inserting same "title" to the table.. My code are below

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd" > <html xmlns="http://www.w3.org/1999/xhtml"><head><title>Download File | JayaSriLanka</title> <?php include("../head.php"); ?></head><body><?php include("config.php"); mysql_connect("localhost", "jayasri6_dlc", "jaya") or die(mysql_error());echo "Connected to MySQL ";mysql_select_db("jayasri6_dlc") or die(mysql_error());echo "Connected to Database"; mysql_query("INSERT INTO example(url,title,size,date,artist) VALUES('$url','$title', '$size', '$date','$artist')") or die(mysql_error()); echo "data inserted"; ?>

Back<input type="text" size="10" value="/dl/?file=<?php echo $_GET['title']; ?>"/><hr />

<?php include("../footer.php"); ?> </body></html>
Jerson Developer · 70 posts #2

Just remove the "title" in the mysql query

atef Developer · 224 posts #3

put this at insert page

$jaya=mysql_query("SELECT * FROM jayasri6_dlc WHERE title='$title'");
if($jaya)
{
echo "this title already exist";
} else {
// submit script
}

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close