Jump to content

kenrbnsn

Staff Alumni
  • Posts

    8,234
  • Joined

  • Last visited

Everything posted by kenrbnsn

  1. Do you want to style the link to look like a button? If so see http://webdesign.about.com/od/css/a/aa041904.htm Ken
  2. What do you mean by " that doesn't seem to work so far." What is happening or not happening? Ken
  3. These two lines <?php mysql_connect($mysql['host'],$ mysql['username'],$mysql['password']); ?> should be written as one line <?php mysql_connect($mysql['host'],$mysql['username'],$mysql['password']); ?> Ken
  4. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=331038.0
  5. You're problem stem from the fact that in some fonts a "1" looks like a "l" (small el). In your form you have the name "i1Text", but you test form $_POST['ilText'] Either change the 1 to a "l" or change the "l" to a 1 Ken
  6. This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=331097.0
  7. Please spell your words. This isn't Twitter, you can write as many characters as you need. Ken
  8. Without seeing your code, it's hard to determine the cause. If you post the code, please put it between tags. This could happen if your web server isn't configured to handle PHP. Also how are you invoking the first script? It needs to be invoked via a URL. Ken
  9. As for the mysql error, that is tell you that your username and/or password is incorrect or something else is wrong in your config.php. The other error, the semi-colon is missing from the end of <?php include 'includes/config.php' ?> Ken
  10. The Unix timestamp is the number of seconds elapsed since January 1, 1970. The time function returns that number for "right now". I assume that $deadlinedate is the number of seconds for a date in the future. To get the number of days between those two dates, you use the formula you have: 60 = number of seconds/minute, 60 = number of minutes/hour, 24 = number of hours/day. Or you could just divide by 86400 -- the number of seconds in a day. To get the number of months is harder, since the number of days/month is variable. You can get an approximate value by: <?php $months = floor($days/30); ?> or <?php $months = floor($days/31); ?> Ken
  11. I would change your first script to <?php include 'includes/config.php'; $delete_sql ="SELECT sno,cname, sname FROM student ORDER BY sno DESC"; $delete_query = mysql_query($delete_sql) or die("Problem with the query: $delete_sql<br>" . mysql_error()); $tmp = array(); while ($rsDelete = mysql_fetch_assoc($delete_query)) { $tmp[] = "<p><a href='deletecomfirm.php?sno={$rsDelete['sno']}'>{$rsDelete['cname']} by {$rsDelete['fname']}</a></p>"; } ?> <html> <head> </head> <body> <p> select student to delete </p> <?php echo implode("\n",$tmp) . "\n"; ?> </body> </html> In your Confirmation page, you had some misspellings and left out some code: <?php session_start(); include 'includes/config.php' $_SESSION['deletestudent']['sno'] =$_GET['snp']; $confirm_sql = "SELECT * FROM student WHERE sno='{$_GET['sno']}'"; $rs = mysql_query($confirm_sql) or die("Problem with the query: $confirm_sql<br>" . mysql_error()); // you left out this line $rsConfirm = mysql_fetch_assoc($rs); //you left out this line ?> <html> <head> </head> <body> <p> Confirm student to delete:</p> <?php echo "<p>{$rsConfirm['cname']}</p>\n"; echo "<p>{$rsConfirm['sname']}</p>\n"; echo "<p>{$rsConfirm['fname']}</p>\n"; ?> <p><a href="deleteselect.php"> Oops, made a mistake</a></p> <p><a href="deletestudent.php"> Delete this student</a></p> <body> </html> The Delete page had a few errors: <?php session_start(); include 'includes/config.php' $delete_sql = "DELETE FROM student WHERE sno = '{$_SESSION['deletestudent']['sno']}'"; $delete_query = mysql_query($delete_sql) or die("Problem with the query: $delete_sql<br>" . mysql_error()); unset($_SESSION['deletestudent']; ?> <html> <body> <p> Student has been deleted </p> </body> <html> Ken
  12. If you're commenting out the includes, that's why you get a mysql error. The includes hold your connection statements. Ken
  13. That error means you have a syntax error in your query. Write that single line as multiple lines so you can find out what the error is: <?php $q = "select username,password,email,desc,keys,logo,webclient,forums,hiscores,chatbox,staff,newstitle,newsimage,news,op1,op2,op3 from users where username='{$_SESSION['username']}'"; $rs = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error()); $dnn = mysql_fetch_assoc($rs); ?> Ken
  14. You're not even getting to <?php if (isset($sql) && !empty($sql)) { mysql_query($sql); } ?> Since you're using the header function to go to another page before that point is reached. Ken
  15. Please put your code between tags in the future. That code is fine -- i.e. no syntax errors, but out of context it means nothing to us. Please post a better explanation and more code. Ken
  16. No host in their right mind should be running PHP4 anymore. Either convince your client to move to another host -- one that is running PHP5, or get your client to have his host upgrade to PHP5. Ken
  17. Try writing the file the directory "/tmp". Everyone should have write permissions to that directory. After the file is created do an "ls -l" on the file and see who the owner is. It's probably not your userid. That is probably where you're getting confused. Ken
  18. But, those conventions are not enforced in any browser or code that I know of. You can use GET to set data to be updated, etc and it will work as long as you code your script to use the data that way. Ken
  19. Also, there is usually a limit to how much data can be sent using GET. Ken
  20. Give the submit button a name and check to see if the form was submitted before sending the email: <form method="post" action="viewpage.php?page_id=5"> Email: <input name="email" type="text"><br> Message:<br> <textarea name="message" rows="15" cols="40"></textarea><br> <input type="submit" name="submit"> </form> <?php if (isset($_POST['submit'])) { $to = "hidden for privacy"; $subject = "LoL Recruitment"; $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; $headers = "From: $email"; $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } } ?> Ken
  21. The preg_match function in your function is checking to see whether the email is valid and is returning "true" or "false" accordingly. Ken
  22. The mysql fetch functions return one row at a time, to see all the rows you need to put it into a loop: <?php $query = "SELECT displayname FROM login WHERE rank = 1"; $rs = mysql_query($query); while ($row = mysql_fetch_assoc($rs)) { echo $row['displayname'] . '<br>'; } ?> Ken
  23. The function mysql_fetch_array returns an array containing two entries for each field. You probably want to use the function mysql_fetch_assoc instead. Ken
×
×
  • 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.