Alffallen Posted April 4, 2007 Share Posted April 4, 2007 Back again. Hopefully this is pretty straight forward. I've eyed this for several minutes double checking variable names ect. Heres a quick overview. In general im woring on writting functions to perform some routine db connections. This one I would like to build a query quite like the last one. Though I need this one to return a array of the selected row. Heres the code. Looks pretty sound compared to the working update field function from prior. <?php #the selectRow function will select a row for an array based on table and a Identifyer column with its matching id function selectRow($table, $method, $string) { require('Connections/thegame.php'); $query2 = "Select * From $table Where $method='String'"; mysql_select_db($database_thegame, $thegame); $thequery = mysql_query($query2, $thegame) or die(mysql_error()); $return_array = mysql_fetch_assoc($thequery); return $return_array; } ?> Here is the call I'm using with it same test data row in the db as last. $username = selectRow("users", "characterName", "Alffallen"); echo $username['inventorySlot1']; However even though I get no mysql error from the query or the fetch_assoc. Though the echo line does not display anything despite. I'm wondering if anyone had some suggestions as to how to get the array info returned for output. Link to comment https://forums.phpfreaks.com/topic/45501-solved-similair-but-a-new-fun-function-problem/ Share on other sites More sharing options...
Alffallen Posted April 4, 2007 Author Share Posted April 4, 2007 Nevermind Simple mistake. I typed $string wrong and got String so looked it over prolly 20 times.. Thanks anyways all solved. Link to comment https://forums.phpfreaks.com/topic/45501-solved-similair-but-a-new-fun-function-problem/#findComment-220954 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.