hoponhiggo Posted April 28, 2011 Author Share Posted April 28, 2011 Its not going to well... i am getting an error on my login page: Fatal error: Call to undefined function: getsqlvaluestring()..... on line 23 Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted April 28, 2011 Share Posted April 28, 2011 Ooops, I crumpled the php tags at the top when I coppied it over, change the top two lines to this and you'll be back to where it was when it was working: <?php require_once('Connections/pwnedbook.php'); ?> <?php if (!function_exists("GetSQLValueString")) { Quote Link to comment Share on other sites More sharing options...
hoponhiggo Posted April 28, 2011 Author Share Posted April 28, 2011 ok, so thats worked. But im not getting an error when trying to post a message: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/chiggo12/public_html/test/insertarNoticia.php:3) in /home/chiggo12/public_html/test/insertarNoticia.php on line 7 any ideas? Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted April 28, 2011 Share Posted April 28, 2011 You have a header (probably redirect) that you are trying to call after there has been information returned to the browser (characters sent back to the screen). Quote Link to comment Share on other sites More sharing options...
hoponhiggo Posted April 28, 2011 Author Share Posted April 28, 2011 Muddy I have had a number of problems trying to get the code you kindly provided to work, but i have manged to take bits of it and mix it with bits i already had to get things to a stage which is further on from my original post! I now have a message posting system which displays the message on my homepage and posts a message id, message text and userid to my database which i believe is ideal. I am still having the original problem tho of displaying only the profile pic of the user who posted the message. The code to display the message and send the data to the database is now: <?php //initialize the session if (!isset($_SESSION)) { session_start(); } include("db.php"); // if content has been sent if(isset($_POST["textarea_noticia"])){ $msg = $_POST["textarea_noticia"]; $username = $_SESSION['MM_Username']; $userid = $_SESSION['MM_userid']; // Insert information $sql = mysql_query("INSERT INTO messages(message,username,id_fk)values('$msg','$username','$userid')"); $result = mysql_query("SELECT * FROM messages order by msg_id desc"); $row = mysql_fetch_assoc($result); $id = $row["msg_id"]; $msg = $row["message"]; } ?> The following code is used to display the profile pic of the user that is logged in <?php //to display image from source $dir = "profpics"; $sql = "SELECT prof_pic FROM users WHERE username = '{$_SESSION['MM_Username']}'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0) die("Username not found in database."); $row = mysql_fetch_array($res); echo "<img src='$dir/{$row['prof_pic']}' width='38' height='38'><br>"; ?> Can this, inparticular the "SELECT prof_pic FROM users WHERE username = '{$_SESSION['MM_Username']}'" just be changed from who is logged in, to who posted the message?? Im sorry if this has gone in a massive circle!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.