Link to home
Start Free TrialLog in
Avatar of Elucidate-Technologies
Elucidate-TechnologiesFlag for Puerto Rico

asked on

INSERT query inserting Resource id #5 in MySQL table

I am trying to insert a value from a variable to a mySQL table, but instead of the value, it is inserting Resource id #5. I can`t find the problem.

$query = "SELECT categorias.desc from categorias where = '".$_SESSION['clasificacion']."'";
$cat_descrip = mysql_query($query);

Open in new window

$query2 = "INSERT INTO `profile_test` (clasificacion) VALUES ('$cat_descrip')";

Open in new window

profile_test.clasificacion is getting "Resource id #5"
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Elucidate-Technologies


Thanks. That did it :)
Thanks for point!

Just a note:
mysql_query "For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error." (see Php manual:
So you have to 'convert' this resource in radable and usable data using 'fetch' functions:

mysql_fetch_array (

Keep in mind that the use of all these functions is discouraged: you should move on to mysqli od PDO.