Jump to content

function error


telsiin

Recommended Posts

I am trying to pass a variable to a function, I believe my syntax is wrong

 

thank you for your help

 

 

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /../../../actiontest.php on line 7

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /../../../actiontest.php on line 9

 

5

6  function optionAction($actiontype){

7  mysql_select_db($database_actionrpg, $actionrpg);

8  $query_action = "SELECT * FROM actionlist WHERE actionlist.action_type = '$actiontype'";

9  $action = mysql_query($query_action, $actionrpg) or die(mysql_error());

10  $row_action = mysql_fetch_assoc($action);

11  $totalRows_action = mysql_num_rows($action);

12  }

13    optionAction("Attack");

14

15  ?>

 

Link to comment
https://forums.phpfreaks.com/topic/182739-function-error/
Share on other sites

<?php

function optionAction($actiontype) {
global $database_actionrpg, $actionrpg;
mysql_select_db($database_actionrpg, $actionrpg);
$query_action = "SELECT * FROM actionlist WHERE actionlist.action_type = '$actiontype'";
$action = mysql_query($query_action, $actionrpg) or die(mysql_error());
$row_action = mysql_fetch_assoc($action);
$totalRows_action = mysql_num_rows($action);
}

optionAction("Attack");

Link to comment
https://forums.phpfreaks.com/topic/182739-function-error/#findComment-964781
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.