Jump to content

jackcoder

New Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by jackcoder

  1. Hello, I have an error on multiple pages which looks much like this. If anyone can help that would be gratefully appreciated. I would also like to ask if you may give me an explanation as to why it is occurring and not just a solution. Also when I take the second header out the error disappears. Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\blog\blog_display_post.php:47) in C:\xampp\htdocs\blog\comments.php on line 49 Here is my code: if(strlen($email) > 5){ mysqli_query($con, "INSERT INTO emails (email) VALUES ('$email')"); mysqli_query($con, "INSERT INTO comments (com_name, com_com, com_date, com_blog) VALUES ('$name', '$comment', '$date', '$postid')"); header("Location: index.php"); }else{ mysqli_query($con, "INSERT INTO comments (com_name, com_com, com_date, com_blog) VALUES ('$name', '$comment', '$date', '$postid')"); header("Location: index.php"); } } }
  2. changed code to: $conn = mysql_connect("localhost", "root", "", "users"); $data = mysql_query("SELECT * FROM users") or die(mysql_error()); $info = mysql_fetch_assoc($data); echo $info['user_name'];
  3. hello I keep getting these errors: Warning: mysql_query() expects parameter 2 to be resource, string given in C:\xampp\htdocs\PHP & JQUERY\WEBSITE\index.php on line 17 Warning: mysql_fetch_assoc() expects parameter 1 to be resource, null given in C:\xampp\htdocs\PHP & JQUERY\WEBSITE\index.php on line 19 This is the code I am using: $conn = mysql_connect("localhost", "root"); $q = "SELECT * FROM users"; $r = mysql_query($conn, $q); $retrieve = mysql_fetch_assoc($r); print $retrieve['user_name']; Any help would be appreciated.
×
×
  • 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.