Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

  • Days Won


CSnovice last won the day on April 8 2015

CSnovice had the most liked content!

Community Reputation

2 Neutral

About CSnovice

  • Rank
  1. It was also suggested to me that I should refrain from using extract($row), as it creates unnecessary duplicate variables, but I am uncertain of another way to acess $result in order to format the html table. Also, the use of extract() only seems contentious when using it with $_POST or $_GET methods, a process that I am not following. I am happy to try an alternative, but would like some suggestions as to what could work first.
  2. I've also tried using GROUP BY in place of ORDER BY in the SQL query, but the output remains the same.
  3. I have the following general mySQL query: $query = sprintf( "SELECT a.A, a.B, ..., a.C, FROM a WHERE a.A = %s ORDER by a.A;", implode(" OR a.A = ", $_SESSION['values'])); for some records, B has a value, and for others, B is NULL. That is what I want. I extract the query with the following PHP: for ($i = 0; $i < $nrows; $i++){ $row = mysqli_fetch_assoc($result);//fetches data stored within each row extract($row); echo "<tr>"; foreach($row as $column => $field){ if($field == $...){ ... } elseif($field == $C){ echo"<td> <input type='text' name='C+[]' value='$C'> </td>"; } echo "</tr>" } In the resulting html table, records containing not null B fields are presented accurately, while records with null B fields incur a duplication of field C. This offset occurs at the beginning of the record, pushing the final field in the record outside the table boundaries. I think I've narrowed down the problem to the extract() function, as r_print readouts of every other variable in the script returns the accurate field names and values. But, running print_r on $row after extract() provides an identical printout to other variables in the script. What are some possible ways I can stop the duplication of field C from occurring? Happy to provide more information upon request.
  4. CSnovice


    Hello, I've just signed up for php freaks, and I'm relatively new to PHP, but I've spent some time lurking around stackoverflow in order to get a sense of how to ask a good question and provide just enough information. Looking forward to getting some help here, and hopefully helping others once I become a better coder.
  • 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.