Jump to content

kyme

Members
  • Content count

    28
  • Joined

  • Last visited

Community Reputation

0 Neutral

About kyme

  • Rank
    Member

Profile Information

  • Gender
    Not Telling
  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'm confuse. how to check that?
  3. I just installed Sequal pro and attempt to connect. I got this popup message. I need help...
  4. 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.
  5. When the table is empty. It will check the table and if it's empty the btn for insertion is visible.
  6. 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>
  7. kyme

    Why my basic insertion won't work?

    Oh I didn't notice this. Thanks. It works now.
  8. kyme

    Why my basic insertion won't work?

    Yeah. My db is also connected. I'm not sure about the error. But my codes is correct right?
  9. I'm trying to learn.

  10. 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?
  11. I'm trying to display a data from DB using mysqli. I'm not sure if I'm doing it right, my concern was secure. Am I doing it right? <?php include_once('user.php'); // Inialize session session_start(); $con=mysqli_connect("localhost","root","root","dbname"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($con,"SELECT aboutme FROM testing where id=1"); if ($result) { if ($row = mysqli_fetch_array($result, MYSQL_ASSOC)) { $aboutme = $row['aboutme']; } } mysqli_close($con); ?>
×

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.