Hi there!
Since this is my first post, I'll try to be gentle with you :-)
I have a script that goes like this:
Connect to db. select data from db, and list up (only one variable, text).
I also have a form so I can insert into the database (insert into table where $id = contentid).
How can I check in php, if it is already there?
My code is something like this:
[code=php]
$id = intval( mysql_real_esca pe_string($_GET['id']));
$as_text = addslashes($_PO ST['text']);
$tr_text = trim($as_text);
$query = "INSERT INTO jos_issues(ID,t ext,contentid)
VALUES(NULL,'$t r_text','$id')" ;
$result = mysql_query($qu ery);
[/code]
How can I easily check if it has already been inserted into the database?
the table consists of 3 columns; id, text and contentid.
contentid is used so I can list all text that is connected to one particular content.
So, now I've been gentle with you, so you can be gentle with me :-)
Phopman
Since this is my first post, I'll try to be gentle with you :-)
I have a script that goes like this:
Connect to db. select data from db, and list up (only one variable, text).
I also have a form so I can insert into the database (insert into table where $id = contentid).
How can I check in php, if it is already there?
My code is something like this:
[code=php]
$id = intval( mysql_real_esca pe_string($_GET['id']));
$as_text = addslashes($_PO ST['text']);
$tr_text = trim($as_text);
$query = "INSERT INTO jos_issues(ID,t ext,contentid)
VALUES(NULL,'$t r_text','$id')" ;
$result = mysql_query($qu ery);
[/code]
How can I easily check if it has already been inserted into the database?
the table consists of 3 columns; id, text and contentid.
contentid is used so I can list all text that is connected to one particular content.
So, now I've been gentle with you, so you can be gentle with me :-)
Phopman
Comment