Search the Community

Showing results for tags 'statement'.



More search options

  • 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

Calendars

  • Community Calendar

Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 5 results

  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.
  2. I have the following peace of code. I cant solve how to fetch all the records in the database. I have to use prepare but if I use place holders for $sql then it doesnt work I tried foreach and while but I dont know how to use it. Can someone please tell what code to use to fetch multiple records from a table? <?php // make connection to database $sql = "SELECT id_nr, name FROM table;"; $id_nr =1; if ($stmt = $conn->prepare($sql)) { $stmt->bind_param('i', $id_nr); $stmt->execute(); $stmt->store_result(); $num_of_rows = $stmt->num_rows; $stmt->bind_result($id_nr, $name); while ($stmt->fetch()) { echo ' id number : ' . $id_nr . '<br>'; echo ' name : ' . $name . '<br>'; } $stmt->free_result(); } $stmt->close(); mysqli_close($conn); } ?>
  3. Hello, I have created this code: if (w > maxWidth || h > textHeight) { if (y < x) { [y, y] } else { [x, x] } } else { [value[0], value[1]] } It is a piece, but it gives to understand what I want to optimize without the rest. How to modify this code to work with: Switch Statement instead If/Else mode? This is a expression of After Effects. Thanks.
  4. sql

    In the context of mysql server database or sql , what does the RECEIVE STATEMENT means ?? for example RECEIVE telephone number and email address of the user .
  5. I have this issue with a function where I want to execute 4 different actions inside an if statement. My code looks like this: function deltagare(){var myTextField1 = document.getElementById('namn');var myTextField2 = document.getElementById('epost'); if(myTextField1.value != "" && myTextField2.value != "")document.getElementById("deltagare-list").value+=myTextField1.value+" "+"("+myTextField2.value+")"+"\n",document.getElementById("deltagare-emaillist").value+=myTextField2.value+",",document.getElementById('namn').value="",document.getElementById('epost').value=""; elsealert("Skriv in b├ąde namn och epost!"); } In this way only the first action gets executed. How can I add the other ones properly?