mattm1712
-
Posts
108 -
Joined
-
Last visited
Posts posted by mattm1712
-
-
$t is defined in my index page will try the error thing
-
this is my script,
<?php
include 'connect.inc';
$result4 = mysql_query("SELECT * FROM comments JOIN users on comments.submittedby=users.name WHERE comments.id=$t");
while($row = mysql_fetch_assoc($result4));
{
$to = $row['email'];
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
}
?>
and my tables are
users
------------------------------------------------------
name | email | pass | location
and
comments
------------------------------------------------------
submittedby | title | id | comment
i cant see y its wrong
-
hi i sort of under stand but it doesnt seem to work
i have changed it to
SELECT * FROM comments JOIN users on comments.submittedby=users.nameWHERE comments.id=$t
my tables are
users
------------------------------------------------------
name | email | pass | location
and
comments
------------------------------------------------------
submittedby | title | id | comment
i cant see y its wrong
-
i have been given this code which is wrong because it doent match my databases
but i have never seen this join function before
<?php
$result4 = mysql_query("SELECT * FROM comments JOIN users on comments.submittedby=users.name WHERE comments.id=$t");
while($row = mysql_fetch_assoc($result4));
{
$to = $row['email'];
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
}
?>
in my database i have 2 tables one called 'users' which has titles. name email and pass then i have another one called comments with titles id comments submittedby and title.
i have the varible t$ which will be equal to the id in the comments table, from this i want to selct the submittedby name in the commens table, this wi be the same as the name in the users table, then i want to echo out the email adress.
can anyone help?
-
can u explAIN what this bit is doing so i can understand it a bit more?
SELECT * FROM comments JOIN Users on Comments.Name=Users.NameWHERE Comments.id=$t
-
right i want to select the username from the first table then using that usernamr select the email from another table in my database how would that work?
-
$t is difeined in my index page
<?php
$result4 = mysql_query("SELECT * FROM comments WHERE id=$t");
if($result4) {
$row = mysql_fetch_assoc($result4);
$name = $row['submittedby'];
$query4 = mysql_query("SELECT * FROM user WHERE $name=name");
$row2 = mysql_fetch_assoc($query4);
$email = $row2['email'];
}
$to = '$email';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
-
what i want to do is make an email notification that replies if someone comments on the post
-
im new to php so if this is a stupid question just say so
i have made a comment system where it just posts commentes into a data base with, my data being username, email , comment and a idnumber
say i have a varible $t is post number 120 and a want to get the username from the data base how would i do that?
matt
-
i am making a register page and i want to have a loccation seletor from a drop down menu so it has only preset vaslues? any ideas how i would do it?
-
i know its not the place to ask but can any design me a forum layout page maybe adding a few graphics i have all the coding but i am not so good with the desing part of building a website plz help
matt
-
cheers thats sorted nice one guys
-
hi i have the code
$date = date("d-M-Y",$array['date']);
i am echoing out the date correctly but i want to echo the time aswel but not sure how i have tried
$date = date("d-M-Y",time(),$array['date']);
but no luck can any1 help?
cheers matt
-
theres 8 but it repeats the last 1
-
ok cheers for that i have that bit working, but it posts the latest post 8 times instead of posting the latest 10?
-
i need a code that posts the latest 10 title in the database
i have this but i know its wrong
<?php
include 'connect.inc';
echo "recent posts";
$recent = mysql_query("SELECT * FROM comments ORDER BY date DESC LIMIT 10");
$array = mysql_fetch_assoc($recent);
$post_title = $array['tilte'];
while($array = mysql_fetch_assoc($recent))
{
echo "$post_tilte";
}
?>
-
hi im pretty new to php have been teaching myself, i have come to a problem
i have an index page where i have 4 variables 1 2 3 4 each with include pages in so i click a link in my menu and it changes the body page to 1 of the 4 variables, but now i want to create a page with varibale in.
so i say i click a link on my index page its goes to index.php?variable=2 but on that page i want titles where u click them and it loads a page within that page.
does any1 understand? lol
please help
matt
-
hi i try using this code but i get this error
Parse error: syntax error, unexpected $end in /home/sites/moseleyengineering.co.uk/public_html/matt/newpass.php on line 45
normally when i get errors like this i have missed brackets out but your code looks fine
-
can any1 help me this script just guves me a blank scrren i had it working then i add the bit where it tells the user there password has changed now it doesnt work plz help
<?php
session_start();
$user = $_SESSION['user'];
If ($user)
if ($_POST['submit'])
{
$oldpassword = md5($_POST['oldpassword']);
$newpassword = md5($_POST['newpassword']);
$repeatnewpassword = md5($_POST['repeatnewpassword']);
echo "$oldpassword/$newpassword/$repeatnewpassword";
include 'connect.inc';
$queryget = mysql_query("SELECT pass FROM users WHERE name='$user'");
$row = mysql_fetch_assoc($queryget);
echo $oldpassworddb."<br>";
echo $oldpassword."<br>";
$oldpassworddb =$row['password'];
if ($oldpassword==$oldpassworddb)
{
if ($newpassword==$repeatnewpassword)
{
echo "pass changed";
}
else
die("pass dont match!");
}
else
{
echo"
<form action='newpass.php' method='POST'>
Old password: <input type='text' name='oldpassword'><br>
New password: <input type='password' name='newpassword'><br>
Repeat password: <input type='password' name='repeatnewpassword'><br>
<input type='submit' name='submit' value='change password'>
</form>
";
}
}
?>
-
sorry i cant pay anyone but need a simple commmenst board making, it needs the be able to post comments and then reply to the, if u dont understand message me please help
-
this is the error im getting
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/sites/moseleyengineering.co.uk/public_html/matt/delete.inc on line 28
which is
$sql = "DELETE FROM comments WHERE id=$_GET['id']";
-
hi i have tried that but no luck
cheers tho
-
hi this script deosnt work i cantunderstand y?
these are the 3 coloums in my database
id
comments
submittedby
this is the code
<?php
$dbusername="web123-matt";
$dbpassword="matt";
$dbdatabase="web123-matt";
mysql_connect(localhost,$dbusername,$dbpassword);
mysql_select_db("comments");
if(!isset($_GET['cmd']))
{
$result = mysql_query("select id, comments, submittedby FROM comments ORDER BY id");
while($r = mysql_fetch_assoc($result))
{
$id = $r['id'];
$comments = $r['comments'];
$submittedby = $r['submittedby'];
echo "<a href='delete.php?cmd=delete&id=$id'>$submittedby - Delete</a>";
echo "<br>";
}
}
elseif(isset($_GET['cmd']))
{
if($_GET["cmd"]=="delete" && (isset($_GET['id']) && is_numeric($_GET['id'])))
{
include 'connect.inc';
$sql = "DELETE FROM comments WHERE id=$id";
$result = mysql_query($sql);
echo "Row deleted!";
}
}
?>
-
yeah i have i have
id
comments
submittedby
this is the code
<?php
$dbusername="web123-matt";
$dbpassword="matt";
$dbdatabase="web123-matt";
mysql_connect(localhost,$dbusername,$dbpassword);
mysql_select_db("comments");
if(!isset($_GET['cmd']))
{
$result = mysql_query("select id, comments, submittedby FROM comments ORDER BY id");
while($r = mysql_fetch_assoc($result))
{
$id = $r['id'];
$comments = $r['comments'];
$submittedby = $r['submittedby'];
echo "<a href='delete.php?cmd=delete&id=$id'>$submittedby - Delete</a>";
echo "<br>";
}
}
elseif(isset($_GET['cmd']))
{
if($_GET["cmd"]=="delete" && (isset($_GET['id']) && is_numeric($_GET['id'])))
{
include 'connect.inc';
$sql = "DELETE FROM comments WHERE id=$id";
$result = mysql_query($sql);
echo "Row deleted!";
}
}
?>
but its works fine but when i go back to the comments its still there and hasnt been deleted
I CANT UNDERSTAND Y THIS IS NOT WORKING CAN ANY1 HELP? PLZ
in PHP Coding Help
Posted
i have switched error reporting on it says,
Use of undefined constant localhost - assumed 'localhost' in /home/sites/moseleyengineering.co.uk/public_html/matt/connect.inc on line 6
No recipient addresses found in header