Woodsyx Posted July 3, 2009 Share Posted July 3, 2009 So I need to get the value of a column in a table and according to some stuff I found these 2 ways should work but im getting errors for both. So did I get the syntax wrong or am I going down the wrong path of what to do. $result = mysql_query("SELECT lasttime FROM idlers WHERE name='".mysql_real_escape_string($name)); $row = mysql_fetch_array($result); $ptime = $row['lasttime']; $result2 = mysql_query("SELECT totaltime FROM idlers WHERE name='".mysql_real_escape_string($name)); $row2 = mysql_fetch_array($result2); $ttime = mysql_result($result2, 1); Link to comment https://forums.phpfreaks.com/topic/164683-solved-grab-value-from-mysql-table/ Share on other sites More sharing options...
gevans Posted July 3, 2009 Share Posted July 3, 2009 You're not closing either of your quotes; $result = mysql_query("SELECT lasttime FROM idlers WHERE name='".mysql_real_escape_string($name)."'"); $row = mysql_fetch_array($result); $ptime = $row['lasttime']; $result2 = mysql_query("SELECT totaltime FROM idlers WHERE name='".mysql_real_escape_string($name)."'"); $row2 = mysql_fetch_array($result2); $ttime = mysql_result($result2, 1); Link to comment https://forums.phpfreaks.com/topic/164683-solved-grab-value-from-mysql-table/#findComment-868450 Share on other sites More sharing options...
Woodsyx Posted July 3, 2009 Author Share Posted July 3, 2009 Awesome that worked thanks. Link to comment https://forums.phpfreaks.com/topic/164683-solved-grab-value-from-mysql-table/#findComment-868458 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.