Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by kyme

  1. I wonder how to reset a root that no need to enter a password. I can't recall anymore my root pw.
  2. I just installed Sequal pro and attempt to connect. I got this popup message. I need help...
  3. So I did this but this is my structure. $query = $conn->prepare("SELECT COUNT(*) AS TotalRows FROM `myTableName`"); $query->execute(); if($query->fetch(PDO::FETCH_OBJ)->TotalRows >0){ echo Btn insert shows } else{ echo btn insert hides } So basically what I want to do is to check the table if it's empty or not. If empty, it shows the button to insert. And if it's not empty, the button(insert) is not visible.
  4. When the table is empty. It will check the table and if it's empty the btn for insertion is visible.
  5. Hi, I was just playing php and try to check if the database is empty. I want to check the DB if it's empty. And if it's not, the button will hide for "Insertion btn". I made some basic understanding of the structure of the code. I don't have a clue of how it will hides/shows the button once the database was checked if it's empty or not. Some comment says that I should use JS to hide and show the button. But I don't have a clue if how to intergrate the btn hide() and show(). What statement should I add to enable to check the db and hide/show the btn? <!DOCTYPE html> <html> <body> <form action="mypractice.php" method="post" enctype="multipart/form-data"> Message: <textarea name='message' rows='3' cols='10'> </textarea><br><br> <button id="insert" type="submit" value="insert sample" name="submit">insert sample</button> </form> <?php //My DB connection require_once('config.php'); //Checks if DB is empty if(empty($conn)) { shows the button if db is empty } else { hides the button if db is not empty } ?> </body> </html>
  6. Oh I didn't notice this. Thanks. It works now.
  7. Yeah. My db is also connected. I'm not sure about the error. But my codes is correct right?
  8. I'm trying to learn.

  9. I was just playing insertion using PDO statement. I just referred this tutorial and test it my code. http://php.net/manual/en/pdo.prepared-statements.php So I did but didn't work. Is there anything I miss? This is my Insertion: https://paste.ofcode.org/dxgTWNKJqcRdPZqvjjrxHf My localhost db is connected and running in localhost. Anyway here is also my config. https://paste.ofcode.org/32LafCUrBbJSiLDAfrQjaWM I wonder why it won't insert in my local db. Did I missed something in my insertion code?
  • 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.