Jump to content

[SOLVED] Similair but a new fun-function problem.


Alffallen

Recommended Posts

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.

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.