Question

I need to take value form variable, hode one part and send the other part in email.

This variable is sql anywhere query result.

This is what i have so far:

$res=sqlanywhere_query(...)

$resID=explode('#',$res);
$email.=$email_footer.$resID[1].$email_footer2;

When I had in email $res, in email I get something liike Resource #163.

When I put $resID[1], in place where should be 163, space was empty.

Was it helpful?

Solution

That is because your $res is a resource, you have to get the results. You should have for that library something like

$sql = sqlanywhere_query(...)
$res = sqlanywhere_fetch($sql);

and $res will be an array with your query result;

OTHER TIPS

It's a resource, which means that it's a special variable that holds a reference to an external source.

See the PHP manual on Resources.

please, using database with php. when you query, you must pass the result to a fetch function before you can access the values.

$res=sqlanywhere_query(...)

//fetch one
$data = sqlanywhere_fetch_row($res)

// or u loop through
while($row = sqlanywhere_fetch_row($res))
{
    echo $row["id"];
}

all these functiosn are deprecated. you can use mysql_query and mysql_fetch_row (or other fetch functions). you can also use mysqli_ functions. read PHP manual.

hope it helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top