Everything posted by fadia123
-
output
hehe the same I got 2 php books to study but I never read them, I like to study on line, lool may be that is one of the reason why I am crap at it. I am building my first website ever using php, stressful but getting there. I will post it to you guys soon.
-
output
OK Sorry if I miss understood you, I like this website. You are 100% right about copying and pasting from tutorials, What I do is copy and paste it then try to do it again by my self .
-
output
You have to know that there are 1000s of website similar to this (http://forums.devnetwork.net is one of the best) where they help and be kind, he was rude and trying to be smart like, he put the while loop in the body. If he want to help and be rude just please don't help. For the code I know it is messy but when you doing it from a tutorial on line you copy and paste the code and work in it, so I copied the code from a tutorial on line.
-
output
OK MR PERFECT "" If I am PRO like you I wouldn't come here and ask for help
-
output
Yes sorry I didn't really understand you before, I found another way which is easy and may you guys will like to know it: I kept every thing like it was and I played more around and after a while I added . before the = sign so it read ($output2 .=) and not ($output2 =) and it worked fine when I put the <?php echo $output2 ?> in the body section.
-
output
hehehehe what confused you? I added the while loop, yes it didn't work, but when I added the whole php code (with the while loop inside it) as web-itec said it worked.
-
output
Hi sorry I had no idea about the code tag, I did what you said and it is working fine thank youuuu, About the isset($_GET['secid']) yes I am linking to this from another page but every thing from that variable is working fine except the output which is working now. Thank you again and have a nice weekend.
-
output
I tried putting it in the body but it is not working here is the original code, how would you do it: <?php $output2 = ''; if (isset($_GET['secid'])) { $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="Forum"; // Database name $tbl_name2="forum_answer"; // Table name $id=$_GET['secid']; $sql2 = mysql_query("SELECT * FROM $tbl_name2 WHERE question_id='$id'"); $Count = mysql_num_rows($sql2); if ($Count > 0) { while($row = mysql_fetch_array($sql2)) { $a_id = $row["a_id"]; $a_name = $row["a_name"]; $a_email = $row["a_email"]; $a_answer = $row["a_answer"]; $a_datetime = $row["a_datetime"]; $output2 = ' <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td bgcolor="#F8F7F1"><strong>ID</strong></td> <td bgcolor="#F8F7F1">:</td> <td bgcolor="#F8F7F1">' . $a_id . '</td> </tr> <tr> <td width="18%" bgcolor="#F8F7F1"><strong>Name</strong></td> <td width="5%" bgcolor="#F8F7F1">:</td> <td width="77%" bgcolor="#F8F7F1">' . $a_name . '</td> </tr> <tr> <td bgcolor="#F8F7F1"><strong>Email</strong></td> <td bgcolor="#F8F7F1">:</td> <td bgcolor="#F8F7F1">' . $a_email . '</td> </tr> <tr> <td bgcolor="#F8F7F1"><strong>Answer</strong></td> <td bgcolor="#F8F7F1">:</td> <td bgcolor="#F8F7F1">' . $a_answer . '</td> </tr> <tr> <td bgcolor="#F8F7F1"><strong>Date/Time</strong></td> <td bgcolor="#F8F7F1">:</td> <td bgcolor="#F8F7F1">' . $a_datetime . '</td> </tr> </table> </td> </tr> </table><br> '; } } else { echo"not greater then 0"; } } ?> <html> <body> <?php echo $output ?> <?php echo $output2 ?> <BR> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form name="form1" method="post" action="add_answer.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td width="18%"><strong>Name</strong></td> <td width="3%">:</td> <td width="79%"><input name="a_name" type="text" id="a_name" size="45"></td> </tr> <tr> <td><strong>Email</strong></td> <td>:</td> <td><input name="a_email" type="text" id="a_email" size="45"></td> </tr> <tr> <td valign="top"><strong>Answer</strong></td> <td valign="top">:</td> <td><textarea name="a_answer" cols="45" rows="3" id="a_answer"></textarea></td> </tr> <tr> <td> </td> <td><input name="id" type="hidden" value="<?php echo $id; ?>"></td> <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td> </tr> </table> </td> </form> </tr> </table> </body> </html>
-
output
Thank you for you reply, I am echoing it in the body section, How I will put it in the body if I echo it inside the while loop?
-
output
Hi, I am trying to output all the rows where question_id='$id' from my table, but the problem is that it is outputting only one row and not more? $output2 = ''; if (isset($_GET['secid'])) { $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="Forum"; // Database name $tbl_name2="forum_answer"; // Table name $id=$_GET['secid']; $sql2 = mysql_query("SELECT * FROM $tbl_name2 WHERE question_id='$id'"); $Count = mysql_num_rows($sql2); if ($Count > 0) { while($row = mysql_fetch_array($sql2)) { $a_id = $row["a_id"]; $a_name = $row["a_name"]; $a_email = $row["a_email"]; $a_answer = $row["a_answer"]; $a_datetime = $row["a_datetime"]; $output2 = ' <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td bgcolor="#F8F7F1"><strong>ID</strong></td> <td bgcolor="#F8F7F1">:</td> <td bgcolor="#F8F7F1">' . $a_id . '</td> </tr> <tr> <td width="18%" bgcolor="#F8F7F1"><strong>Name</strong></td> <td width="5%" bgcolor="#F8F7F1">:</td> <td width="77%" bgcolor="#F8F7F1">' . $a_name . '</td> </tr> <tr> <td bgcolor="#F8F7F1"><strong>Email</strong></td> <td bgcolor="#F8F7F1">:</td> <td bgcolor="#F8F7F1">' . $a_email . '</td> </tr> <tr> <td bgcolor="#F8F7F1"><strong>Answer</strong></td> <td bgcolor="#F8F7F1">:</td> <td bgcolor="#F8F7F1">' . $a_answer . '</td> </tr> <tr> <td bgcolor="#F8F7F1"><strong>Date/Time</strong></td> <td bgcolor="#F8F7F1">:</td> <td bgcolor="#F8F7F1">' . $a_datetime . '</td> </tr> </table> </td> </tr> </table><br> '; } } else { echo"not greater then 0"; } } ?> Youssef
-
Include headers
I sorted it out I used: <?php // headers change between logged in and not logged in session_start(); $header = ''; // Be sure to check that this manager SESSION value is in fact in the database $managerID = $_SESSION["id"]; $manager = $_SESSION["manager"]; $password = $_SESSION["password"]; include 'register/includes/connect_to_mysql.php'; $sql = mysql_query("SELECT * FROM members WHERE id ='$managerID' AND Email ='$manager' AND Password='$password' LIMIT 1"); $existCount = mysql_num_rows($sql); // count the row nums if ($existCount == 0) { $header ='includes/header.php'; } else { while($row = mysql_fetch_array($sql)) { $First_Name = $row["First_Name"]; $header = 'includes/header_Secure.php'; } } ?> and I put <?php include_once "$header" ?> in the body and it worked fine.
-
Include headers
Hi guys, I have 2 headers to include: header_Secure.php and header.php. What I am trying to do is when session exist include header_Secure.php and when session does not exist include header.php. Here is my code: <?php // headers change between logged in and not logged in session_start(); $header = ''; // Be sure to check that this manager SESSION value is in fact in the database $managerID = $_SESSION["id"]; $manager = $_SESSION["manager"]; $password = $_SESSION["password"]; include 'register/includes/connect_to_mysql.php'; $sql = mysql_query("SELECT * FROM members WHERE id ='$managerID' AND Email ='$manager' AND Password='$password' LIMIT 1"); $existCount = mysql_num_rows($sql); // count the row nums if ($existCount == 0) { $header = ' <?php include_once "includes/header.php";?> '; } else { $header = ' <?php include_once "includes/header_Secure.php";?> '; }; ?> But the problem I am having is that it is not picking any headers, I am not sure since I am new to php if I am able to use php inside php like $header = ' <?php include_once "includes/header.php";?> '; Youssef
-
if elseif
Thank you, this worked for me
-
if elseif
Hi I am trying to use php to validate my form here is my code: <?php //Adding the user to the database and checking if he exist we give him an error require_once ('includes/connect_to_mysql.php'); // Handle the form. if (isset($_POST['submitted'])) { $firstname = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["first_name"]); // filter everything but letters and numbers $lastname = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["last_name"]); // filter everything but letters and numbers $email = $_POST["email"]; $password1 = $_POST["password1"]; $password2 = $_POST["password2"]; $humancheck = $_POST["humancheck"]; $email = stripslashes($email); $password1 = stripslashes($password1); $password2 = stripslashes($password2); $email = strip_tags($email); $password1 = strip_tags($password1); $password2 = strip_tags($password2); // query the person $ins = mysql_query("SELECT id FROM members WHERE Email='$email' LIMIT 1"); // ------- MAKE SURE PERSON EXISTS IN DATABASE --------- $existCount = mysql_num_rows($ins); // count the row nums // Error handling for missing data if ((!$firstname) || (!$lastname) || (!$email) || (!$password1) || (!$password2) || (!$humancheck)) { $errorMsg = 'ERROR: You did not submit the following required information:<br /><br />'; if(!$firstname){ $errorMsg .= ' * First Name<br />'; } if(!$lastname){ $errorMsg .= ' * Last Name.<br />'; } if(!$email){ $errorMsg .= ' * Email<br />'; } if(!$password1){ $errorMsg .= ' * Password<br />'; } if(!$password2){ $errorMsg .= ' * Confirm Password<br />'; } } else if($password1 != $password2) { $errorMsg = 'ERROR: Your passwords fields below do not match<br />'; } else if($humancheck != "") { $errorMsg = 'ERROR: The Human Check field must be cleared to be sure you are human<br />'; } else if($existCount > 0){ $errorMsg = 'ERROR: Your Email address is already in use inside of our system. Please use another.<br />'; } else { // Add this person into the database now $sql = mysql_query("INSERT INTO members (First_Name, Last_Name, Email, Password, Date) VALUES ('$firstname', '$lastname', '$email', '$password1' , NOW() )"); header("location: login.php"); exit(); } }else { $firstname =''; $errorMsg = ''; $lastname = ''; $password1 = ''; $password1 = ''; $email = ''; }; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <link rel="stylesheet" href="../css/MenuMatic.css" type="text/css" media="screen" charset="utf-8" /> <!--[if lt IE 7]> <link rel="stylesheet" href="../css/MenuMatic-ie6.css" type="text/css" media="screen" charset="utf-8" /> <![endif]--> </head> <body> <!--main begin --> <div id="main"> <!--header begin --> <?php include_once "includes/header.php";?> <!--header end --> <!--content begin --> <div id="content"> <h3>Please fill the form below to register:</h3> <div style="color:red"><?php print "$errorMsg"; ?></div> <form action="register.php" method="post" name="register_form"> <p><span style="width:150px; display:inline-block">First Name:</span><input type="text" id="register_firstname" name="first_name" value="<?php echo $firstname ?>" class="register_Text_Boxes" /></p> <p><span style="width:150px; display:inline-block">Last Name:</span><input id="register_lastnamename" type="text" name="last_name" value="<?php print $lastname ?>" class="register_Text_Boxes" /></p> <p><span style="width:150px; display:inline-block">Email Address:</span><input id="register_email" type="text" name="email" value="<?php echo $email ?>" class="register_Text_Boxes" /></p> <p><span style="width:150px; display:inline-block">Password:</span><input id="register_password1" type="password" name="password1" class="register_Text_Boxes"/> </p> <p><span style="width:150px; display:inline-block">Confirm Password:</span><input id="register_password2" type="password" name="password2" class="register_Text_Boxes" /></p> <p><span style="width:150px; display:inline-block">Human Check:</span><input name="humancheck" type="text" id="humancheck" value="Please remove all of this text" class="register_Text_Boxes" /></p> <div><span style="width:150px; display:inline-block"></span><input name="submit" type="submit" id="button" value="Register" /></div> <input type="hidden" name="submitted" value="TRUE" /> </form> </div> <!--content end --> </div> <!--main end --> <!--Footer begin --> <?php include_once "../includes/footer.php";?> <!--Footer end --> <!-- Load the Mootools Framework --> <script src="http://www.google.com/jsapi"></script><script>google.load("mootools", "1.2.1");</script> <!-- Load the MenuMatic Class --> <script src="../js/MenuMatic_0.68.3.js" type="text/javascript" charset="utf-8"></script> <!-- Create a MenuMatic Instance --> <script type="text/javascript" > window.addEvent('domready', function() { var myMenu = new MenuMatic(); }); </script> <!-- begin google tracking code --> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-2180518-1"); pageTracker._initData(); pageTracker._trackPageview(); </script> <!-- end google tracking code --> </body> </html> Ok what I am getting is that when I fell all the fields in the form as I validated it I get this error: ERROR: You did not submit the following required information: Please help Youssef
-
images
Hi, I am uploading an image into a folder using php, here is the code: <form action="add.php" method="POST" enctype='multipart/form-data'> <input type="file" name="file" id="file" /> <input type="submit" id="Main_Search_Button"> </form> add.php: if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "image/PNG") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; $newname = "$pid.jpeg"; if (file_exists("exchanges_images/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "exchanges_images/" . $newname); echo "Stored in: " . "exchanges_images/" . $newname; } } } else { echo "Invalid file"; } Ok the problem I am having is: Some images is uploading normal and some are not, I have attached 2 images the one called car is not uploading and the one called youssefff in loading? Any help will be great.
-
MySQL
Hi, I just fixed it, Actually it was only easyphp bitching around, I restarted it and it is working fine now Youssef
-
MySQL
Hi, Thank you for your reply, I don't need a field in my table for the file because I am storing the file in a folder not in a database, and for the variable I don't think it is the problem because the insert into table function work fine and it stop working if I just put the <input type="file" name="file" id="file" /> into the form and I don't even change any thing to the php file that is processing the form. Youssef
-
MySQL
Hi, I am having some thing weird happening in my code, when I add <input type="file" name="file" id="file" /> inside my from the $sql = mysql_query("INSERT INTO exchanges (firstname, lastname, producttittle, productdescription, ExchangeWithTittle, ExchangeWithDescription, shippingfirstname, shippinglastname, address1, address2, city, country, postalcode, phonenumber, email, dateadded) VALUES ('$first_name','$last_name','$product_title','$product_description','$exchange_with_title','$exchange_with_description','$shipping_first_name','$shipping_last_name','$address1','$address2','$city','$country','$post_code','$phone_number','$email',now())"); stop working. Any help? Youssef
-
Port 20
LOOOL I am trying to sort out this problem since like 2 weeks, I am new to php, do you want me to message you the ftp server details may be you will have a closer look? Youssef
-
Port 20
Hi Jay, In the attachment image you will see that user1 has full file and directory access, and the user name has access to one directory that is \\10.0.0.1\ftproot. Youssef
-
Port 20
Sorry Jay, that reply meant to be to you not to my self
-
Port 20
Thank you for your reply, I already did that, it connect to the server but it never upload the file, whatever I do. Here is the code I am using: <?php //Send the FTP Connection and send the Excel file to the ftp server $ftp_server = "xxxxx"; $ftp_user = "xxx"; $ftp_pass = "xxxx"; $file = 'xls/AB-MXRPayment.xls'; $fp = '/AB-MXRPayment.xls'; // set up a connection or die $conn_id = ftp_connect($ftp_server , 20 ) or die("Couldn't connect to $ftp_server"); // try to login if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) { echo "Connected as $ftp_user@$ftp_server\n"; } else { echo "Couldn't connect as $ftp_user\n"; } if (@ftp_put($conn_id, $fp, $file, FTP_ASCII)) { echo "Successfully uploaded $file\n"; } else { echo "There was a problem while uploading $file\n"; } // close the connection ftp_close($conn_id); ?> And here is the answer that I am always getting. Connected as user1@80.45.12.74 There was a problem while uploading xls/AB-MXRPayment.xls I can give you any details if you want. Youssef
-
Port 20
Is it possible to send an excel file into port20 ftp server using php? Youssef
-
uploading into ftp server
OK Guys I am in this situation now, My latest code is uploading the file into 21 port ftp server, but it is not uploading the file into 20 port ftp server, here is my latest code: <?php //Send the FTP Connection and send the Excel file to the ftp server $ftp_server = "80.45.12.74"; $ftp_user = "user1"; $ftp_pass = "password"; $file = 'xls/AB-MXRPayment.xls'; $fp = '/AB-MXRPayment.xls'; // set up a connection or die $conn_id = ftp_connect($ftp_server , 20 ) or die("Couldn't connect to $ftp_server"); // try to login if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) { echo "Connected as $ftp_user@$ftp_server\n"; } else { echo "Couldn't connect as $ftp_user\n"; } if (@ftp_put($conn_id, $fp, $file, FTP_ASCII)) { echo "Successfully uploaded $file\n"; } else { echo "There was a problem while uploading $file\n"; } // close the connection ftp_close($conn_id); ?> I am getting this answers: Port 21 ftp server (which is fine): Connected as siblini1@65.60.20.138 Successfully uploaded xls/AB-MXRPayment.xls Port 20 ftp server (which is not working): Connected as siblini1@65.60.20.138 There was a problem while uploading xls/AB-MXRPayment.xls Youssef
-
uploading into ftp server
This is impossible to find out lool