-
Posts
663 -
Joined
-
Last visited
Everything posted by Deoctor
-
Lost connection to MySQL server during query error
Deoctor replied to kevinkhan's topic in PHP Coding Help
check ur phpinfo for these values -
No data inserted into database. Am I wrongdoing it?
Deoctor replied to pollysal's topic in PHP Coding Help
if u want to submit the values and redirect to other page u can do some thing like this.. 1.html <html> <body> <form action="BookingForm.php" method="post"> <p><strong>REGISTRATION FORM</strong></p> <table width="285" border="1"> <tr> <th width="120" scope="row">Ic No :</th> <td width="149"><label> <input type="text" name="ic_no" id="ic_no" value="<?php $ic_no; ?>"> </label></td> </tr> <tr> <th scope="row">Name :</th> <td><label> <input type="text" name="name" id="name" value="<?php $name; ?>"> </label></td> </tr> <tr> <th scope="row">Address :</th> <td><label> <input type="text" name="address" id="address" value="<?php $address; ?>" > </label></td> </tr> <tr> <th scope="row">Contact No :</th> <td><label> <input type="text" name="tel_no" id="tel_no" value="<?php $tel_no; ?>"> </label></td> </tr> <tr> <th scope="row">Email :</th> <td><label> <input type="text" name="email" id="email" value="<?php $email; ?>"> </label></td> </tr> </table> <input type="submit" name="submit" id="submit" value="Submit"> </form> </body> </html> and the php file which is used to store values should be a separate one. BookingForm.php <?php if(isset($_POST['submit'])) { $ic_no=$_POST['ic_no']; $name=$_POST['name']; $address=$_POST['address']; $tel_no=$_POST['tel_no']; $email=$_POST['email']; $con = mysql_connect("localhost","root","admin"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("develop", $con); mysql_query("INSERT INTO customer (ic_no, name, address, tel_no, email) VALUES ('$ic_no', '$name', '$address','$tel_no','$email')"); mysql_close($con); echo $_SESSION['ic_no']=$ic_no; $_SESSION['name']=$name; $_SESSION['address']=$address; $_SESSION['tel_no']=$tel_no; $_SESSION['email']=$email; echo "<br>Post Values=> "; print_r($_POST); echo "<br>Session Values=> "; print_r($_SESSION); } ?> this way u are using the one form for getting values and the other one for posting values -
No data inserted into database. Am I wrongdoing it?
Deoctor replied to pollysal's topic in PHP Coding Help
changed ur code a little bit try this one.. <?php session_start(); ?> <html> <body> <form action="BookingForm.php" method="post"> <p><strong>REGISTRATION FORM</strong></p> <table width="285" border="1"> <tr> <th width="120" scope="row">Ic No :</th> <td width="149"><label> <input type="text" name="ic_no" id="ic_no" value="<?php $ic_no; ?>"> </label></td> </tr> <tr> <th scope="row">Name :</th> <td><label> <input type="text" name="name" id="name" value="<?php $name; ?>"> </label></td> </tr> <tr> <th scope="row">Address :</th> <td><label> <input type="text" name="address" id="address" value="<?php $address; ?>" > </label></td> </tr> <tr> <th scope="row">Contact No :</th> <td><label> <input type="text" name="tel_no" id="tel_no" value="<?php $tel_no; ?>"> </label></td> </tr> <tr> <th scope="row">Email :</th> <td><label> <input type="text" name="email" id="email" value="<?php $email; ?>"> </label></td> </tr> </table> <input type="submit" name="submit" id="submit" value="Submit"> <?php if(isset($_POST['submit'])) { $ic_no=$_POST['ic_no']; $name=$_POST['name']; $address=$_POST['address']; $tel_no=$_POST['tel_no']; $email=$_POST['email']; $con = mysql_connect("localhost","root","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("ambos", $con); mysql_query("INSERT INTO customer (ic_no, name, address, tel_no, email) VALUES ('$ic_no', '$name', '$address','$tel_no','$email')"); mysql_close($con); $_SESSION['ic_no']=$ic_no; $_SESSION['name']=$name; $_SESSION['address']=$address; $_SESSION['tel_no']=$tel_no; $_SESSION['email']=$email; echo "Post Values=> "; print_r($_POST); echo "<br>Session Values=> "; print_r($_SESSION); } ?> </form> </body> </html> -
i doesnot mean that it is difficult, what i meant is why do u need to reinvent the wheel..
-
believe me, u would not try to take risk of recreating it all again..it would be more easier if u use this code.. http://www.alegrocart.com/ this is the link..
-
try using the alegro cart
-
Lost connection to MySQL server during query error
Deoctor replied to kevinkhan's topic in PHP Coding Help
it is related to the mysql query timeout check for this one mysql.connect_timeout also check for this one max_execution_time -
paste ur entire code.. and also have u made the connection to the databse
-
try modifying it like this <?php $dbHost = 'localhost'; $dbUser = 'root'; $dbPass = 'bla'; $dbDatabase = 'cmd'; $con = mysql_connect($dbHost, $dbUser, $dbPass) or trigger_error("Failed to connect to MySQL Server. Error: " . mysql_error()); mysql_select_db($dbDatabase) or trigger_error("Failed to connect to database {$dbDatabase}. Error: " . mysql_error()); $error = array(); $results = array(); if (isset($_GET['search'])) { $searchTerms = trim($_GET['search']); $searchTerms = strip_tags($searchTerms); if (isset($_GET['search'])) { $searchTerms = trim($_GET['search']); $searchTerms = strip_tags($searchTerms); if (strlen($searchTerms) < 3) { $error[] = "De zoekterm moet langer dan 3 letters zijn"; } else { $searchTermDB = mysql_real_escape_string($searchTerms); } if (count($error) < 1) { $searchSQL = "SELECT titel, omschrijving, afbeelding FROM fotos WHERE "; { if $searchResult = mysql_query($searchSQL) or trigger_error("There was an error.<br/>" . mysql_error() . "<br />SQL Was: {$searchSQL}"); } if (mysql_num_rows($searchResult) < 1) { $error[] = "De zoekterm $searchTerms heeft geen resultaten opgleverd"; }else { $results = array(); $i = 1; while ($row = mysql_fetch_assoc($searchResult)) { $results[] = "{$i}: {$row['omschrijving']}<br />{$row['plaats']}<br />{$row['afbeelding']}<br /><br />"; $i++; } } } } } function removeEmpty($var) { return (!empty($var)); } ?> <html> <omschrijving>Zoeken</omschrijving> <style type="text/css"> #error { color: red; } </style> <titel> <?php echo (count($error) > 0)?"The following had errors:<br /><span id=\"error\">" . implode("<br />", $error) . "</span><br /><br />":""; ?> <form method="GET" action="<?php echo $_SERVER['PHP_SELF'];?>" name="searchForm"> Zoeken <input type="text" name="search" value="<?php echo isset($searchTerms)?htmlspecialchars($searchTerms):''; ?>" /><br /> <input type="submit" name="submit" value="Search!" /> </form> <?php echo (count($results) > 0)?"Zoek: {$searchTerms} resultaat:<br /><br />" . implode("", $results):""; ?> </titel> </html>
-
hai try this script [attachment deleted by admin]
-
$from = "mail@mail.com"; $headers = "From: $from"; mail($email,"You have successfully registered","hai you have successfully registered here...",$headers); put this after the mail("$to", "Exhibitor Online Information Form", $body, "$company" );
-
i think thatz wt u are doing out in here mail("$to", "Exhibitor Online Information Form", $body, "$company" );
-
so are u getting any errors or some thing?? what is the problem now?? with ur script
-
r u trying this script in the Internet explorer?? if yes then u need to add some more extensions to your script.. pjpeg also using ur script i think u r checking just the extension only, this is a wrong method of finding the file type.. u can do one more thing is that use this inbuilt function mime_content_type u can even try using this script http://www.php.net/manual/en/features.file-upload.php#88959
-
do u mean some thing like whether the URL gives u the rss feeds or not?? if yes then u can check using this inbuilt function of php simplexml_load_file("$url")
-
hai Using this below code, i have made one application which will send the users with the name as (unknown sender) and the subject line will the (no subject), can any one explain me why is this happening?? Seeing this can i think that i can hide my real name and things without authentication using PHP <?php require_once "Mail.php"; $from = "Support <[email]email@email.com[/email]>"; $to = "Chaitu <[email]myid@gmail.com[/email]>"; $subject = "Hi!"; $body = "<h1>Hi</h1>,\n\nHow are you?"; $host = "mail.example.com"; $username = "smtp_username"; $password = "smtp_password"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!</p>"); } ?> by the way i forgot to tell. the smtp details i have intentionally removed them from here..
-
I can't figure out what is wrong with this mail() script.
Deoctor replied to artech's topic in PHP Coding Help
not with the documentation try this telnet <hostname or ip> 25 if this shows some results then port is opened.. or else if it gives some thing like this then the port is closed.. -
I can't figure out what is wrong with this mail() script.
Deoctor replied to artech's topic in PHP Coding Help
check whether the port 25 is opened in the host from which ever u are not getting mail.. -
Hai try this dude <?php #Send mail attaching a file along with it... $fileatt = "address.pdf"; // Path to the file $fileatt_type = "application/pdf"; // File Type $fileatt_name = "mypdffile.pdf"; // Filename that will be used for the file as the attachment $email_from = "[email]sales@mysite.com[/email]"; // Who the email is from $email_subject = "Your attached file"; // The Subject of the email $email_message = "Thanks for visiting mysite.com! Here is your free file.<br>"; $email_message .= "Thanks for visiting.<br>"; // Message that the email has in it $email_to = "[email]dr.virus.india@gmail.com[/email]"; //$email_to = $_POST['email']; // Who the email is to $headers = "From: ".$email_from; $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $email_message .= "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message .= "\n\n"; $data = chunk_split(base64_encode($data)); $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data .= "\n\n" . "--{$mime_boundary}--\n"; $ok = @mail($email_to, $email_subject, $email_message, $headers); if($ok) { echo "<font face=verdana size=2><center>You file has been sent<br> to the email address you specified.<br> Make sure to check your junk mail!<br> Click <a href=\"#\" onclick=\"history.back();\">here</a> to return to mysite.com.</center>"; } else { die("Sorry but the email could not be sent. Please go back and try again!"); } ?> change the pdf parts to image..
-
Never Mind guys My friend/Master has solved it out for me.. here is the code i am attaching out for you guys if any one require it in future [attachment deleted by admin]
-
Hai i need help from you guys in some autosuggest search code. the code is working fine, but what i need is that if i click on that suggestion it should get added to a variable. i am not getting any idea how to do this. any suggestions would be appreciated. i am attaching the code for your reference.. [attachment deleted by admin]
-
would be helpful if u post the error message here..
-
use this one <?php phpinfo(); ?> and check for this one Loaded Configuration File C:\xampp\php\php.ini this is the location from which the configuration file is getting loaded..
-
PHP upload script not working? Godaddy Linux Server
Deoctor replied to borabora12's topic in PHP Coding Help
is ur issue got resolved.? -
is there a time zone difference between ur location and the server which u are using?