execute scalar for php


/ Published in: PHP
Save to your folder(s)

retrieve only one value from the query


Copy this code and paste it in your HTML
  1. function execute_scalar($sql,$def="") {
  2. $rs = mysql_query($sql) or die(mysql_error().$sql);
  3. if (mysql_num_rows($rs)) {
  4. $r = mysql_fetch_row($rs);
  5. return $r[0];
  6. }
  7. return $def;
  8. }

URL: http://www.barattalo.it/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.