PHP - Upload And Retrieve Image In Database
hi,
i have a form that requires image to be uploaded. i know how to store the form values in a database but i don't know how to store the image into the database. i want the user to upload picture and preview the data provided review (including the image) before submitting to the database. thanks Similar Tutorials
Query About How To Retrieve A Password From The Database And Compare To The One The User Has Entered
hello friends, while clicking the form all the information goes to database, I have one image upload field, when cliking the submit button, i would like 'image name' to go in database and file to go in /upload folder, i have tried this for hours and gave up, if anyone help me in this, i would be very greatful hi all i need a script that will allow me upload images to 2 dif folders on my server and then add the info to my database along with some other form data. iv been looking all over for code or scripts for days now and have been playing with cut and copyed code but no look again any help i will be greatful for as im a noob to php but al learning quick here is my html form Code: [Select] <html> <body> <form action="add.php" method="post"> Project Name: <input type="text" name="pro_name" /><br> Thumbnail: <input type="file" name="thumbnail" /><br> ////// this image to ../thum Short Details: <input type="text" name="short_details" /><br> Full Details: <input type="text" name="full_details" /><br> Category: <input type="text" name="cat" /><br> Image1: <input type="file" name="image1" /><br>//// and image1,2,3,4 to ../images Image2: <input type="file" name="image2" /><br> Image3: <input type="file" name="image3" /><br> Image4: <input type="file" name="image4" /><br> <input type="submit" /> </form></body></html> here is my code for add.php witch only adds the info to the DB Code: [Select] <?php error_reporting(E_ALL); include ("../includes/db_config.php"); $con = mysql_connect($db_hostname,$db_username,$db_password); @mysql_select_db($db_database) or die( "Unable to select database"); $sql="INSERT INTO $db_table (pro_name, thumbnail, short_details, full_details, cat, image1, image2, image3, image4) VALUES ('$_POST[pro_name]','$_POST[thumbnail]','$_POST[short_details]','$_POST[full_details]','$_POST[cat]','$_POST[image1]','$_POST[image2]','$_POST[image3]','$_POST[image4]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con) ?> Hello freaks! Im new to this forum, but im not all that new to PHP and MySQL. Although there's been some years since the last time I used it, so don't go all freaky on me if I dont do this right Let's go on-topic: Im in progress of making an internal web-page for me and my colleagues to make things a bit easier for us. I am making an database of our different projects, and I need some help with the input form - as I need to upload an image to the server, and store the path in the MySQL database. In my input form, I need to store information from text fields, and I need to upload an image to the server and store the path in the database. Before I can even start to code this (although I have coded the input forum without the upload), I need to know what would be the best way to do this. I guess there are several ways.. What would the expert do (That's you right?)? Should I have the information input, and image upload in the same form, or should I make a second form (maybe on a different page) for the upload? Is it necessary with two tables, one for the info and one for the image path, and then tie them together with the imageID, or is it fine to use just one table? Any thoughts would be appreciated! <!-- TechThat --> I am in the process of writing a CMS for a friend that is looking to add a classified section to his site. He will be the only one that will ever use it. I got the code to work with one image when he asked me if I could do it so he could post 6 images for each item. I am unable to figure out how to do this. I was told to do this with a while loop. This is the code that I have written so far. <?php //Check to make sure title is filled in. If not redirects to show_add.php if (!$_POST[title]) { header("Location: show_add.php"); exit; } else { //check and see if a session has started session_start(); } //if session has not been properly started redirects back to the administration menu if ($_SESSION[valid] != "yes") { header("Location: admin_menu.php"); exit; } include('includes/connection.php'); //check and see if the type of uploaded file is an image function is_valid_type($file) { $valid_types = array("image/jpg", "image/jpeg", "image/gif", "image/bmp"); if (in_array($file['type'], $valid_types)) return 1; return 0; } //Set Constants $TARGET_PATH = "/home/content/m/i/k/mikedmartiny/html/db_images/"; $title = $_POST['title']; $year = $_POST['year']; $make = $_POST['make']; $model = $_POST['model']; $descript = $_POST['descript']; $image = $_FILES['image']; //Sanitize the inputs $title = mysql_real_escape_string($title); $year = mysql_real_escape_string($year); $make = mysql_real_escape_string($make); $model = mysql_real_escape_string($model); $descript = mysql_real_escape_string($descript); $image['name'] = mysql_real_escape_string($image['name']); //$target_path full string $TARGET_PATH .= $image['name']; //make sure that all fields from form are filled in if ( $title == "" || $year == "" || $make =="" || $model == "" || $descript == "" || $image['name'] == "") { $_SESSION['error'] = "ALL FIELDS ARE REQUIRED!"; header ("Location: show_add.php"); exit; } //check to make sure it has the right file type if (!is_valid_type($image)){ $_SESSION['error'] = "You must upload a jpeg, gif, or bmp"; header ("Location: show_add.php"); exit; } //check to see if a file with that name exsists if (file_exists($TARGET_PATH)){ $_SESSION['error'] = "A FILE WITH THAT NAME ALL READY EXIST!"; header ("Location: show_add.php"); exit; } //move the image - write path to database while($image <=2) { move_uploaded_file($image['tmp_name'], $TARGET_PATH) } else { // Make sure you chmod the directory to be writeable $_SESSION['error'] = "COULD NOT UPLOAD FILE. CHECK WRITE/REWRITE PERMISSIONS ON THE FILE DIRECTORY!"; header ("Location: show_add.php"); exit; } $sql = "INSERT INTO $table (id, title, year, make, model, descript, image, image_two) VALUES ('', '$_POST[title]', '$_POST[year]', '$_POST[make]', '$_POST[model]', '$_POST[descript]', '" . $image['name'] . "', '" . $image['name'] . "')"; $result = mysql_query($sql) or die ("Could not insert data into DB: " . mysql_error()); ?> I only have it set up to work with 2 images right now. I thought it would be easier to get it to work properly. Then I could just add in the rest of the info later. Any help would be greatly appreciated.
I have a form on which the filepond plugin send the file manually
Look here if(empty($_POST['image'])) { echo 'add file!'; } $myimage = $_POST['image']; $myimage = str_replace('data:image/png;base64,', '', $myimage); $myimage = str_replace(' ', '+', $myimage); $decode = base64_decode($myimage); $myfile = $_SERVER['DOCUMENT_ROOT'].'/mages/' . uniqid() . '.png'; //now put the file file_put_contents($myfile, $decode);
I have this code which uoploads and resizes the images into a folder without a problem. My problem is I am unable to view the Thumb or Full image which has uploaded to the folder and the database with the other data. How do i correct this problem code below. Thanks upload form and script Code: [Select] <?php //database properties $dbhost = 'localhost'; $dbuser = 'user'; $dbpass = 'pass'; $dbname = 'DB'; // make a connection to mysql here $conn = mysql_connect ($dbhost, $dbuser, $dbpass) or die ("I cannot connect to the database because: " . mysql_error()); mysql_select_db ($dbname) or die ("I cannot select the database '$dbname' because: " . mysql_error()); /******** start function ********/ function errors($error){ if (!empty($error)) { $i = 0; echo "<blockquote>\n"; while ($i < count($error)){ echo "<p><span class=\"warning\">".$error[$i]."</span></p>\n"; $i ++;} echo "</blockquote>\n"; }// close if empty errors } // close function // ----------------Create Smaller version of large image--------------------- function createthumbfull($src_filename, $dst_filename_full) { // Get information about the image list($src_width, $src_height, $type, $attr) = getimagesize( $src_filename ); // Load the image based on filetype switch( $type ) { case IMAGETYPE_JPEG: $starting_image = imagecreatefromjpeg( $src_filename ); break; case IMAGETYPE_PNG: $starting_image = imagecreatefrompng( $src_filename ); break; case IMAGETYPE_GIF: $starting_image = imagecreatefromgif( $src_filename ); break; default: return false; } // get the image to create thumbnail from $starting_image; // get image width $width = imagesx($starting_image); // get image height $height = imagesy($starting_image); // size to create thumnail width $thumb_width = 600; // divide iwidth by specified thumb size $constant = $width/$thumb_width; // round height by constant and add t thumb_height $thumb_height = round($height/$constant, 0); //create thumb with true colours $thumb_image = imagecreatetruecolor($thumb_width, $thumb_height); //create thumbnail resampled to make image smooth imagecopyresampled($thumb_image, $starting_image, 0, 0, 0, 0, $thumb_width, $thumb_height, $width, $height); $ran = rand () ; $thumb1 = $ran.".jpg"; global $thumb_Add_full; $thumb_Add_full = $dst_filename_full; $thumb_Add_full .= $thumb1; imagejpeg($thumb_image, "" .$dst_filename_full. "$thumb1"); } //-------------------- create thumbnail -------------------------------------------- //$src_filename = source of image //$dst_filename_thumb = location to store final image function createthumb($src_filename, $dst_filename_thumb) { $size = getimagesize($src_filename); // get image size $stype = $size['mime']; //get image type : gif,png,jpg $w = $size[0]; // width of image $h = $size[1]; // height of image //do a switch statment to create image from right image type switch($stype) { //if image is gif create from gif case 'image/gif': $simg = imagecreatefromgif($src_filename); break; //if image is jpeg create from jpeg case 'image/jpeg': $simg = imagecreatefromjpeg($src_filename); break; //if image is png create from png case 'image/png': $simg = imagecreatefrompng($src_filename); break; } $width = $w; // get image width $height = $h; // get image height // size to create thumnail width $thumb_width = 150; $thumb_height = 150; //use true colour for image $dimg = imagecreatetruecolor($thumb_width, $thumb_height); $wm = $width/$thumb_width; //width divided by new width $hm = $height/$thumb_height; //height divided by new height $h_height = $thumb_height/2; //ass new height and chop in half $w_height = $thumb_width/2; //ass new height and chop in half //if original width is more then original height then modify by width if($w> $h) { $adjusted_width = $w / $hm; // add original width and divide it by modified height and add to var $half_width = $adjusted_width / 2; // chop width in half $int_width = $half_width - $w_height; // take away modified height from new width //make a copy of the image imagecopyresampled($dimg,$simg,-$int_width,0,0,0,$adjusted_width,$thumb_height,$w,$h); //else if original width is less or equal to original height then modify by height } elseif(($w <$h) || ($w == $h)) { $adjusted_height = $h / $wm; // diving original height by modified width $half_height = $adjusted_height / 2; // chop height in half $int_height = $half_height - $h_height; // take away modified height from new width //make a copy of the image imagecopyresampled($dimg,$simg,0,-$int_height,0,0,$thumb_width,$adjusted_height,$w,$h); } else { // don't modify image and make a copy imagecopyresampled($dimg,$simg,0,0,0,0,$thumb_width,$thumb_height,$w,$h); } $ran = "thumb_".rand (); // generate random number and add to a string $thumb2 = $ran.".jpg"; //add random string to a var and append .jpg on the end global $thumb_Add_thumb; //make this var available outside the function as it will be needed later. $thumb_Add_thumb = $dst_filename_thumb; // add destination $thumb_Add_thumb .= $thumb2; // append file name on the end //actually create the final image imagejpeg($dimg, "" .$dst_filename_thumb. "$thumb2"); } /********end functions ***********/ // if form submitted then process form if (isset($_POST['submit'])){ // check feilds are not empty $imageTitle = trim($_POST['imageTitle']); if (strlen($imageTitle) < 3 || strlen($imageTitle) > 255) { $error[] = 'Title must be at between 3 and 255 charactors.'; } // check feilds are not empty or check image file size if (!isset($_FILES["uploaded"])) { $error[] = 'You forgot to select an image.'; } // check feilds are not empty $imageDesc = trim($_POST['imageDesc']); if (strlen($imageDesc) < 3) { $error[] = 'Please enter a description for your image.'; } // location where inital upload will be moved to $target = "productimages/" . $_FILES['uploaded']['name'] ; // find the type of image switch ($_FILES["uploaded"]["type"]) { case $_FILES["uploaded"]["type"] == "image/gif": move_uploaded_file($_FILES["uploaded"]["tmp_name"],$target); break; case $_FILES["uploaded"]["type"] == "image/jpeg": move_uploaded_file($_FILES["uploaded"]["tmp_name"],$target); break; case $_FILES["uploaded"]["type"] == "image/pjpeg": move_uploaded_file($_FILES["uploaded"]["tmp_name"],$target); break; case $_FILES["uploaded"]["type"] == "image/png": move_uploaded_file($_FILES["uploaded"]["tmp_name"],$target); break; case $_FILES["uploaded"]["type"] == "image/x-png": move_uploaded_file($_FILES["uploaded"]["tmp_name"],$target); break; default: $error[] = 'Wrong image type selected. Only JPG, PNG or GIF accepted!.'; } // if valadation is okay then carry on if (!$error) { // post form data $imageTitle = $_POST['imageTitle']; $imageDesc = $_POST['imageDesc']; //strip any tags from input $imageTitle = strip_tags($imageTitle); $imageDesc = strip_tags($imageDesc); // add slashes if needed if(!get_magic_quotes_gpc()) { $imageTitle = addslashes($imageTitle); $imageDesc = addslashes($imageDesc); } // remove any harhful code and stop sql injection $imageTitle = mysql_real_escape_string($imageTitle); $imageDesc = mysql_real_escape_string($imageDesc); //add target location to varible $src_filename $src_filename = $target; // define file locations for full sized and thumbnail images $dst_filename_full = 'productimages/'; $dst_filename_thumb = 'productthumb/'; // create the images createthumbfull($src_filename, $dst_filename_full); //call function to create full sized image createthumb($src_filename, $dst_filename_thumb); //call function to create thumbnail image // delete original image as its not needed any more. unlink ($src_filename); // insert data into images table $query = "INSERT INTO table (imageTitle, imageThumb, imageFull, imageDesc) VALUES ('$imageTitle', '$thumb_Add_thumb', '$thumb_Add_full', '$imageDesc')"; $result = mysql_query($query) or die ('Cannot add image because: '. mysql_error()); // show a message to confirm results echo "<h3 align='center'> $imageTitle uploaded</h3>"; } } //dispaly any errors errors($error); ?> <form enctype="multipart/form-data" action="" method="post"> <fieldset> <legend>Upload Picture</legend> <p>Only JPEG, GIF, or PNG images accepted</p> <p><label>Title<br /></label><input type="text" name="imageTitle" <?php if (isset($error)){ echo "value=\"$imageTitle\""; }?> /></p> <p><label>Image<br /></label><input type="file" name="uploaded" /></p> <p><label>Description<br /></label><textarea name="imageDesc" cols="50" rows="10"><?php if (isset($error)){ echo "$imageDesc"; }?></textarea></p> <p><label> </label><input type="submit" name="submit" value="Add Image" /></p> </fieldset> </form> view data Code: [Select] <?php // Connects to your Database mysql_connect("localhost", "user", "pass") or die(mysql_error()) ; mysql_select_db("DB") or die(mysql_error()) ; //Retrieves data from MySQL $data = mysql_query("SELECT * FROM table") or die(mysql_error()); //Puts it into an array while($info = mysql_fetch_array( $data )) { ?> <?php echo "<img src=http://www.web.com/productimages/" .$info['imagefull'] ." > <br>"; ?> <?php echo "<img src=http://www.web.com/productthumb/" .$info['imageThumb'] ." > <br>"; ?> <?php echo "<b>imageTitle:</b> ".$info['imageTitle'] . "<br> "; ?> <?php echo "<b>imageDesc:</b> ".$info['imageDesc'] . " <hr>"; ?> <?php }?> Hi, Im trying to retrieve HTML from a mysql database but nothing i've tried seems to work. The HTML im trying to retrieve is an iframe with a link and styles (code from amazon associates). Im trying to display links to specific products on amazon from the product page on my site. All data about the product is retrieved from the database so i have code to select the amazon link row in my database table but i cant get it to display. It says the html isnt a string so i cant echo it, fair enough. I have tried using the following code: Code: [Select] $get_buylink_sql = "SELECT mobo_buylink FROM mobo WHERE mobo_id = $mobo_id"; $get_buylink_res = mysqli_query($mysqli, $get_buylink_sql) or die(mysqli_error($mysqli)); while ($buylink = mysqli_fetch_array($get_buylink_res)) { echo"<iframe src=\"".$buylink."\" style=\"width:120px;height:240px;\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"></iframe>"; } mysqli_free_result($get_buylink_res); mysqli_close($mysqli);I have also tried putting the whole iframe code in the database which didnt work either. The mobo_id variable works fine for retrieving the rest of the data and i need to get the amazon link from the same record. I hope i've put this in a way you can understand, but if not i'll try and explain better and give you a link to my site if needed. Thanks, Alex I have code for displaying result from database:
foreach ($_SESSION["products"] as $cart_itm) { $product_code = $cart_itm["code"]; $results = $mysqli->query("SELECT * FROM products WHERE product_code='$product_code' LIMIT 1"); $obj = $results->fetch_object();Now, I display data with: $obj->product_name When I get the list, how to put inline numbers (1 2 3 4 ...)? 1 products1 2 products1 3 products1 4 products1.. CAN ANYONE TELL ME WHAT i AM DOING WRONG. I WANT TO RETRIEVE THE VERY FIRST RECORD IN MY DATABASE WHEN THE CODE EXECUTE IT ONLY SHOWS THE LAST RECORD IN THE DATABASE <?PHP $thisMonth = date('M'); $thisDay = date('j'); $eventMonth = array(); $eventDay = array(); $eventTime = array(); $eventName = array(); $eventLocation = array(); $dbMonth=""; $dbDay=""; $i=0; $conn = odbc_connect('eventsDB','',''); $sql= "SELECT month,day, time, event,location FROM Events"; $rs="$conn,$sql"; if (!$conn) { exit("Connection Failed: " . $conn); } $rs=odbc_exec($conn,$sql); if(!$rs) { exit("Error in SQL"); } echo "DATABASE OPEN"; while($i<3) { $dbMonth= odbc_result($rs,"month"); echo $eventMonth[$i]=odbc_result($rs,"month")."\n"; if($dbMonth<>$thisMonth) { odbc_fetch_row($rs); } echo $eventMonth[$i]=odbc_result($rs,"month")."\n"; echo $eventDay[$i]=odbc_result($rs,"day")."\n"; echo $eventTime[$i]=odbc_result($rs,"time")."\n"; echo $eventDay[$i]=odbc_result($rs,"event")."\n"; echo $eventLocation[$i]=odbc_result($rs,"location")."\n"; $i++; odbc_fetch_row($rs); echo $i; } //ends while loop odbc_close($conn); ?> I AM WORKING ON A PROJECT , I NEED YOUR HELP. I WANT TO USE EXISTING SRC OF IFRAME + RETRIVED VALUE FROM DATABASE INTO IFRAME This is my data.php to retrive values from database into iframe without refresh web page.
<?php $conn = new mysqli('localhost', 'root', '', 'x'); if ($conn->connect_error) { die("Connection error: " . $conn->connect_error); } $result = $conn->query("SELECT number1 FROM users"); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { echo $row['number1'] . '<br>'; } } ?>
<?php include('data.php') ?> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> </head> <body> <div id="show"></div> <script type="text/javascript" src="jquery-3.1.1.min.js"></script> <script type="text/javascript"> $(document).ready(function() { setInterval(function () { $('#show').load('data.php') }, 1000); }); </script> <iframe id="w3" src="DATABASE RETRIVED VALUE" height="80px" width="300px" frameborder="0" style="border: 0; width:300px; height:80px; background-color: #FFF;"></iframe> </body> </html>
INDEX FILE CODES CAN SUCCESSFULLY RETRIVE VALUES FROM DATABASE BUT, I WANT TO STORE IT IN IFRAME SRC . VAR= URLS = 'HTTP://WWW.GOOGLE.COM' IFRAME SRC WILL BE VAR URLS + RETRIEVED VALUE FROM DATABASE
Hello people, I have created an application in Code Charge where my site users can login and play games online.The game code is run via flash and html. The Game has 5 stages and from a page in my application called transfertogame.php , i transfer them to the game page. Now i want to be able to track each players progress via database so that when they log back in and they get to the transfertogame.php page, it can check the page they were on before and immediately take them to the page without starting from page 1. Any help will be appreciated as i am very poor with php scripting This is the session ID i guess is being used from my application page //Initialize Method @4-537EA73F function Initialize() { if(!$this->Visible) return; $this->ds->Parameters["sesUserID"] = CCGetSession("UserID"); } //End Initialize Method //Validate Method @4-7E1FC38C function Validate() { $Validation = true; $Where = ""; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate"); return (($this->Errors->Count() == 0) && $Validation); } //End Validate Method Code: [Select] <?php echo $row_Recordset1['name']; ?> i want to convert the name in to like <a href=main.php?name= $row_Recordset1['name'] >> in databse i has 3 name Steve Mark Lisa i want that names into link like main.php?name=mark and so on how to do it help me h Am a newbie in php. Since I can't insert values to the database with respect to a user Id or with any other token using WHERE clause. I.e "INSERT INTO receipts(date) VALUES(example) where id="**....." If I need to fetch several values of column for a particular user, how do I go about it? Thank you!!! Hi, after following lots of advice and changing to MySqli I am running into a few probs. This is me just probably missing something stupid, I know what I want, but can't figure out what query I should use and where I should place it. All the queries I have tried have failed.
I just need a query that gets the $current_stored_password from the password field on the database, to confirm the last check
elseif ($current_password !== $current_stored_password) { include 'includes/overall/header.php'; echo $current_password . ' AND ' . $_POST['current_password'] . ' Password and password again do not match'; include 'includes/overall/header.php'; }Here is the whole script. <?php session_start(); error_reporting(0); //ini_set('display_errors', '1'); require( 'database.php' ); $username = $_SESSION['loggedinuser']; $current_stored_password = $_SESSION['password']; $current_password = $_POST['current_password']; $password = mysqli_real_escape_string($con, md5( $_POST['password'])); $password_again = mysqli_real_escape_string($con, md5( $_POST['password_again'])); // Run checks if (isset($_POST['current_password'], $_POST['password'], $_POST['password_again'])) { if( strlen( $_POST['current_password'] ) < 8 ) { include('includes/overall/header.php'); echo "Password Must Be 8 or More Characters."; include('includes/overall/footer.php'); } elseif( strlen( $_POST['password'] ) < 8 ) { include('includes/overall/header.php'); echo "Password Must Be 8 or More Characters."; include('includes/overall/footer.php'); } elseif ( strlen( $_POST['password_again'] ) < 8 ) { include('includes/overall/header.php'); echo "Password Must Be 8 or More Characters."; include('includes/overall/footer.php'); } elseif ($password !== $password_again) { include 'includes/overall/header.php'; echo ' Password and password again do not match'; include 'includes/overall/header.php'; } elseif ($current_password !== $current_stored_password) { include 'includes/overall/header.php'; echo $current_password . ' AND ' . $_POST['current_password'] . ' Password and password again do not match'; include 'includes/overall/header.php'; } else { // Define a query to run $query = "UPDATE `user` SET `password` = '$password' WHERE `username` = '$username'"; // Query the database $result = mysqli_query($con,$query); // Check if the query failed if( !$result ) { die('There was a problem executing the query ('.$query.'):<br>('.mysqli_errno($con).') '.mysqli_error($con)); } else { include 'includes/overall/header.php'; echo 'Password has been changed'; include 'includes/overall/footer.php'; } } } // Close the connection mysqli_close($con); ?>At the moment the message displayed when the form is submitted is echo $current_password . ' AND ' . $_POST['current_password'] . ' Password and password again do not match';How do I retrieve the password from the database to compare against the current password entered by the user? Any help is much appreciated. PS. Yes I know I have repeated code and that md5 is not secure, but I am just building onto a template I got and will be making changes to shorten the code and secure the password soon As a complete newbie to php and webdesigning i have a following problem.I would like to retrieve the data from database and display it in a drop down menu.Then i should allow the user to select the values from drop down list along with other details,in other words i have to embed the drop down output as the form input for the user and store the form data in another table.I am running a xampp server and i am using php 5.4 version.Please help.My code is as follows.In this case project_name is displayed as the drop down output.but how do i use the same drop down output as a input in the form. <html> <head></head> <body> <?php error_reporting(E_ALL ^ E_DEPRECATED); include 'connect.php' ; $tbl_name="projects"; $sql="SELECT project_name FROM $tbl_name "; $result=mysql_query($sql); if($result === FALSE) { die(mysql_error()); } ?> <form name="resources" action="hourssubmit.php" method="post" > <?php echo "<select name='project_name'>"; while ($row = mysql_fetch_array($result)) { echo "<option value='" . $row['project_name'] ."'>" . $row['project_name'] ."</option>"; } echo "</select>"; ?> </form> </body> </html> i have 8 division (div), i want to display 4 rows in 4 division and the remain 4 rows in the next 4 division here is my code structure for carousel
<div class="nyie-outer"> second row third row
fourth row fifth row sixth row seven throw eighth row
</div><!--/.second four rows here-->
sql code
CREATE TABLE product( php code
<?php how can i echo that result in those rows
I m trying to fetch a image from mysql (blob) with header..here is my coding..."<?php include("db.php"); $query=mysql_query("select * from table where id='3' "); $row=mysql_fetch_array($query); $r=$row['image']; header("content-type:image"); echo $r; ?>" i want to fetch another fields from the database....but when i try to echo another fields...the page shows error or it does not echo other fields of database....please help me...how can i resolve it...i want to fetch other fields from database,like'username'password'firstname'lastname and image...thanks in advance... Hi there here is what I am trying to do. I have a site A poster can ask a question about a movie that he/she is unsure of Then people can answer If anyone's post is selected as the right answer then I want the poster image to show up in their comment box for the movie. When you answer a question about a movie You can enter The movie name IMDB link IMDB ID So what I want to know is, well I know that there is some javascript onlick function that takes the "select as right answer" clicking action by the Question asker and calls a script which outputs or echos the right answer message. Or this answer is correct message. I want to also summon the IMDB poster image for that commenter if he / she is selected Any ideas? Omar Hello.
I have a bit of a problem. When I fetch the link field from the database.i don't see an actual link on the page.
One more thing, what type of field should I use to store the link in the database? Probably there is where I went wrong.
All help is
hi guys, im new to this forum I'm new also to php, I need help from you guys: I want to display personal information from a certain person (the data is on the mysql database) using his name as a link: example: (index.php) names 1. Bill Gates 2. Mr. nice Guy i want to click Bill Gates (output.php) Name: Bill Gates Country:xxxx Age: xx etc. How can i make this or how to learn this? |