artoak Posted September 10, 2009 Share Posted September 10, 2009 Hello I am trying to write some code to retrieve a single result from 2d mysql matrix with x and y being variables input by the user. I can do it that I can select any row from the 1st column and then hard code how many columns across I want. $pitch=$_POST['field_3']; $direction=$_POST['field_4']; $a_pitch="SELECT * FROM angle WHERE pitch='$pitch'"; $result=mysql_query($a_pitch); // Search the database 'angle' for the corrolating factor if (mysql_num_rows($result) > 0) { while($row = mysql_fetch_row($result)) { // echo $row[1]."<br/>"; $orientationf=$row[2]; }} So the $row[2] need to be a variabe called up in $direction. I thought I could replace $orientationf=$row[2] with $orientationf=$row[$direction] but no. Do I need a fetch_column inside the fetch_row but I've tried different things and my head is starting to bleed. Any ideas? Link to comment https://forums.phpfreaks.com/topic/173752-retrieve-single-result-from-2d-mysql-matrix-with-x-and-y-being-variables/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.