Jump to content
xisto Community

mrdee

Members
  • Content Count

    975
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by mrdee


  1. I assume confirm_id is a variable? Is that correct?And why exactly is the value 9806?Will that be the value for every confirmation of members?And what is the relationship of config_id (which holds 9806) to the id field in the database?That is where I really get stuck, getting that particular record of the person who clicked the confirm link, in order to set his activation to 1 (true).I really don't see how to do it.Thanks.


  2. Sorry to bother you again, but still not getting there with the following in confirm.php:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://forums.xisto.com/no_longer_exists/ xmlns="http://forums.xisto.com/no_longer_exists/ http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title></head><body><?php$con = mysql_connect("localhost","root","root");if (!$con)  {  die('Could not connect: ' . mysql_error());  }  mysql_select_db("tester", $con);  $confirm_id=9806;mysql_query("UPDATE newsletter SET active='1' WHERE $confirm_id='$id'") or die(mysql_error());mysql_close($con);echo 'That\'s it!!!';?></body></html>

    I have had all sorts of errors, from parsing errors to unidentified variables, and the latest one is this: 'Notice: Undefined variable: id in c:\program files\easyphp1-8\home\confirm.php on line 17'.

    So, I am obviously still doing something wrong. :rolleyes:

    Thanks.

  3. Thanks, but there are weird things going on.
    This is my listing for signing in:

    <HTML><HEAD> <TITLE>Vlaanderen-Flanders</TITLE></HEAD><BODY><?php$con = mysql_connect("localhost","root","********");if (!$con)  {  die('Could not connect: ' . mysql_error());  }$First	  = trim(addslashes(strip_tags($_POST['First'])));$Name	= trim(addslashes(strip_tags($_POST['Name'])));$Town	 = trim(addslashes(strip_tags($_POST['Town'])));$Country = trim(addslashes(strip_tags($_POST['Country'])));$Email	 = trim(addslashes(strip_tags($_POST['Email'])));mysql_select_db("tester", $con);mysql_query("INSERT INTO newsletter VALUES ('','$First','$Name','$Town','$Country','$Email')") or die(mysql_error());mysql_close($con);$email_address_to = "$Email";$site = "http://vlaanderen-flanders.org.uk;;$subject = "Thank you";$message_contents = "Hello, $First, Thank you for subscribing to our newsletter.\n Click the link below to confirm your subscription:\n http://localhost/home/confirm.php?confirm_id=9806 \n Kind regards,\n The webmaster.\n $site\n";$header = "From: webbie@vlaanderen-flanders.org.uk\r\n";$header .= "Reply-To: webbie@vlaanderen-flanders.org.uk\r\n";$header .= "webbie@vlaanderen-flanders.org.uk\r\n";mail($email_address_to,$subject,$message_contents,$header);?><div align="center"><img src="Pics/Vlaamse Leeuw.jpg" width="114" height="127" alt="" border="0" align=""></div><p align="center"><b>Thank you, you have subscribed and you will receive a confirmation email soon.</b></p><br><p align="center"><a href="index.htm"><img src="Pics/begin.gif" width="95" height="30" border="0"></a></p></BODY></HTML>
    This worked before for subscribing, now I am getting : 'Column count doesn't match value count at row 1' from this PHP page.
    If that is relevant, the first field is simply called 'id', and is int(6) with auto_increment.
    Also, to get to that page, a form has been filled in on a HTML page, the following fields were submitted: First, Name, Town, Country, Email.

    Thanks for all the help so far.

  4. I got my mail() function to work on my local machine, thanks to jhaslip's excellent help. (Sincere thanks for that).Now, I am one step away from completing a script to let it do exactly what I want.I already have a page where people can fill in a form to subscribe to a newsletter, and they get an email to confirm they have subscribed.However, i would like to be able to put a link in there, when they click on it it sends them to a webpage to tell them their subscription is now active.To achieve that, i have added one field to the table called 'active', with an array type of int(1) and set to a default of 0.The only thing I want now is that when people click the link, it sets the value of 'active' to 1 and takes them to a page confirming this has happened and their subscription is now active.Unfortunately, I am not 100% sure of how to set up the link (probably something like "http://forums.xisto.com/no_longer_exists/) or the code to change the 'active' value for that particular record to 1.BTW my table 'newsletter' looks like: id int(1) auto_increment primary index, first Varchar(30), last varchar(30), town varchar(30), country varchar(30), email varchar(60), active int(1) default 0.All fields are NOT NULL.Any suggestions, please?Thanks in advance.


  5. Hello,
    I notice in the list that my post "SMTP settings" has received a reply.
    Yet, when I click on the title to enter the topic, I get the following:

    The error returned was:
    Sorry, some required files are missing, if you intended to view a topic, it's possible that it's been moved or deleted. Please go back and try again.


    Can anyone tell me what has happened to the topic, and, more importantly, how I would be able to read it?

    Thanks.

  6. I have been trying to set my SMTP server so I can test out scripts in which sending email is involved.As I mentioned in another topic, i am using EasyPHP 1.8, a combined package of Apache server, PHP 4 and MySQL.When executing a script on my local machine, a script that normally works online tells me I have a 530 error and I need to authenticate.So, I looked things up in the PHP manual where I found to go to the php.ini file and find [mail function], and underneath that, to set your SMTP server to the one of your own ISP.Furthermore, it told me to set sendmail_from to the email address you want to send from.I did all that, but after restarting the Apache server, and even after re-booting the machine, i still get the same error, and when I look in phpinfo(), my SMTP server still appears at localhost, while my email address still appears as root@localhost.Yet, in the php.ini file, the values are retained as the ones I set them to.Does anyone know why this is happening?BTW I use EasyPHP in order to avoid having to upload all the time and to be able to test scripts and do exercises on my own machine.Thanks in advance for any help.


  7. You see,the intention is to generate like a customer number for them, a sort of customer ID, such as an ID to be printed on invoices.Also good as recognition or to look them up in the database.Eg. 00023= Mr. John Smith, 00038=Mrs. Sally Jones.Or else, a way to auto generate something like:(For piano students) PI00023(For singing students) SI00038(For keyboard students) KE00057Get my drift?That is, of course, difficult to do for me as a beginner, hence the, what probably looks to some reafers her like, moronic questions.All help is very much appreciated and gratefully accepted, though.


  8. In my MySQL table I would like to use one text field which can contain lots of text. What I want to use it for is for student records, and I want to be able to add to it without destroying what is already there.I want the field to contain something like:****03/11/2007****Chopin prelude No 9: small problem bars 12-15.Advice given on how to practice.****10/11/2007****Problem in Prelude overcome, piece successfully completed.New piece set: Beethoven Sonata No 1, movement 1.etc.This is of course just an example, but that is how I want to set up my student records.Do I have to use LONGTEXT for this, and how do I set the parameters?Thanks in advance.


  9. If I wanted to use an ID field which automatically increments when data are addad, but displays the ID as a 5 figure number, which data type would I have to use?I would want a type that assigns a number to a record in the format "00001", "00002", etc.However, when I use "int" as datatype, it only displays th field contents as "1", "2" etc.So, which data type could do the job for me?i do not need a decimal point or anything, just an id that displays in 5 figures, including the leading zeros.Thanks in advance.


  10. I have simply thrown it all out. (Apache, PHP and MySQL).I came across a wonderful (and free) program today called EasyPHP, which gives you all this too, is less than 8 Mb in size, and at least it works, which means that I will be able to learn PHP/MySQL in peace now, without always having to upload my files for testing them.(And without my hair getting gray, or me having one heart attack after another). :rolleyes:


  11. Hi,
    on my local machine (with Apache 2.0, PHP 5.2.4 and MySQL 5.0) I come across weird things.
    I have successfully made a table, but when I try to enter data into it it just will not accept the empty string for the first field (id).
    This was the creation line:

    $query="CREATE TABLE members (id int(20) auto_increment,first varchar(15) NOT NULL,last varchar(15) NOT NULL,phone varchar(20) NOT NULL,mobile varchar(20) NOT NULL,fax varchar(20) NOT NULL,email varchar(30) NOT NULL,web varchar(30) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))";

    This has created the table no problem.However, when I try to enter something into that table with the following command:

    $query = "INSERT INTO members VALUES ('','John','Barnes','01234 567890','00112 334455','01234 567891','johnbarnes@gowansnet.com','http://gowansnet.com;;mysql_query($query);if (@mysql_query ($query)) {print '<p>The data entry was sucessful.</p>';} else {print "<p>Could not add the entry because: <b>" . mysql_error() . "</b>.The query was $query.</p>";}mysql_close();

    (and provision to see whether or not it succeeded), I get the following error:

    Invalid value in id.
    Then, when I try again, it does put data in, but in the wrong table, it either works or doesn't when I have to keep switching the opening tag from <? to <?php and back, ie. it says it has worked with the </ tag, but has not entered any data, then with the <?php tag, it tells me "Access denied", although correct username and password are in the script..
    In other words, it seems like the whole system is running quite unstable.
    I know I am not being very specific at times, but there is so much going on that i don't know what fault to post anymore.

    Would it help if I posted a result from phpinfo()?

    Thanks,
    (Before I go completely nuts).

  12. Hello,I hope this is the right place to post this, I couldn't find any other place where this would fit.Weeks ago, I uploaded a picture to go with my username.Yet I notice it does not show up, only when I click my username on the left of the forum, it shows up.I did notice that with other users, their picture shows up next to (or underneath) their name.I was wondering why this is happening.Thanks.


  13. Hello,
    I typed out a PHP script (literally copied from w3schools, the script is as follows:

    <html><body><?phpfunction spamcheck($field)  {//eregi() performs a case insensitive regular expression match  if(eregi("to:",$field) || eregi("cc:",$field)) 	{	return TRUE;	}  else	{	return FALSE;	}  }//if "email" is filled out, send emailif (isset($_REQUEST['email']))  {  //check if the email address is invalid  $mailcheck = spamcheck($_REQUEST['email']);  if ($mailcheck==TRUE)	{	echo "Invalid input";	}  else	{ 	//send email	$email = $_REQUEST['email']; 	$subject = $_REQUEST['subject'];	$message = $_REQUEST['message'];	mail("info@vlaanderen=flanders.org.uk", "Subject: $subject",	$message, "From: $email" );	echo "Thank you for using our mail form";	}  }else//if "email" is not filled out, display the form  {  echo "<form method='post' action='mailform.php'>  Email: <input name='email' type='text' /><br />  Subject: <input name='subject' type='text' /><br />  Message:<br />  <textarea name='message' rows='15' cols='40'>  </textarea><br />  <input type='submit' />  </form>";  }?></body></html>

    Yet, when I run it, I keep getting the following error:

    Warning: mail() [function.mail]: SMTP server response: 530 Authenticate before sending emails. in C:\Program Files\Abyss Web Server\htdocs\mailform.php on line 34
    Thank you for using our mail form.

    Judiging by the last line, the script continues to run after the error.
    Line 34 is this line:

    $message, "From: $email" );

    As I said before, I am very inexperienced in PHP (a complete beginner), so I do not understand why I am getting this error.

    Any help will be very much appreciated.

    Thank you.

  14. If you wanna learn PHP, I could recommend you http://w3schools.org//?gtnjs=1, there are AJAX, JavaScript, HTML, CSS, PHP, and bunch more beginner tutorials :P

    Thanks, but when I went there, it looked suspicously much like one of those domain squatter sites.All they do is try to sell you stuff of which the quality yet has to be proven.
    I have heard of the w3schools before, but are you sure you have sent me to the right site?

    Adjustment:
    After having a look, I found it should most probably be .com rather than .org, this took me to the site I have come across before.

  15. Hello,Thanks for your advice.This is what I have at the moment:PHP Version 5.2.2System Windows NT SERVER 5.1 build 2600Build Date May 2 2007 19:17:46Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"Server API CGI/FastCGIVirtual Directory Support enabledConfiguration File (php.ini) Path C:\WINDOWSLoaded Configuration File C:\Program Files\PHP\php.iniPHP API 20041225PHP Extension 20060613Zend Extension 220060519Debug Build noThread Safety enabledZend Memory Manager enabledIPv6 Support enabledRegistered PHP Streams php, file, data, http, ftp, compress.zlibRegistered Stream Socket Transports tcp, udpRegistered Stream Filters convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, zlib.*Zend logo This program makes use of the Zend Scripting Language Engine:Zend Engine v2.2.0, Copyright © 1998-2007 Zend TechnologiesIs that any good?Thanks.


  16. Hello,

     

    I desperately need to learn more about PHP and MySQL to develop interactive (database driven) websites.

    At the moment I have to rely on scripts I get off the Internet, some are great, some are rubbish. but no matter how good they are, they are never 100% the way you'd like them to be.

    And then, if you don't know enough PHP to adjust them to your own needs, you're obviously stuck.

     

    Is there anyone who can advise me of a good starting point?

    I have tried some online tutorials, but some of them are very confusing or even contradict one another.

    I have got "PHP & MySQL for DUMMIES" by Janet Valade, but if that is for dummies, then I gues these days you need a PhD in dumminess to be really called a dummy.

    I also have"Build your own database driven website using PHP ans MySQL" by Kevin Yank, that is lots easier to understand, but starts with the basics, and then all of a sudden goes in feet first.

    So, is there any one who could advise me regarding step by step help for the absolute beginner?

     

    Any help will be very much appreciated.

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.