Squirrel/Server/Functions/MySQL/mysql num rows

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Example)
(Returns)
 
Line 5: Line 5:
  
 
== Returns ==
 
== Returns ==
Number of result rows.
+
Number of results found, to the query.
 
+
  
 
== Example ==
 
== Example ==

Latest revision as of 11:26, 17 October 2012

[edit] Syntax

  1. mysql_num_rows( result )


[edit] Returns

Number of results found, to the query.

[edit] Example

  1. local c = mysql_connect( "host", "user", "pass", "db" );
  2. local q = format( "SELECT * FROM tbl_name WHERE name = '%s'", player.Name );
  3. local r = mysql_query( c, r );
  4. if( mysql_num_rows( r ) ! = 0 ) // If there is a result
  5. {
  6. }
  7. else // No result found
  8. {
  9. }
  10. mysql_free_result( r );
  11. mysql_close( c );
Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox