Jump to content

Search the Community

Showing results for tags 'mysqlprepared'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

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


Languages

Found 1 result

  1. Desperately needed: a way to retrieve all records from a database table while using prepared statements. The script now works but only for 1 record. <?php $_POST['id']= '2'; // set connection variables // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $stmt = $conn->prepare("SELECT * FROM table WHERE id LIKE ? ;"); if ( !$stmt ) { yourErrorHandler($conn->error); // or $mysqli->error_list } else if ( !$stmt->bind_param('i', $id ) ) { yourErrorHandler($stmt->error); // or $stmt->error_list } else if ( !$stmt->execute() ) { yourErrorHandler($stmt->error); // or $stmt->error_list } else { $result = $stmt->get_result(); while ($row = mysqli_fetch_assoc($result)) { var_dump($row); $data[]=$row; var_dump($id); var_dump($data); $array= implode("|" , $row) ; var_dump($array); foreach( $data as $row ) { $id = $row['id']; $name = $row['name']; var_dump($id); var_dump($name); } } } ?> I hope someone can give a query that executes what is desired, but maybe there is also a possibilty to put the query in a loop? Please help.
×
×
  • Create New...