-
Posts
780 -
Joined
-
Last visited
Everything posted by mikebyrne
-
[SOLVED] Unknown column in 'where clause' error
mikebyrne replied to mikebyrne's topic in PHP Coding Help
Im noe getting the error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\confirm.php on line 24 <?php include('config.php'); $passkey=$_GET['passkey']; // Passkey that got from link ## added here if (!isset($_GET['passkey'])) { echo "Error here :: PASSKEY NOT FOUND "; } else { ## table name $tbl_name="temp_users"; // after connecting succesfully: $query = "SELECT * FROM '$tbl_name'"; $result = mysql_query($query); // while there is a result, fetch it into an array... while ($row = mysql_fetch_array($result)) { echo "$row[address]"; echo "$row[address1]"; } } ?> [/Code] ITS MY BIRTHDAY AND WOULD LOVE TO GET THIS WORKING!!!!!!! -
Yes the HTML is from one page where the info was passed to the 2nd page signup_ac.php. All was working fine as two seperate pages. I was just wondering if I could combine them onto one page?
-
How can i apply that to my code, I'm very new to php
-
The form was originaly pointed towards singup_ac.php but now its now pointing to anything (I think) When I run it my localhost seems to crashes
-
Everytime I open it up my Apachi server crashes. Is that something to do with the code or size of the file??
-
The code im trying to combine is above on the one page.
-
I'm trying to combine my start & signup page into the one file but It keeps causeing Apachi to crash. Is there a way to do this?? <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Sign UP</title> </head> <body> <td><form name="form1" method="post" action="signup_ac.php"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Name:</td> <td><input type="text" name="name" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address:</td> <td><input type="text" name="address" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address1:</td> <td><input type="text" name="address1" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address2:</td> <td><input type="text" name="address2" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address3:</td> <td><input type="text" name="address3" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address4:</td> <td><input type="text" name="address4" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">County:</td> <td><input type="text" name="county" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Zip:</td> <td><input type="text" name="zip" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Telephone:</td> <td><input type="text" name="telephone" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Email:</td> <td><input type="text" name="email" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Username:</td> <td><input type="text" name="username" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Password:</td> <td><input type="password" name="password" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right"> </td> <td><input type="submit" value="Insert record"></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1"> </form> <p> </p> </body> </html> <?php include('config.php'); // table name $tbl_name=temp_users; // Random confirmation code $confirm_code=md5(uniqid(rand())); // values sent from form $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; // Insert data into database $sql="INSERT INTO $tbl_name(confirm_code, name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password)VALUES('$confirm_code', '$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')"; $result=mysql_query($sql)or die(mysql_error()); // if suceesfully inserted data into database, send confirmation link to email if($result){ // ---------------- SEND MAIL FORM ---------------- // send e-mail to ... $to=$email; // Your subject $subject="Your confirmation link here"; // From $header="from: postmaster@localhost <postmaster@localhost>"; // Your message $message="Your Comfirmation link \r\n"; $message.="Click on this link to activate your account \r\n"; $message.="http://localhost/confirm.php?passkey=$confirm_code"; // send email $sentmail = mail($to,$subject,$message,$header); } // if not found else { echo "Not found your email in our database"; } // if your email succesfully sent if($sentmail){ echo "Your Confirmation link Has Been Sent To Your Email Address."; } else { echo "Cannot send Confirmation link to your e-mail address"; } ?>
-
[SOLVED] Unknown column in 'where clause' error
mikebyrne replied to mikebyrne's topic in PHP Coding Help
I changed your code to <?php include('config.php'); $passkey=$_GET['confirm_code']; // Passkey that got from link ## added here if (!isset($_GET['confirm_code'])) { echo "Error here :: PASSKEY NOT FOUND "; } else { ## table name $tbl_name="temp_users"; // after connecting succesfully: $query = "SELECT * FROM '$tbl_name'"; $result = mysql_query($query); // while there is a result, fetch it into an array... while ($row = mysql_fetch_array($result)) { echo "$row[address]"; echo "$row[address1]"; } } ?> Now getting the error Error here :: PASSKEY NOT FOUND -
[SOLVED] Unknown column in 'where clause' error
mikebyrne replied to mikebyrne's topic in PHP Coding Help
Yeah its exits here's the SQL CREATE TABLE `temp_users` ( `confirm_code` varchar(65) NOT NULL default '', `name` varchar(65) NOT NULL default '', `address` varchar(65) NOT NULL default '', `address1` varchar(65) NOT NULL default '', `address2` varchar(65) NOT NULL default '', `address3` varchar(65) NOT NULL default '', `address4` varchar(65) NOT NULL default '', `county` varchar(25) NOT NULL default '', `zip` varchar(65) NOT NULL default '', `telephone` varchar(25) NOT NULL default '', `email` varchar(25) NOT NULL default '', `username` varchar(65) NOT NULL default '', `password` varchar(15) NOT NULL default '' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -
[SOLVED] Unknown column in 'where clause' error
mikebyrne replied to mikebyrne's topic in PHP Coding Help
I get the error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\confirm.php on line 24 -
[SOLVED] Unknown column in 'where clause' error
mikebyrne replied to mikebyrne's topic in PHP Coding Help
I'm getting an error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\confirm.php on line 22 Wrong Confirmation code -
[SOLVED] Unknown column in 'where clause' error
mikebyrne replied to mikebyrne's topic in PHP Coding Help
Sorry im still a little confused Would it be possible to show me a little example of what you mean -
[SOLVED] Unknown column in 'where clause' error
mikebyrne replied to mikebyrne's topic in PHP Coding Help
How would you suggest I code that? I'd idealy like to it happen automaticaly when the users confirms by clicking the link rather that manually selecting yes/no in the confirmation field -
[SOLVED] Unknown column in 'where clause' error
mikebyrne replied to mikebyrne's topic in PHP Coding Help
Here's my output: I HAVE REACHED HERE, RESULT WAS SUCCESSFUL AND TOTAL ROWS 1Your account has been activated from this code: <?php include('config.php'); // Passkey that got from link ## added here if (isset($_GET['passkey'])) { $passkey=$_GET['passkey']; } else { echo "Error here :: PASSKEY NOT FOUND "; } ## table name $tbl_name="temp_users"; // Retrieve data from table where row matchs this passkey $sql1="SELECT * FROM $tbl_name WHERE confirm_code='$passkey'"; $result1=mysql_query($sql1) or die(mysql_error()); // If successfully queried if($result1) { // Count how many row has this passkey $count=mysql_num_rows($result1); ## again addeded here echo "I HAVE REACHED HERE, RESULT WAS SUCCESSFUL AND TOTAL ROWS ".$count; ## // if found the passkey in the database, retrieve data from table "temp_users" ## ARE YOU SURE YOU ARE GETTING ONLY ONE RESULTS if($count > 0) // i changed here......... { $rows=mysql_fetch_array($result1); $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; $tbl_name2="users"; echo $address1; echo $address2; echo $address3; echo $address4; // Insert data that retrieves from "temp_users" into table "users" $sql2="INSERT INTO `$tbl_name2` (`name`, `address`, `address1`, `address2`, `address3`, `address4`, `county`, `zip`, `telephone`, `email`, `username`, `password`) VALUES ('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')"; $result2=mysql_query($sql2) or die(mysql_error()); } // if not found passkey, display message "Wrong Confirmation code" else { echo "Wrong Confirmation code"; } // if successfully moved data from table"temp_users" to table "users" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db" if($result2) { echo "Your account has been activated"; // Delete information of this user from table "temp_users" that has this passkey $sql3="DELETE FROM $tbl_name WHERE confirm_code = '$passkey'"; $result3=mysql_query($sql3) or die(mysql_error()); } } ?> So i presume the varibles aren't beeing carried they work fine here though <?php include('config.php'); // table name $tbl_name=temp_users; // Random confirmation code $confirm_code=md5(uniqid(rand())); // values sent from form $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; // Insert data into database $sql="INSERT INTO $tbl_name(confirm_code, name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password)VALUES('$confirm_code', '$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')"; $result=mysql_query($sql)or die(mysql_error()); // if suceesfully inserted data into database, send confirmation link to email if($result){ // ---------------- SEND MAIL FORM ---------------- // send e-mail to ... $to=$email; // Your subject $subject="Your confirmation link here"; // From $header="from: postmaster@localhost <postmaster@localhost>"; // Your message $message="Your Comfirmation link \r\n"; $message.="Click on this link to activate your account \r\n"; $message.="http://localhost/confirm.php?passkey=$confirm_code"; // send email $sentmail = mail($to,$subject,$message,$header); } // if not found else { echo "Not found your email in our database"; } // if your email succesfully sent if($sentmail){ echo "Your Confirmation link Has Been Sent To Your Email Address."; } else { echo "Cannot send Confirmation link to your e-mail address"; } ?> -
[SOLVED] Unknown column in 'where clause' error
mikebyrne replied to mikebyrne's topic in PHP Coding Help
How do I do that. I'm very new to php (As you can tell!) -
[SOLVED] Unknown column in 'where clause' error
mikebyrne replied to mikebyrne's topic in PHP Coding Help
That got rid of the error but I still have a problem. My code doesnt seem to be addeding the new users from the temp_users to the users table. It just adds them as blank fields the only entry is in ID which is the primary key so therefore all I can see is ID 1, Name (blank), Address (blank) etc -
[SOLVED] Unknown column in 'where clause' error
mikebyrne replied to mikebyrne's topic in PHP Coding Help
im now getting I HAVE REACHED HERE, RESULT WAS SUCCESSFUL AND TOTAL ROWS 1Your account has been activatedYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE confirm_code = '67ea431d7b9cdba28d88526a243a60ac'' at line 1 -
I get the following error when I click on my confirmation email Unknown column '67ea431d7b9cdba28d88526a243a60ac' in 'where clause' The '67ea431d7b9cdba28d88526a243a60ac' refers to a randomly generated key (passkey) but cant figure out why im getting this error The code i have is: <?php include('config.php'); // Passkey that got from link ## added here if (isset($_GET['passkey'])) { $passkey=$_GET['passkey']; } else { echo "Error here :: PASSKEY NOT FOUND "; } ## table name $tbl_name="temp_users"; // Retrieve data from table where row matchs this passkey $sql1="SELECT * FROM $tbl_name WHERE confirm_code={$passkey}"; $result1=mysql_query($sql1) or die(mysql_error()); // If successfully queried if($result1) { // Count how many row has this passkey $count=mysql_num_rows($result1); ## again addeded here echo "I HAVE REACHED HERE, RESULT WAS SUCCESSFUL AND TOTAL ROWS ".$count; ## // if found the passkey in the database, retrieve data from table "temp_users" ## ARE YOU SURE YOU ARE GETTING ONLY ONE RESULTS if($count > 0) // i changed here......... { $rows=mysql_fetch_array($result1); $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; $tbl_name2="users"; // Insert data that retrieves from "temp_users" into table "users" $sql2="INSERT INTO `$tbl_name2` (`name`, `address`, `address1`, `address2`, `address3`, `address4`, `county`, `zip`, `telephone`, `email`, `username`, `password`) VALUES ('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')"; $result2=mysql_query($sql2) or die(mysql_error()); } // if not found passkey, display message "Wrong Confirmation code" else { echo "Wrong Confirmation code"; } // if successfully moved data from table"temp_users" to table "users" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db" if($result2) { echo "Your account has been activated"; // Delete information of this user from table "temp_users" that has this passkey $sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'"; $result3=mysql_query($sql3) or die(mysql_error()); } } ?>
-
now getting Unknown column 'f1f3f1a24c29e436cfe913ac05c4c504' in 'where clause'
-
$sql1="SELECT * FROM $tbl_name1 WHERE confirm_code ='$passkey'";
-
I got the error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE confirm_code ='9a5d8c0aa8c6f6badbe553fd575a415e'' at line 1
-
My confirm.php looks like this but I'm still getting the blank screen <?php include('config.php'); // Passkey that got from link $passkey=$_GET['passkey']; $tbl_name="temp_users"; // Retrieve data from table where row matchs this passkey $sql1="SELECT * FROM $tbl_name1 WHERE confirm_code ='$passkey'"; $result1=mysql_query($sql1); // If successfully queried if($result1){ // Count how many row has this passkey $count=mysql_num_rows($result1); // if found the passkey in the database, retrieve data from table "temp_users" if($count==1){ $rows=mysql_fetch_array($result1); $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; $tbl_name2="users"; // Insert data that retrieves from "temp_users" into table "users" $sql2="INSERT INTO `$tbl_name2` (`name`, `address`, `address1`, `address2`, `address3`, `address4`, `county`, `zip`, `telephone`, `email`, `username`, `password`) VALUES ('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')"; $result=mysql_query($sql2) or die(mysql_error()); } // if not found passkey, display message "Wrong Confirmation code" else { echo "Wrong Confirmation code"; } // if successfully moved data from table"temp_users" to table "users" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db" if($result2){ echo "Your account has been activated"; // Delete information of this user from table "temp_users" that has this passkey $sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'"; $result3=mysql_query($sql3); } } ?>
-
Still getting a blank screen when I click on the email link!!!! Cant figure whats wrong, Its driving me mental!!!!
-
<?php include('config.php'); // table name $tbl_name=temp_users; // Random confirmation code $confirm_code=md5(uniqid(rand())); // values sent from form $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; // Insert data into database $sql="INSERT INTO $tbl_name(confirm_code, name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password)VALUES('$confirm_code', '$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')"; $result=mysql_query($sql)or die(mysql_error()); // if suceesfully inserted data into database, send confirmation link to email if($result){ // ---------------- SEND MAIL FORM ---------------- // send e-mail to ... $to=$email; // Your subject $subject="Your confirmation link here"; // From $header="from: postmaster@localhost <postmaster@localhost>"; // Your message $message="Your Comfirmation link \r\n"; $message.="Click on this link to activate your account \r\n"; $message.="http://localhost/confirm.php?passkey=$confirm_code"; // send email $sentmail = mail($to,$subject,$message,$header); } // if not found else { echo "Not found your email in our database"; } // if your email succesfully sent if($sentmail){ echo "Your Confirmation link Has Been Sent To Your Email Address."; } else { echo "Cannot send Confirmation link to your e-mail address"; } ?> This all seems to work fine its the confirm.php I'm having trouble with
-
I've fixed it to $sql2="INSERT INTO `$tbl_name2` (`name`, `address`, `address1`, `address2`, `address3`, `address4`, `county`, `zip`, `telephone`, `email`, `username`, `password`) VALUES ('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')"; $result=mysql_query($sql2) or die(mysql_error()); But getting a blank screen after I click on the email link