Jump to content

Html

Members
  • Content Count

    458
  • Joined

  • Last visited

Community Reputation

7 Neutral

1 Follower

About Html

  • Rank
    Member
  • Birthday 03/17/1989

Profile Information

  • Location
    Greater London

Recent Profile Visitors

13,749 profile views
  1. Html

    user id

    Yes a user will post a comment to forum table, and the session id will retrieve that user's comment and display it on the index, so just like the name is stored in the users table.
  2. Html

    user id

    Well I actually took a look at the comment files, and I can post to the table without having needed to be logged in, so like the profile name, it would need to have some kind of code that identifies a user with a control panel page, so when posting a comment it works for that index page of the registered user. Having thought about it what with little I know and have, I can't see how it could be done, other than having numerous tables for a new user's name. Obviously I'm getting ahead of what I have been trying to do, but I just thought I'd think into it a little to see how it could be done.
  3. Html

    Finding Forums

    Definitely needs changing.
  4. Html

    user id

    I guess this will be a similar process for a comment posting to the db, which I have from the example file of the book I have on creating a forum. Similar process to display a comment on a session user id page
  5. Html

    user id

    <?php ini_set('display_errors', 1); error_reporting(E_ALL); # Access session. session_start() ; $user_id = $_SESSION['user_id']; # Redirect if not logged in. if ( !isset( $_SESSION[ 'user_id' ] ) ) { require ( 'login_tools.php' ) ; load() ; } if (isset( $user_id )) { echo '<div>We have a green light that $user_id is set and has a value <div style="width:1em; height: 1em; display: inline-block; background: lime;"></div> and equals: ' . $user_id . '</div>'; } else { echo 'We have a red light that $user_id is set, but has NO VALUE <div style="width:1em; height: 1em; display: inline-block; background: red;"> and equals: ' . $user_id . ' </div>'; } # On success retrieve user_id, first_name, and last name from 'users' database. if ( empty( $errors ) ) { $user_id = "SELECT user_id, first_name, last_name FROM users WHERE user_id='$user_id'" ; $r = mysqli_query ( $user_id, $q ) ; if ( @mysqli_num_rows( $r ) == 1 ) $row = mysqli_fetch_array ( $r, MYSQLI_ASSOC ) ; echo '<tr><td>' . $row['first_name'] .' '. $row['last_name'] . '<br>'. '</td> </tr>'; echo '</table>' ; } $r = mysqli_query ( $user_id ); ?>
  6. Html

    user id

    Web connection is back, it was down for the weekend. Right okay, I read what you stated in the post, <?php ini_set('display_errors', 1); error_reporting(E_ALL); # Access session. session_start() ; $user_id = $_SESSION['user_id']; if (isset( $user_id )) { echo '<div>We have a green light that $user_id is set and has a value <div style="width:1em; height: 1em; display: inline-block; background: lime;"></div> and equals: ' . $user_id . '</div>'; } else { echo 'We have a red light that $user_id is set, but has NO VALUE <div style="width:1em; height: 1em; display: inline-block; background: red;"> and equals: ' . $user_id . ' </div>'; } # Redirect if not logged in. if ( !isset( $_SESSION[ 'user_id' ] ) ) { require ( 'login_tools.php' ) ; load() ; } # On success retrieve user_id, first_name, and last name from 'users' database. if ( empty( $errors ) ) { $user_id = "SELECT user_id, first_name, last_name FROM users WHERE user_id='$user_id'" ; $r = mysqli_query ( $user_id, $q ) ; if ( @mysqli_num_rows( $r ) == 1 ) $row = mysqli_fetch_array ( $r, MYSQLI_ASSOC ) ; echo '<tr><td>' . $row['first_name'] .' '. $row['last_name'] . '<br>'. '</td> </tr>'; echo '</table>' ; } $r = mysqli_query ($dbc, $q); ?> Why does 29 display, something wrong with row?
  7. Html

    user id

    Notice: Undefined variable: q on line 22 mysqli_query() expects parameter 1 to be mysqli, string given on line 22 Undefined variable: row on line 29 Undefined variable: dbc on line 36 Undefined variable: q on line 36 mysqli_query() expects parameter 1 to be mysqli, null give on line 36 <?php ini_set('display_errors', 1); error_reporting(E_ALL); # Access session. session_start() ; # Redirect if not logged in. if ( !isset( $_SESSION[ 'user_id' ] ) ) { require ( 'login_tools.php' ) ; load() ; } $user_id = $_SESSION['user_id']; if (isset( $user_id )) { echo '<div>We have a green light that $user_id is set and has a value <div style="width:1em; height: 1em; display: inline-block; background: lime;"></div> and equals: ' . $user_id . '</div>'; } else { echo 'We have a red light that $user_id is set, but has NO VALUE <div style="width:1em; height: 1em; display: inline-block; background: red;"> and equals: ' . $user_id . ' </div>'; } # On success retrieve user_id, first_name, and last name from 'users' database. if ( empty( $errors ) ) { $user_id = "SELECT user_id, first_name, last_name FROM users WHERE user_id='$user_id'" ; $r = mysqli_query ( $user_id, $q ) ; if ( @mysqli_num_rows( $r ) == 1 ) $row = mysqli_fetch_array ( $r, MYSQLI_ASSOC ) ; echo '<tr><td>' . $row['first_name'] .' '. $row['last_name'] . '<br>'. '</td> </tr>'; echo '</table>' ; } $r = mysqli_query($dbc, $q); ?>
  8. Html

    user id

    I was trying to edit the file on the free host, but got logged out, couldn't connect to line on socket.
  9. Html

    user id

    Notice: Undefined variable: user_id on line 13 Warning: mysqli_query() expects at least 2 parameters, 1 given on 14 Notice: Undefined variable: row on line 21 If I remove the comma, the error messages appear ( $user_id, ) And whether user_id or first name doesn't make any difference. I changed it back to first name.
  10. Html

    user id

    $row['user_id'] .' '. The errors before tinkering with it were, lines 21, and 13, and 14. $r = mysqli_query ( $user_id, ) ; Once I changed them, the blank page was displayed. From the column in the db? email is just that email, user_id is exactly that as the image in the top post displays. Unless you are getting at the fact that there is no underscore in the actual column name?
  11. Html

    user id

    I managed to try out the file, web host is back up since last week, so yes, I tried out, and a bunch of errors, I tried tickering with it, and got this result, but yes it doesn't do what it should. <?php ini_set('display_errors', 1); error_reporting(E_ALL); # Access session. session_start() ; # Redirect if not logged in. if ( !isset( $_SESSION[ 'user_id' ] ) ) { require ( 'login_tools.php' ) ; load() ; } # On success retrieve user_id, first_name, and last name from 'users' database. if ( empty( $errors ) ) { $user_id = "SELECT user_id, first_name, last_name FROM users WHERE email='$user_id'" ; $r = mysqli_query ( $user_id, ) ; if ( @mysqli_num_rows( $r ) == 1 ) $row = mysqli_fetch_array ( $r, MYSQLI_ASSOC ) ; echo '<tr><td>' . $row['user_id'] .' '. $row['last_name'] . '<br>'. '</td> </tr>'; echo '</table>' ; } ?>
  12. Html

    user id

    Okay, I will respond as soon as the free host is up again, there appears to be downtime. At least I have got this corrected, partially. Thanks
  13. Html

    user id

    <?php ini_set('display_errors', 1); error_reporting(E_ALL); # Access session. session_start() ; # Redirect if not logged in. if ( !isset( $_SESSION[ 'user_id' ] ) ) { require ( 'login_tools.php' ) ; load() ; } # On success retrieve user_id, first_name, and last name from 'users' database. if ( empty( $errors ) ) { $q = "SELECT user_id, first_name, last_name FROM users WHERE email='$user_id'" ; $r = mysqli_query ( $dbc, $q ) ; if ( @mysqli_num_rows( $r ) == 1 ) $row = mysqli_fetch_array ( $r, MYSQLI_ASSOC ) ; echo '<tr><td>' . $row['first_name'] .' '. $row['last_name'] . '<br>'. '</td> </tr>'; echo '</table>' ; } mysqli_close($dbc); ?> Okay the official php checker has given an okay with this.
  14. Html

    user id

    Sure, I don't know the syntax and spacing of the code, as I found out when I typed out the forum tutorial page for page, and then you got me the files. So I got somewhere with that. Okay, the code to get this to work is missing, and incorrect. Then this isn't quite as simple as I thought, you stated you left certain clues about the select query part. <?php ini_set('display_errors', 1); error_reporting(E_ALL); # Access session. session_start() ; # Redirect if not logged in. if ( !isset( $_SESSION[ 'user_id' ] ) ) { require ( 'login_tools.php' ) ; load() ; } # On success retrieve user_id, first_name, and last name from 'users' database. if ( empty( $errors ) ) { $q = "SELECT user_id, first_name, last_name FROM users WHERE email='$user_id'" ; $r = mysqli_query ( $dbc, $q ) ; if ( @mysqli_num_rows( $r ) == 1 ) { $row = mysqli_fetch_array ( $r, MYSQLI_ASSOC ) ; { echo '<tr><td>' . $row['first_name'] .' '. $row['last_name'] . '<br>'. '</td> </tr>'; echo '</table>' ; } mysqli_close($dbc); ?> Not sure if that edit works.
  15. Html

    user id

    <?php $page_title = 'forum' include('includes/header.html'); require ('\connect_db.php'); $sql = 'SELECT * FROM forum'; $result = mysql_query($dbc, $sql); if ( mysqli_num_rows($result)>0) { echo '<table><tr><th>Posted By</th> <th>Subject</th><th id="msg">Message</th></tr>'; while ($rows=mysqli_fetch_array($result, MYSQLI_ASSOC)) { echo '<tr><td>'. $row['first_name'].''. $row['last_name'].'<br>'. $row['post_date'].'</td><td>'. $row['subject'].''. $row['message'].''. } echo'</table>'; else { echo '<p>There are currently no messages.</p>'; } echo'<p><a href="post.php">Post Message</a></p>'; mysqli_close($dbc); incluide('includes/footer.html'); ?> According to the forum code, there is one of those curly braces just under echo. if ( empty( $errors ) ) { $q = "SELECT user_id, first_name, last_name FROM users WHERE email='$user_id'" ; $r = mysqli_query ( $dbc, $q ) ; if ( @mysqli_num_rows( $r ) == 1 ) { $row = mysqli_fetch_array ( $r, MYSQLI_ASSOC ) ; { echo '<tr><td>' . $row['first_name'] .' '. $row['last_name'] . '<br>'. '</td> </tr>'; } { echo '</table>' ; } ?> So this bottom part of profile was missing one of those, from your hint.
×