contra10
-
Posts
402 -
Joined
-
Last visited
Never
Posts posted by contra10
-
-
-
coming from url
if(is_numeric($_GET['user'])){ $idp = $_GET['user']; }
-
$updel is the post id as the post id is withrawn from the query in the while satement, ...should the if statement be in the while brackets?
-
the id in the query as you stated gets all the posts that have been stated towards that user...I have created the abilitiy for the user to erase all of his/her post. But how about if i wanted to allow the user to delete specific post?
-
hi i'm trying to allow my users to delete post while in a while statement
heres my code
<form action="" method="get" enctype="application/x-www-form-urlencoded"> <table border= "1" id="results"> <?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); //This is your query again, the same one... the only difference is we add $max into it $data_p = "SELECT * FROM post_profile WHERE userid = '$idp' ORDER BY ppid DESC"; $posts = mysql_query($data_p) or die(mysql_error()); //This is where you display your query results while($info = mysql_fetch_array($posts)) { $userpost= "{$info['post']}"; $updel= "{$info['ppid']}"; $usernamep= "{$info['postingusername']}"; $userdate= "{$info['datepost']}"; $text = ($userpost); $newtext = wordwrap($text, 30, "<br />\n",true); if(isset($_POST['deletep'])){ $deletem= "DELETE FROM `post_profile` WHERE `ppid` = '$updel'"; $deletemessage = mysql_query($deletem) or die(mysql_error()); } echo"<tr><td></td></tr>"; echo" <tr><td>$newtext</td></tr>"; echo" <tr><td><FONT size='1'>Posted by $usernamep on $userdate</FONT></td><td>"; ?> <form action='<?php echo $_SERVER['PHP_SELF']; ?>' method='post'> <input type='submit' name='deletep' value='delete'> </form> <?php echo"</td></tr>"; } ?>
-
your certainly right ken...and after searching and searching...i finally decided to start from the beginning and i found the problem...i was 1 letter of in my query...now i have a heache...lol thanks
-
my statment shows but i get error with this
<?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); $queryi = "SELECT * FROM `users_should_comment` WHERE `username` = '$usernamec'"; $resulti = mysql_query($queryi); if($comcount = mysql_num_rows($resulti)){ while($rowid = mysql_fetch_assoc($resulti)) { $com= "{$rowid['comment']}"; $cname= "{$rowid['cusername']}"; echo"$cname thinks that $username should $com"; } }else{ echo "no comments have been made to this user"; } ?>
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\profile\index.php on line 205
-
for the css you can save your css as filename.css and link using this code
<link href="filename.css" rel="stylesheet" type="text/css" />
that of course has to be placed in your head then you can place your divs in the php document
i guess your trying to make the images show
are you doing "<img src='src'>" inside php or regular html?
-
or how can i place the else statement so that if there is nothing to query it shows that comment
-
im trying to get my else statement to work if there is nothing in the query
<?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); $queryi = "SELECT * FROM `users` WHERE `username` = '$usernamec'"; $resulti = mysql_query($queryi); if($comcount = mysql_num_rows($resulti)){ while($rowid = mysql_fetch_assoc($resulti)) { $com= "{$rowid['comment']}"; $cname= "{$rowid['cusername']}"; echo"$cname thinks $com"; } }else{ echo "no comments have been made"; } ?>
theres nothing in my query so the second line should show but it shouws the first echo without the variables present
-
<?php // this makes sure both passwords entered match if ($_POST['a'] != "$secreta") { die("Your answer did not match. Please <a href='http://localhost/validation/renew.php?id=$id'>try again! </a> "); } ?>
still didn't work
-
i'm trying to check if my user has entered the same answer as the answer for security question
<?php if (isset($_POST['submit'])) { mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); //This makes sure they did not leave any fields blank if (!$_POST['a'] | !$_POST['pass'] | !$_POST['pass2']) { die('You did not complete all of the required fields'); } // this makes sure both passwords entered match if ($_POST['a'] != $secreta) { die("Your answer did not match. Please <a href='http://localhost/validation/renew.php?id=$ida'>try again! </a> "); } // this makes sure both passwords entered match if ($_POST['pass'] != $_POST['pass2']) { die('Your passwords did not match. '); } // here we encrypt the password and add slashes if needed $_POST['pass'] = encrypt($_POST['pass']); if (!get_magic_quotes_gpc()) { $_POST['pass'] = addslashes($_POST['pass']); $_POST['username'] = addslashes($_POST['username']); } $pass = mysql_real_escape_string($_POST['pass']); // now we insert it into the database $insert = "UPDATE `users` SET `password` = '$pass' WHERE `username`='$username'"; $add_update = mysql_query($insert); ?> You can now <a href="http://localhost/">login</a> <?php } else { ?> You are almost finish renewing your password<br> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> Please answer your question?<br><?php echo "$secretq $secreta";?><br> Answer:<br> <input type="a" name="a" maxlength="60" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;"><br> Username:<br> <input type="text" name="username" maxlength="60" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;"><br> New Password:<br> <input type="password" name="pass" maxlength="10" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;"><br> Confirm Password:<br> <input type="password" name="pass2" maxlength="10" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;"><br> <input type="submit" name="submit" value="Update"/> </form> <?php } ?>
i keep getting the die statement at this point
<>php // this makes sure both passwords entered match if ($_POST['a'] != $secreta) { die("Your answer did not match. Please <a href='http://localhost/validation/renew.php?id=$ida'>try again! </a> "); } ?> but i did the query and its getting answer and what i enter in the form is the same
-
i'm trying to check if my user has entered the same answer as the answer for security question
<?php if (isset($_POST['submit'])) { mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); //This makes sure they did not leave any fields blank if (!$_POST['a'] | !$_POST['pass'] | !$_POST['pass2']) { die('You did not complete all of the required fields'); } // this makes sure both passwords entered match if ($_POST['a'] != $secreta) { die("Your answer did not match. Please <a href='http://localhost/validation/renew.php?id=$ida'>try again! </a> "); } // this makes sure both passwords entered match if ($_POST['pass'] != $_POST['pass2']) { die('Your passwords did not match. '); } // here we encrypt the password and add slashes if needed $_POST['pass'] = encrypt($_POST['pass']); if (!get_magic_quotes_gpc()) { $_POST['pass'] = addslashes($_POST['pass']); $_POST['username'] = addslashes($_POST['username']); } $pass = mysql_real_escape_string($_POST['pass']); // now we insert it into the database $insert = "UPDATE `users` SET `password` = '$pass' WHERE `username`='$username'"; $add_update = mysql_query($insert); ?> You can now <a href="http://localhost/">login</a> <?php } else { ?> You are almost finish renewing your password<br> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> Please answer your question?<br><?php echo "$secretq $secreta";?><br> Answer:<br> <input type="a" name="a" maxlength="60" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;"><br> Username:<br> <input type="text" name="username" maxlength="60" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;"><br> New Password:<br> <input type="password" name="pass" maxlength="10" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;"><br> Confirm Password:<br> <input type="password" name="pass2" maxlength="10" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;"><br> <input type="submit" name="submit" value="Update"/> </form> <?php } ?>
i keep getting the die statement at this point
<>php // this makes sure both passwords entered match if ($_POST['a'] != $secreta) { die("Your answer did not match. Please <a href='http://localhost/validation/renew.php?id=$ida'>try again! </a> "); } ?> but i did the query and its getting answer and what i enter in the form is the same
-
i have iframes going across my page and i want it so that after 3-4 irames my next table drops down a row instead of continuing on the same row and thus creating a scroll bar at the bottom of the page
<table border="0" align="left"><tr><td> <b>Picture Rating</b><br> <iframe src="http://localhost/settings/ratings.php" height="200" scrolling="no" frameborder="0"> </iframe> <tr><td></table> <table border="0" align="left"><tr><td> <b>Edit Information</b><br> <iframe src="http://localhost/settings/infoedit.php" height="400" scrolling="no" frameborder="0"> </iframe> </td></tr></table> <table border="0" align="left"><tr><td> <b>Email</b><br> <iframe src="http://localhost/settings/emailupdate.php" height="400" scrolling="no" frameborder="0"> </iframe> </td></tr></table> <table border="0" align="center"><tr><td> <b>Security Question</b><br> <iframe src="http://localhost/settings/secretupdate.php" height="400" scrolling="no" frameborder="0"> </iframe> </td></tr></table>
i basically want to set page rulers
-
yep the query shows the result i need
-
any websites that can help?
-
I'm trying to send an email dynamically based on what is has been put in the database
i've tried this
<?php $f= "SELECT * FROM `users` WHERE `username` = '$usernamef'"; $fr = mysql_query($f) or die(mysql_error()); while ($fri = mysql_fetch_assoc($fr)) { $email = "{$fri['email']}"; } $to = "$email"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "someonelse@example.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); ?>
and i've even tried to pull it from the form
<?php while ($fri = mysql_fetch_assoc($fr)) { $emailed = "{$fri['email']}"; } $email = $_REQUEST['email'] ; $to = $fri['email']; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "someonelse@example.com"; $headers = "From: $from"; mail($email,$subject,$message,$headers); ?> <h6>A request has been sent</h6> <p>Thank you<?php "<a href= 'http://localhost/friendrequest/index.php?user='</a>Main"?></p> <?php } else { ?> <?php echo"$email";?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table border="0" width="500" align="center" height="100"> <tr> <td align="right"><?php echo "<input type='hidden' name='requestid' value='$useridf'>";?></td></tr> <td align="right"><?php echo "<input type='hidden' name='requestname' value='$usernamef'>";?></td></tr> <td align="right"><?php echo "<input type='hidden' name='email' value='$emailed'>";?></td></tr> <td align="right"><input type="submit" name="add" value="Add Friend"></td></tr> </table> </form> ?>
neither worked
however if i did this
<?php $to = "me@something.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "someonelse@example.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); ?>
it would work...i've noticed that when i put a variable in place of $to that is being drawn from the db it doesn't work...it only works when i actually write in the email...but the code is suppost to be dynamic and reflective of the user logged in
my question is how to i make the $to reflect the person who i'm sending to
-
i just tried it like that and it worked
-
$email should reflect the person that i'm sending it to.
-
i'm testing mail on local host
here is my coding that works
<?php $headers = "From: me@worldnwired.com\r\n"; "To: $email"; "MIME-Version: 1.0\r\n"; "Content-Type: multipart/mixed;\r\n"; $body = "$username has added you as a friend"; mail("me@test.com","Friend Request",$body, $headers); ?>
here is the coding when i want to change the send to the user
<?php $friende= "SELECT * FROM `users` WHERE `username` = '$usernamef'"; $friendgetemail = mysql_query($friende) or die(mysql_error()); while ($friendemail = mysql_fetch_assoc($friendgetemail)) { $email = "{$friendemail['email']}"; } $headers = "From: me@worldnwired.com\r\n"; "To: $email"; "MIME-Version: 1.0\r\n"; "Content-Type: multipart/mixed;\r\n"; $body = "$username has added you as a friend"; mail($email,"Friend Request",$body, $headers); ?>
the warning is
Warning: mail() [function.mail]: SMTP server response: 500 please set from & to first... in C:\wamp\www\friendrequest\index.php on line 71
line 71 being
mail($email,"Friend Request",$body, $headers);
how do i echo the person's email instead of writting it in
-
i tried taking it out of $body variable and just leaving it in quotes but that didn;t work
-
ok that worked for "from"
<?php <?php $headers = "From: me@test.com\r\n". "To: $email". "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n"; $body="$username has added you as a friend"; mail("me@test.com","Friend Request",$body, $headers); ?>
how about body
-
im testing my email using postcast server free...
im using this code
<?php $headers = "From:me@test.com\r\n". "To:$email". "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n"; $body="$username has added you as a friend"; mail("me@test.com","Friend Request",$body, $headers); ?>
the "to" and "subject" shows but i cant view the body and i can't view the from
-
...arg...i shouldn't have went with WAMP
k so the smtp is the problem as i get this
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\forum\addtopic.php on line 65
so i have to run on same port as an smtp...i'm going to dl one...any suggestions
[SOLVED] having trouble deleting from mysql
in PHP Coding Help
Posted
I'm trying to delete an event in a query the problem is i can't find the problem as the form goes through and shows no errors yet the event is still present