I'm sorta new...

admin

Administrator
Staff member
...so this may seem like an odd question.

If anyone can help me, I believe I have my syntax wrong but I'm not sure.

The following php gives me:
"Could not complete query."

and I don't know why...

<?php
$tablename = "tablename";
$mysql_db = "database";
$mysql_user = "username";
$mysql_pass = "password";
$mysql_link = mysql_connect("www.someserver.org", $mysql_user, $mysql_pass);
mysql_select_db($mysql_db, $mysql_link) or die("Could not connect to database.");
$select_query = "INSERT INTO $tablename
VALUES (1, Somename, Somepassword, Someemail, 3)";
mysql_query($select_query, $mysql_link) or die("Could not complete query.");
$result = $select_query;
if (!$result){
echo("Error! - ", mysql_error());}
if ($result){
echo("User successfully created!");}
?>
 
Back
Top