Jump to content

Search the Community

Showing results for tags 'extract()'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 3 results

  1. 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.
  2. if i use code as follows, This is a safe way to take the value of the form ? <html> <head></head> <body> <form method='post'> <input type='text' name='name' value='akli'> <input type='submit' name ='view' value='view'> </form> </body> </html> <?php extract($_POST); if($view) echo $name; ?> please healp me
  3. Hey guys, I am trying to grab and loop data from my DB with a while loop and extract() function. right now i have something like this: echo '<div>'; // CONTAINER DIV echo '<h2>News about '. $db_name. '</h2>'; $query = 'SELECT * FROM `news_to_people` WHERE `people_db_id` = '.$db_id; $r_query = mysql_query($query); while($rows=mysql_fetch_assoc($r_query)){ extract($rows); $new_q = 'SELECT * FROM `news` WHERE `id` = '.$news_id; $run_q = mysql_query($new_q); $rows = mysql_fetch_assoc($run_q); extract($rows); echo '<ul>'; echo '<l1><a href="article?articleid='.$id.'&name='.$db_name.'">'.$title.'<br></l1>'; echo '</ul>'; } echo '</div>'; // END TO CONTAINER Now here i get the loop to fire correctly and execute. It then loops all 170+ links except in the middle of the loop , there is an error: so this means that i have a failed 2nd query somewhere in that it is skipping inside the while loop. i need to debug and find which query is bringing this error. my question is what is the best way i can write an if statement to see which query is failing or which query is not returning a proper array. also my if the query was failing wouldn't the error be asking for a proper resource ? this means the query is firing correctly and the extract() function is failing to receive all the rows. meaning that one of the rows must be returning empty or zero ? any help is much appreciated.
×
×
  • 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.