Jump to content

Search the Community

Showing results for tags 'mysqli_query'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


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

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Found 2 results

  1. Hi, I have a mysqli_query that goes like this: $result = mysqli_query($db, "INSERT INTO device(`Identifier`, `IsAllowedToPost`)VALUES('ABC123', 0)") or die(error_log(mysqli_error($db), 3, "php_error.log")); It does not work and the logs either tells me "1", "0" or nothing depending on which method I try to log the error with. How can I get a better error message to log in my file? 1 or 0 means nothing to me. The current code gives me no error message at all in my file and the data does not get stored in the database.
  2. AlexC

    mysqli_query problem

    As the query works fine in phpMyAdmin or MySQL workbench, I am assuming at present it is a php problem. I have the following code being used to uniquely identify a person from a form entry, if (mysqli_connect_errno($condb)) { echo 'Failed to connect to MySQL: ' . mysqli_connect_error(); } else {echo 'connected';} //****debug 1 $firstname = preg_replace('/[^a-zA-Zs]/', '', $_POST['idfirstname'] ); $lastname = preg_replace('/[^a-zA-Zs]/', '', $_POST['idlastname'] ); $streetno = preg_replace('/[^0-9s]/', '', $_POST['idhouseno'] ); $telephone = preg_replace('/[^0-9s]/', '', $_POST['idtelephone'] ); // echo '<br>'.$firstname.', '.$lastname.', '.$streetno.', '.$telephone; //****debug 2 $query="SELECT .....;"; echo '<br><b>Query for user id:</b> <br>'.$query; //****debug 3 $result = mysqli_query($condb,$query); $count = mysqli_num_rows($result); echo '<br><b> row count:</b>'.$count.' - result: '.$result. '!'; //****debug 4 // -------------------------------------------------------------------------------------------------------------- // Check for unique data /* if($count == 1) { // unique ID successfull while($row = mysqli_fetch_array($resultA)) { ...... Code was working fine this morning and I was refining the code further on and adding other extraction options in new pages based on having a unique identification. However it has suddenly stopped working. Other parts of the site, not relying on this identification are working fine. Debug point 1 comes up fine as 'connected', the data at debug 2 is fine and if I cut and paste the query output in the browser from debug point 3 into phpMyAdmin or mySQL workbench, no problems, I get the results expected. However debug point 4 does not materialise. If I comment out the line $result = mysqli_query($condb,$query); debug 4 comes up, but obviously not with any results. I'm using Aptana workbench and that is not flagging any syntax errors. I have tried rewriting the line and cut and pasted a similar mysqli_query line from other pages where it is working in case a funny character had got into the code, but to no effect. As I have lots of other similar code instances still working fine, this is causing some frustration. Any ideas on what I am hoping is an obvious error that I just can't see, very much appreciated.
  • Create New...