• 0

Adding to mySQL DB...


Question

I have this code that someone gave me that is supposed to take the thing you enter and add it to a mySQL DB.

$link = mysql_connect ($host, $user, $password); 
$query = "INSERT into $tablename VALUES ('0', '$key')"; 
print ("Error<BR>\n"); 
if (mysql_db_query ($dbname, $query, $link)) { 
print ("404 page not found, please hit the back button on your browser or type a new url<BR>\n");
} else { 
print ("E R R O R 404 PAGE NOT FOUND <BR>\n");
} 
mysql_close ($link);

When I do:

http://sp0rk-tech.net/thescript.php?key=dsosdfdsfsnds

It just inserts a blank thing in the table. It inserts a new one each time I do it, but it's like its not recognizing the data. Can anyone help?

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Note: This function has been deprecated since PHP 4.0.6. Do not use this function. Use mysql_select_db() and mysql_query() instead.

Shouldnt be the cause of the problem, but its always nice to use the current functions.

Link to comment
Share on other sites

  • 0
change id, key after $tablename to whatever your rows are in the database

Can you give me an example of what I put for ID and key? I don't exactly understand...

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.