Jump to content

[SOLVED] Grab value from mysql table


Woodsyx

Recommended Posts

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

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);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.