| | |
Duplicate entry '' for key 2
![]() |
OK, what I mean is the following
$new_text is the variable name by which you refer to it in your code. The variable value is the value of $_GET['whatever'].
My question is - your string
looks exactly as you would have it typed into your code.
But when you call the page wich contains ECHO "INSERT STRING HERE $variable"; and PHP parses the code - the html output should be something like
INSERT STRING HERE my value.
So what bothers me in your post is that if the HTML output of the echo command is exactly as you have it posted here, there is something wrong in the formatting of your php string.
Do you understand me better now?
$new_text is the variable name by which you refer to it in your code. The variable value is the value of $_GET['whatever'].
My question is - your string
PHP Syntax (Toggle Plain Text)
INSERT INTO `article_fields`(`field_title`, `field_type`) VALUES("'.$new_text.'","'.$field_type.'")
But when you call the page wich contains ECHO "INSERT STRING HERE $variable"; and PHP parses the code - the html output should be something like
INSERT STRING HERE my value.
So what bothers me in your post is that if the HTML output of the echo command is exactly as you have it posted here, there is something wrong in the formatting of your php string.
Do you understand me better now?
" Of all the things I've lost,
I miss my mind the most...."
Mark Twain
I miss my mind the most...."
Mark Twain
the ` (which are different than ') are not necessary, but I see phpMyAdmin and other programs use them a lot so it kind of became a habit of mine. it also helps me identify database and table names in the queries i write. i wrote the column names in so we could avoid silly errors that i figured s/he would have.
cali_dotcom:
if you have some code to look at, post it. maybe we can find if something else is preventing this from working, because i know the sql i posted works.
cali_dotcom:
if you have some code to look at, post it. maybe we can find if something else is preventing this from working, because i know the sql i posted works.
mysql_query(sprintf("insert into article_fields
(new_text, fields_type) values
('%s', '%s');",
$new_text, $field_type))
(new_text, fields_type) values
('%s', '%s');",
$new_text, $field_type))
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
![]() |
Similar Threads
- MySQL installation problem (*nix Software)
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource (PHP)
- c++ letter coding (C++)
- constraints (C#)
- PHP MySQL problem (PHP)
- INSERT INTO doing double duty (MySQL)
- Validation for the primary key in the database (JSP)
- duplicate entry through web form into oracle (Python)
Other Threads in the PHP Forum
- Previous Thread: Urgent help needed! Transaction process after shopping cart
- Next Thread: how to access accessing PHP variable in JavaScript
Views: 3593 | Replies: 13
| Thread Tools | Search this Thread |
Tag cloud for PHP
access ajax apache archive array arrays beginner binary box broken buttons cakephp cart check checkbox class classes cms code curl database date development directory display download dropdown drupal dynamic echo email error file files folder form forms functions header href htaccess html image include insert ip java javascript joomla jquery limit link list login loop mail menu mlm mod_rewrite multiple mysql order output parse password paypal pdf php problem query radio redirect regex remote results script search select server session sessions sort source sql string table tutorial update updates upload url user validation validator variable video web website wordpress xml






