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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.