fsl4faisal Posted October 10, 2010 Share Posted October 10, 2010 i need to store a variable from database like if i have "copies" in one of my column in my database then i have to store a particular value for copies store it to $copies here i want that i can store value of copies into $copies $update_book="update book set copies=copies-1 where bookid='$bookid'"; $result=mysql_query($update_book,$linkID1); if($result) { print "<html><body background=\"header.jpg\"> <p>book successfully subtracted from database</p></body></html>"; } else { print "<html><body background=\"header.jpg\"> <p>problem occured</p></body></html>"; } } Link to comment https://forums.phpfreaks.com/topic/215536-need-to-store-a-database-variable-in-a-php-variable/ Share on other sites More sharing options...
chintansshah Posted October 10, 2010 Share Posted October 10, 2010 after an update query, use select query list($copies)= mysql_fetchrow(mysql_query("select copies FROM book where bookid='$bookid'")); Link to comment https://forums.phpfreaks.com/topic/215536-need-to-store-a-database-variable-in-a-php-variable/#findComment-1120759 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.