Jump to content
php.lv forumi

mysql_query


homers

Recommended Posts

Gribu izveidot video galeriju bet uzķeros uz nelielas ķibelis ar mysql_query,

Kods jeb 18rinda:

mysql_query "INSERT INTO videos('autors','nosaukums','bilde','kods') VALUES('$_POST['autors']','$_POST['nosaukums']','$_POST['apraksts']','$_POST['kods']')");

 

Un errors:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampp\htdocs\add_v.php on line 18

Link to comment
Share on other sites

vēl viņš mēģina masīva vērtību drukāt starp pēdiņām

 

//FAIL:
echo "Wow, post dati: $_POST['oh_yeah'], kruta vai ne?";

//NOT FAIL:

echo "Wow, post dati: " . $_POST['oh_yeah'] . ", kruta vai ne?";
//vai
echo "Wow, post dati: {$_POST['oh_yeah']}, kruta vai ne?";

 

Nez vai viņš vēl izmanto tādu funkciju kā mysql_real_escape_string()

Edited by briedis
Link to comment
Share on other sites

Nu uzrakstīju šadi

mysql_query("INSERT INTO videos('autors','nosaukums','bilde','kods') VALUES('$_POST['autors']','$_POST['nosaukums']','$_POST['apraksts']','$_POST['kods']')");

Rada

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampp\htdocs\add_v.php on line 19

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...