php - How to store the sql result into a variable? -
why isn't working me:
$item_id = "select item_id items item_id=(select max(item_id) items)";
i'm trying insert sql query result variable item_id
.
if write echo"$item_id";
sentence in between quotes output.
you must have connection out var , need fetch array try this:
// connection data //
$link = mysql_connect("localhost", "youruser"); mysql_select_db("yourdb", $link);
// select //
$result = mysql_query("select yourvalue yourtable", $link);
$row = mysql_fetch_array($result)
your item var
$item_id = $row ["yourvalue"]
regards
Comments
Post a Comment