Jump to content

Mysql Scalar?


Nodral

Recommended Posts

Hi All

 

I've a question regarding php and mysql database interrogation.  Is there a way of applying a scalar database call from php, rather than having to return values in an array?

 

For example if I know there is only 1 value in a DB table which matches a select statement, do I have to return it with the following or is there another function which will save me using arrays?

 

$sql="SELECT name FROM users WHERE id = 10";
$sql=mysql_query($sql);
$row=mysql_fetch_array($sql);

 

This would then give me $row['name'] to work with.

Is there a way of doing this?

Link to comment
https://forums.phpfreaks.com/topic/250853-mysql-scalar/
Share on other sites

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.