Jump to content
php.lv forumi

You have an error in your SQL syntax


-=HELLBENDER=-

Recommended Posts

$randoms = random_string();
$niks = mysql_real_escape_string($_POST['niks']);
$skype = mysql_real_escape_string($_POST['skype']);
$nosaukums = mysql_real_escape_string($_POST['nosaukums']);
$apraksts = mysql_real_escape_string($_POST['apraksts']);
if(mysql_num_rows(mysql_query("SELECT * FROM saraksts WHERE key = '$randoms'"))){
echo "Ieraksts jau eksistē!";
break;
} 
$sql="INSERT INTO saraksts (niks, skype, nosaukums, apraksts, key, ip)
VALUES
('$niks', '$skype', '$nosaukums', '$apraksts', '$randoms', '$_SERVER[REMOTE_ADDR]')";

 

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in index.php on line 642

Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key, ip) VALUES ('asdasdasdasdasd', 'asdasdasdasd', 'asdasdasdasd', 'asdasdasdas' at line 1

 

Ilgi pētīju, bet nespēju saskatīt kur ir kļūda.. Varbūt kādam ir veiklāka acs?

Link to comment
Share on other sites

mysql_errors parādīja šo "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key = 'fxg49qzy9yw'' at line 1" (pirmajam)

bet nu kā jau teicu, kļūdu tur nespēju saskatīt.

Problēma nav gluži tādi pati, kā tajā topikā.

Edited by -=HELLBENDER=-
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...