Jump to content

Html

Members
  • Content Count

    595
  • Joined

  • Last visited

Community Reputation

7 Neutral

About Html

  • Rank
    Invested Member
  • Birthday 03/17/1989

Profile Information

  • Gender
    Male
  • Location
    Greater London

Recent Profile Visitors

15,614 profile views
  1. And that example of the delete user, that is only for a specific name. How would I know exactly how to remove a user that is id 4, or 5? Based on that example? Get id, I tried this before for the image upload, the first example. The second example looks like it could work since I have user_id and not id # Get passed product id and assign it to a variable. if ( isset( $_GET['id'] ) ) $id = $_GET['id'] ; # Get passed product id and assign it to a variable. if ( isset( $_GET['user_id'] ) ) $user_id = $_GET['user_id'] ;
  2. For the moment, i am just going to keep going on with this with the example files. I think I'll need to start from the beginning for php 7. But I will have a difficult time with this, I don't think just going to start I will somehow get the hang of this, of where exactly would you be suggesting? I want a change password feature and display only the logged in user's posted message forum.php will be a profile index. Of course that will need to be changed to remove only a logged in user's permission to view it, as it would need to be a public page forum.php?=1 or what ever it will look like.
  3. I didn't do with with maths and language, when I was in education. I think I mentioned this before in a previous topic. So there is a repeating pattern. There have been many people who have tried php and mysql, and never got far with it. I have managed to stick with it, even though I am all over the place with this.
  4. I thought you'd eventually see what I am seeing, you are partly correct, I chase after specific examples to get what I need, I can't go from A-Z. Sure I found a few examples on different sites on sunday, and I tinkered with it. And it worked, if I had done this six months ago, I wouldn't of been here, at least not yet.๐Ÿ™„
  5. DELETE FROM Customers WHERE CustomerName='Alfreds Futterkiste'; This? That isn't an id as such, id would be like 2, 3.
  6. Hmm, okay. What about the mysql code that is needed for a specific id? What I have there is for only a column? Not an actual user which is logged in. In the W3schools, there is no example section on that?
  7. Okay here is the example code as is, So the sql line isn't enough to change to get the logged in user's messages to display only on the forum.php so that is a profile page. It isn't public since it requires only logged in use to view that forum, but it is close enough for now. forum.php?=1 or something, profile.php? <?php # DISPLAY COMPLETE FORUM PAGE. # Access session. session_start() ; # Redirect if not logged in. if ( !isset( $_SESSION[ 'user_id' ] ) ) { require ( 'login_tools.php' ) ; load() ; } # Set page title and display header section. $page_title = 'Forum' ; include ( 'includes/header.html' ) ; # Open database connection. require ( '../connect_db.php' ) ; # Display body section, retrieving from 'forum' database table. $q = "SELECT * FROM forum" ; $r = mysqli_query( $dbc, $q ) ; if ( mysqli_num_rows( $r ) > 0 ) { echo '<table><tr><th>Posted By</th><th>Subject</th><th id="msg">Message</th></tr>'; while ( $row = mysqli_fetch_array( $r, MYSQLI_ASSOC )) { echo '<tr><td>' . $row['first_name'] .' '. $row['last_name'] . '<br>'. $row['post_date'].'</td> <td>' . $row['subject'] . '</td><td>' . $row['message'] . '</td> </tr>'; } echo '</table>' ; } else { echo '<p>There are currently no messages.</p>' ; } # Create navigation links. echo '<p><a href="post.php">Post Message</a> | <a href="shop.php">Shop</a> | <a href="home.php">Home</a> | <a href="goodbye.php">Logout</a></p>' ; # Close database connection. mysqli_close( $dbc ) ; # Display footer section. include ( 'includes/footer.html' ) ; ?>
  8. So the example code is meaningless if edit a snippet of it, because I don't full understand anything about php? That example code is functioning in the user site I have setup. The whole thing was loaded in and bang, done, I've only tried to edit and add to it. Obviously I can't get the function working, so I'm now looking back at trying to display the message from the logged in user on it's own. Just where are the syntax errors, this is the complete code?
  9. Are you referring to $user_id being in black, instead of green like the others. Is it to with the "." and so on? That is all I have changed, just so you know this is exact copy from the source files. $q = "SELECT * FROM forum WHERE id="$user_id" ; It will need a where, as forum alone only displays all messages, so WHERE clause will be needed for the current logged in user viewing the forum.php quite obvious. forum.php is the profile index for any logged in user.
  10. I sent an email to a user on the youtube site who produces tutorials, see what that person has to state about the code. I am not sure what I am going to do if I can get this code working. I also want to have a post message to the profile index, still haven't got that working yet, change password, upload an image to the user profile. And remove data is one of them, as well a directory of new users created, and an inbox and outbox system, and that would be it. So far it is only register, and login using the example code, and using the example code forum. I tried to modify that to display on the logged in user's message. Instead of just all of them who ever posts to a public forum/display message page. <?php # DISPLAY COMPLETE FORUM PAGE. # Access session. session_start() ; # Redirect if not logged in. if ( !isset( $_SESSION[ 'user_id' ] ) ) { require ( 'login_tools.php' ) ; load() ; } # Set page title and display header section. $page_title = 'Forum' ; include ( 'includes/header.html' ) ; # Open database connection. require ( 'connect_db.php' ) ; # Display body section, retrieving from 'forum' database table. $q = "SELECT * FROM forum WHERE id="$user_id" ; $r = mysqli_query( $dbc, $q ) ; if ( mysqli_num_rows( $r ) > 0 ) { echo '<table><tr><th>Posted By</th><th>Subject</th><th id="msg">Message</th></tr>'; while ( $row = mysqli_fetch_array( $r, MYSQLI_ASSOC )) { echo '<tr><td>' . $row['first_name'] .' '. $row['last_name'] . '<br>'. $row['post_date'].'</td> <td>' . $row['subject'] . '</td><td>' . $row['message'] . '</td> </tr>'; } echo '</table>' ; } else { echo '<p>There are currently no messages.</p>' ; } # Create navigation links. echo '<p><a href="post.php">Post Message</a> | <a href="shop.php">Shop</a> | <a href="home.php">Home</a> | <a href="goodbye.php">Logout</a></p>' ; # Close database connection. mysqli_close( $dbc ) ; # Display footer section. include ( 'includes/footer.html' ) ; ?> I haven't a clue if that alone would do this, it can't be that difficult compared to a function delete.๐Ÿค”
  11. I'm no where near there then, besides that is PDO or what ever, I am using php 5. Considering php & Mysql was published in 2012. That code is more useful for if I attempt to learn php 7 from scratch.
  12. Result mode, so now there is more than one mysqli_query to be used, This is certainly new to me.๐Ÿคจ Yeah. Now what.๐Ÿ˜•
  13. <?php # Access session. session_start() ; # Connect to the database. require ('connect_db.php') ; { deleterecord(); // call the function function deleteRecord( $dbc, $q, $r , $user_id) $q = 'DELETE * FROM users WHERE id' = '$user_id'; $r = mysqli_query( $dbc , $q, $user_id ) ; } # Close database connection. mysqli_close( $dbc ) ; ?> Okay, I am probably not going anywhere with this.
  14. I wonder whos head that will be.๐Ÿ˜•
  15. I don't know why I am not using user_id, I haven't a clue. <?php # Access session. session_start() ; # Connect to the database. require ('connect_db.php') ; { deleterecord(); // call the function } function deleteRecord( $dbc, $q, $r ) { $q = 'DELETE * FROM users WHERE id = $user_id'; $r = mysqli_query( $dbc , $q ) ; } # Close database connection. mysqli_close( $dbc ) ; ?>
×
×
  • Create New...