I would like to do a SQL-request within my php-page.
Currently, the code looks like:$activiteitname = mysql_query("SELECT开发者_JAVA百科 titel FROM tblLeidingAgenda WHERE id='{$_POST['id']}'");
$message = 'Herinnering!';
mail('me@test.be', 'Reminder: '.$activiteitname.'', $message);
But on execution, I get an Resource id #15
error...
When MySQL returns data to PHP, the information is put into a variable called a resource special data type
. When you attempt to treat this as if it were a string data type
, all that it 'reveals' is the ResouceID
mysql_query returns a handler but you can retirve that result with mysql_result
<?php $activiteitname = mysql_result(mysql_query("SELECT titel
FROM tblLeidingAgenda
WHERE id='".mysql_real_escape_string($_POST['id'])."'"),0,'titel');
?>
try
$activiteitname = mysql_query("SELECT titel FROM tblLeidingAgenda WHERE id='{$_POST['id']}'");
var_dump(mysql_fetch_array($activiteitname));
精彩评论