Jump to content

Alidad

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by Alidad

  1. i put this code on the top of page <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); ?> but still not showing any errors. any other idea of errors! please help thanks. AM
  2. hi, I tried to change update query from mysql to mysqli, at first under mysql is works great to update into mysql database but when i changed to mysqli is not doing update it. can anyone tell me what did i missed! under mysql <?php include('db.php'); if(isset($_GET['status'])) { $status1=$_GET['status']; $select=mysql_query("select * from manage where id='$status1'"); while($row=mysql_fetch_object($select)) { $status_var=$row->status; if($status_var=='0') { $status_state=1; } else { $status_state=0; } $update=mysql_query("update manage set status='$status_state' where id='$status1' "); if($update) { header("Location:index.php"); } else { echo mysql_error(); } } ?> <?php } ?> and under mysqli <?php include('db.php'); $dbcs = new mysqli($mysql_hostname, $mysql_user, $mysql_password, $mysql_database); if(isset($_GET['status'])) { $status1=$_GET['status']; $sql = "select * from product where product_id='$status1'"; $result=mysqli_query($dbcs,$sql); while($row=mysqli_fetch_object($result)) { $status_var=$row->status; if($status_var=='0') { $status_state=1; } else { $status_state=0; } $mysqli->query("UPDATE product set status='$status_state' where product_id='$status1' "); if($mysqli) { header("Location:item.php"); } else { echo mysqli_error(); } } ?> <?php } ?>
  3. hi, I'm kind of confused and rookie about the delete image file name from database, I have five images file name in database and store image file in the folder, each table column name is (image_1, image_2, images_3, image_4, image_5). In html , each image have delete button under bottom of image for up to five images. Let say that I want to delete 'image_3" by pressing button, how can i write that code to make sure that i can delete that images file name ONLY from database instead of delete rest of row! i wrote code but not sure working right... button <a href='inventory_list.php?deleteid=$id'>delete</a>
  4. here is what i wrote in database connection include("connect.php"); $query = "SELECT id, display FROM dragdrop"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $id = stripslashes($row['id']); $display = stripslashes($row['display']); ?> <li id="arrayorder_<?php echo $id ?>"><?php echo $id?> <?php echo $text; ?> and in body there is five box and each box has number one number from 1 to five. <ul class="nav"> <li><a href="#">Link one</a></li> <li><a href="#">Link two</a></li> <li><a href="#">Link three</a></li> <li><a href="#">Link four</a></li> </ul> <div id="options"> and in checkbox form each checkbox assign to box number and if any box has checkone meaning to display, of not check on meaning not to display <form action="" method="get"><input name="one" type="checkbox" value="one" /> one<br /> <input name="two" type="checkbox" value="two" /> two<br /> <input name="three" type="checkbox" value="three" /> three<br /> <input name="four" type="checkbox" value="four" /> three<br /> <input name="five" type="checkbox" value="five" /> three<br /> </form> anyway, I use ajax meaning that every time checkone or not it will automatic update in database right away and refereshe it which is works great, but to display or not to display is i can't figure out ... doe any one can help me! AM
  5. Hi, I'm rookie in php checkbox and I'm trying to understand how to write the code , i have five checkbox in one form like this <form action="" method="get"><input name="one" type="checkbox" value="one" /> one<br /> <input name="two" type="checkbox" value="two" /> two<br /> <input name="three" type="checkbox" value="three" /> three<br /> <input name="four" type="checkbox" value="four" /> three<br /> <input name="five" type="checkbox" value="five" /> three<br /> </form> if checkbox on then show the box, if checkbox is not check, then not show the box, so i understand that need to use zero or one in mysql database in one column called "display". My question is that how can i write the code in checkbox form whether if is zero or one, but how to write code to show DISPLAY OR NOT DISPLAY when reatrieve from mysql database EVEN USING CSS OR NOT. please help thanks. AM
  6. Hi, I'm rookie in php and i tried to figure out myself how to write that code. A new member signup as new member and send data value to mysql database name 'temp_member' table aand then admin will need for approval. if admin approve this is just press button to transfer data value from 'temp_member' table to other table name 'per_member'. my question is that how can i write that code to transfer profile information from table to other table like from 'temp_member' to 'per_member'. please help thanks. AM
  7. hi, I wrote code that allow me to create email account outside of cpanel and works greats with one domain name. However I'm trying to change code for two domains to select domain name using menu. The forms that i wrote is come with one text fields for input user name and one drop menu for select domain which is: <input name="username" size="20" /> <select name="domain_select" id="domain_select"> <option value="realdeafworld.com">domain1.com</option> <option value="realdeafway.com">domain2.com</option> </select> and then is sending data to other page which is config.php and $username = 'username'; // This variable is the cPanel username $password = 'password'; // Please enter your cPanel password $domain_name = 'domain1.com, domain2.com'; // Please enter the domain name associated with the account $domain_select = $domain_name; $skin = 'x3'; and then it will process to other page which is "http://$username:$password@$domain_name:2082/frontend/$skin/mail/doaddpop.html?email=$_POST[username]&domain=$domain_name&password=$_POST[password]&quota=25"); For some reason is not working right, event i put $domain_name = 'realdeafworld.com, realdeafway.com'; between two domain im getting result of domain1.com. i also changed the variable name to $domain_name = '$domain_select '; and still not working. Can anyone help me how can i solve this by select one domain name from menu before create email account! please help thanks. AM
  8. It has three open and closing braces. and still get same erros message did i missed any things! please help thanks. <?php //connect to database. Username and password need to be changed mysql_connect("localhost", "root", ""); //Select database, database_name needs to be changed mysql_select_db("images"); if (!$_POST['uploaded']){ //If nothing has been uploaded display the form ?> <form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post" ENCTYPE="multipart/form-data"> Upload:<br><br> <input type="file" name="image"><br><br> <input type="hidden" name="uploaded" value="1"> <input type="submit" value="Upload"> </form> <? }else{ //if the form hasn't been submitted then: //from here onwards, we are copying the file to the directory you made earlier, so it can then be moved //into the database. The image is named after the persons IP address until it gets moved into the database //get users IP $ip=$REMOTE_ADDR; //don't continue if an image hasn't been uploaded if (!empty($image)){ //copy the image to directory copy($image, "./temporary/".$ip.""); //open the copied image, ready to encode into text to go into the database $filename1 = "./temporary/".$REMOTE_ADDR; $fp1 = fopen($filename1, "r"); //record the image contents into a variable $contents1 = fread($fp1, filesize($filename1)); //close the file fclose($fp1); //encode the image into text $encoded = chunk_split(base64_encode($contents1)); //insert information into the database mysql_query("INSERT INTO images (img,data)"."VALUES ('NULL', '$encoded')"); //delete the temporary file we made unlink($filename1); } //end } ?> </body> </html>
  9. Hi, I"m trying to create insert images files name into the database and save images in folder, however, after i created databse connection, and excuted it... I'm getting error message said Parse error: syntax error, unexpected $end in C:\xampp\htdocs\ourdeaf\uploadimages\upload.php on line 76 That line 76 is at end of code after </html>, what went wrong! <form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post" ENCTYPE="multipart/form-data"> Upload:<br><br> <input type="file" name="image"><br><br> <input type="hidden" name="uploaded" value="1"> <input type="submit" value="Upload"> </form> <? }else{ //if the form hasn't been submitted then: //from here onwards, we are copying the file to the directory you made earlier, so it can then be moved //into the database. The image is named after the persons IP address until it gets moved into the database //get users IP $ip=$REMOTE_ADDR; //don't continue if an image hasn't been uploaded if (!empty($image)){ //copy the image to directory copy($image, "./temporary/".$ip.""); //open the copied image, ready to encode into text to go into the database $filename1 = "./temporary/".$REMOTE_ADDR; $fp1 = fopen($filename1, "r"); //record the image contents into a variable $contents1 = fread($fp1, filesize($filename1)); //close the file fclose($fp1); //encode the image into text $encoded = chunk_split(base64_encode($contents1)); //insert information into the database mysql_query("INSERT INTO images (img,data)"."VALUES ('NULL', '$encoded')"); //delete the temporary file we made unlink($filename1); } //end } ?>
  10. hi, I have trouble to retreive the images file path name from mysql database. I have created database and create insert file path name into the database, and images file in one of folder name images. My question is that how do i can write that code to retreive images from folder using files path name from database! AM
  11. i tried use this code different way by put people who signup the forms in registration.php page or log in in login.php page and then create weathr session cookies by showing on other page such as index.php page. However, I have tried this code by put seprate page, and is not sending any cookie and not showing weather infomration in index.php page after redirect to other page. I have tested weather code to make sure that the weather zip code are sending data but for some reason is not sending. please use testig code as testing and see can anyone help me how to create weather session from two different pages! <?php $error_message = 'Welcome!'; extract($_POST); //Extract $_POST Array into normal variables, like $zip if(isset($zip)){ //form actually entered? if( preg_match( '#^\d{5}$#', $zip) ){ //valid 5 digits zip? $error_message = 'good'; }else{ $error_message = 'not valid zip code'; } if($error_message == 'good'){ //here we get the weather from Yahooo echo 'Get Weather!'; exit(); //end script after show weather } } ?> <form method="post" action=""> <input type="text" name="zip" maxlength="5"> ZIP CODE 5 Digits (like: 12345)<br /> <input type="submit" name="zipsubmit" value="GET Weather"> </form> <?php echo $error_message; ?>
  12. do not show your database user name and password in forum, they could break into your data. Alidad
  13. cwarn23; thanks so much for your help, both way is works great for me, i just made some changed and works great. and now i'm learning both of them to see what does differents between (seesion and cookies). I have learned lots, is amazing. again thanks so much for your help, i appreication. AM
  14. cwarn23; thank you for your help, im still learning abou the session and cookies, other member ialsoagree who wrote about the session and cookie and he is helpfull too just like you. Due to my time enemy, i was wondering if there is chance that you can write code in cookie to so i can undersand both side of cookie and session myself to see what does differents thanks. AM
  15. ialsoagree; Hi, first of all i want thanks so much for your help about the session and cookies, i read your comments few times to make sure i understand clear, and then is helped me when i typed your code on my editor instead of copied is helped me to undersand what is going on. however, please see the code after i made change i honestly not sure if this works or not, becuase when i run that page, and enter that zip code then showing weather information, and then i pressed F5 for refreshed same page is loaded same weather information. However, i'm not sure if that really works or not becuase of ($session) i'm still learning. I still need your help PRETTY PLEASE, please see the code and is if that correct session and run to see if that works! i'm using the dreamweaver mx, and i can't tell if this session works in weather code after i executed. <?php session_start();?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <style type="text/css">*{font-family:verdana,arial,sans-serif;font-size:10pt}</style> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title>MyWeather</title> </head> <body> <div> <?php if(!isset($_GET['zip']) && !isset($_SESSION['zip'])) { ?> <form method="get" action=""><div> Enter a Zip Code: <input name="zip" size="5"/><br/> Units: <label><input type="radio" name="u" value="f" checked="checked"/> Farenheit</label> <label><input type="radio" name="u" value="c"/> Celsius</label><br/> <input type="submit" value="Submit"/> </div></form> <?php } else { include('weather.class.php'); $ret = weather($_GET['zip'], ($_GET['u'] == 'c')); echo "<table cellpadding=\"2\" cellspacing=\"4\">\n"; echo "\t<tr><td colspan=\"3\"><strong>".$ret[0]['location']."</strong></td></tr>\n"; foreach($ret as $day) { echo "\t<tr><td>".$day['when'].'</td><td><img src="i/'.$day['image'].'"/></td><td>'.$day['text'].'<br/>'; if(isset($day['temp'])) { echo $day['temp'].', Windchill: '.$day['windchill'].'<br/>'; echo 'Wind: '.$day['wind'].'<br/>'; echo 'Humidity: '.$day['humidity'].'<br/>'; echo 'Visibility: '.$day['visibility'].'<br/>'; echo 'Preasure: '.$day['preasure'].'<br/>'; echo 'Sunrise: '.$day['sunrise'].'<br/>'; echo 'Sunset: '.$day['sunset']; } echo "</td></tr>\n"; } echo "</table>\n"; } ?> </div> </body> </html> thanks so much
  16. I have a PHP Yahoo weather script consisting of a form where you input your zip code. This gets a Yahoo weather xml document which displays on a second page. This works fine, except the user must input his zip code each time he visits the site. I'd like to customize it so users can enter their zip code once and have their local weather appear whenever they visit the page. I have attached the fiels or you to test it, the weather codes is works great, but the session cookies is confused me, can anyone help me please. you can download code thanks. please help thanks. [attachment deleted by admin]
  17. Hi, this is relate to switch images, let say that i have two php files, and each files has one images called (red-images.png and yellow-images.png). I'm trying to create switch program in php using two buttons of (red and yellow) buttons, and any time i click on that of those two buttons it will change images. I'm using included statments (<?php include(); ?>) to put <?php include('yellow.php'); ?> or <?php include('red.php'); ?>. my question is that how do i can write that php code to allow me to develop switch images buttons between red.php or yellow.php in index.php page using two of those buttons using <?php include(); ?>! please help thanks. AM
  18. hi, i need help with php, let say that there is one tabs said 'login" and once logged in, change automatic text to "log out" in same tab! AM
  19. Hi,I'm rookie for php, and I'm trying to learn how to write that code. i have create upload images where i can save imges in folder called "images" and then put image file path name for sample "images-folder\image.png" along with some comments text in second column. My question is that if i want to reterieve images and text using database how can write that statments for sample "row...." please help me i need to learn that thanks. AM
  20. I rookie guy for php and i'm trying to learn myself, when person sign up for new member, and send email conformation, how do i can write that code to prompt to show company email link address before they click on the link to redirect to the company site! For sample that i put my master email address of yahoo and and when i click submit, it will show message said we send email conformation for activiation and showing yahoo.com email link to redirect to yahoo email. if i put hotmil as my master email, then it will show hotmail email link to redirect to hotmail site. how can i write that code! please help thanks.
  21. Hi, i have wrote forms that allow me to upload images and save into the folder and send image file path name to the database, i have run it and test is works fine when save images into the folder but is not sending data to the mysql database. i'm not sure what went wrong but the result is not telling us the errors. it said it has send to database but the truth is not sending to database. This is mysql table name please create folder name images CREATE TABLE employees (name VARCHAR(30), email VARCHAR(30), phone VARCHAR(30), photo VARCHAR(30)) this index.php form page <form enctype="multipart/form-data" action="add.php" method="POST"> Name: <input type="text" name="name"><br> E-mail: <input type="text" name = "email"><br> Phone: <input type="text" name = "phone"><br> Photo: <input type="file" name="photo"><br> <input type="submit" value="Add"> </form> this is retrieve information from index.php page <?php //This is the directory where images will be saved $target = "images/"; $target = $target . basename( $_FILES['photo']['name']); //This gets all the other information from the form $name=$_POST['name']; $email=$_POST['email']; $phone=$_POST['phone']; $pic=($_FILES['photo']['name']); // Connects to your Database mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error()) ; mysql_select_db("Database_Name") or die(mysql_error()) ; //Writes the information to the database mysql_query("INSERT INTO `employees` VALUES ('$name', '$email', '$phone', '$pic')") ; //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { //Tells you if its all ok echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?> and this final step to view it. <?php // Connects to your Database mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error()) ; mysql_select_db("Database_Name") or die(mysql_error()) ; //Retrieves data from MySQL $data = mysql_query("SELECT * FROM employees") or die(mysql_error()); //Puts it into an array while($info = mysql_fetch_array( $data )) { //Outputs the image and other data Echo "<img src=http://www.yoursite.com/images/".$info['photo'] ."> <br>"; Echo "<b>Name:</b> ".$info['name'] . "<br> "; Echo "<b>Email:</b> ".$info['email'] . " <br>"; Echo "<b>Phone:</b> ".$info['phone'] . " <hr>"; } ?> please help thanks. AM
  22. Hi, i need help, i'm trying to find how to write code to allow me to create upload images and save in the folder and input images file path name in database. I have tried to find from google but so far nothing, does anyone can help me if you know the website url address where i can learn more about upload images and file path name in mysql! AM
  23. Hi, does anyone know where i can find how to create php total number of email or total number of unread email just like facebook.com showing total number of inbox. I'm trying to find from google but for some reason i could not find it. does any one know where i can find the sample of php code relate to total number of new email! please help thanks. AM
  24. Hi, does any one know how can change templates color by using button to change template1 For sample Yahoo.com where you see drop menu on the top right site where it said "page options" then showing few color button and select one fo those color button then will change templates to that color you picked. does any one know where i could find how to change that color templates using php and css! please help thanks. AM
×
×
  • 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.