desithugg Posted August 21, 2006 Share Posted August 21, 2006 im having trouble receiving a row (stored array) from a mysql database.what is stored in the row is"1134, 960" im using the fallowing query[code]$tid = $_GET['id']; $link = mysql_connect('localhost', $my_sql_password, $my_sql_username);if (!$link) { die('Could not connect: ' . mysql_error());}$db_selected = mysql_select_db('osiris_thugg');if (!$db_selected) { die('Could not select database: ' . mysql_error());}$query = "SELECT creator,id,completer,sitems,eitems FROM trade where id = '$tid'"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ $spokes = $row['sitems']; $epokes = $row['eitems'];echo "<tr><td class='ftable2'>". $row['creator'] ."'s items". $row['eitems'] ."</td><td class='ftable2'>". $row['completer'] ."'s items</td></tr>";}?>[/code]this echos the fallowing[quote]darkness's items1134, 960[/quote]than i use[code]<?$sitems2 = explode(", ", $sitems);$eitems2 = explode(", ", $eitems); $link = mysql_connect('localhost', $my_sql_password, $my_sql_username);if (!$link) { die('Could not connect: ' . mysql_error());}$db_selected = mysql_select_db('osiris_thugg');if (!$db_selected) { die('Could not select database: ' . mysql_error());}$query = "SELECT name,level,gender FROM character where item_id IN ($sitems2)"; $result = mysql_query($query) or die(mysql_error());while($row = mysql_fetch_array($result)){$gender = $row['gender'];if($gender == "Male"){$g2 = "M";}if($gender == "Female"){$g2 = "F";}if($gender == "Ungenderd"){$g2 = "U";}if($gender == "Transexual"){$g2 = "T";}if($gender == "Genderless"){$g2 = "G";}echo"-". $row['name'] ."LV.". $row['level'] ."($g2)";}?>[/code]but this keeps giving me the fallworing error[code]Unknown column 'Array' in 'where clause'[/code]it should work since there i used explode to make it into an arrayi tried using implode but it gives me some other error something like bad_argument(); where implde..... Quote Link to comment Share on other sites More sharing options...
desithugg Posted August 21, 2006 Author Share Posted August 21, 2006 bumpany1well just gonna bump the thread and go to sleep and check on it in the morning any1 help... Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 21, 2006 Share Posted August 21, 2006 [quote][code]Unknown column 'Array' in 'where clause'[/code]it should work since there i used explode to make it into an array.[/quote]That's exactly why it doesn't work. IN does not want an array, it wants a comma separated list - which is exactly what $sitem2 was before you exploded it into an array. Try it without exploding ... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.