contra10
-
Posts
402 -
Joined
-
Last visited
Never
Posts posted by contra10
-
-
kk...im trying to show mutual friends that a person might share with another user... the codes above search for a user and i want to echo the mutual friends as well...I have a friends table set up which echoes all the friends for that user...how can i find mutual friends with the code that is stated above
-
could i try to get all the friends for each user and echo all similarities
<?php echo "<TABLE width=800 bgcolor=black border=1 align=center cellpadding=4 cellspacing=0>"; echo "<tr>"; echo "<td width='20%'><a style='text-decoration:none' href='http://localhost/profile/index.php?user=$user'><FONT FACE='ariel' SIZE='2'>$userq<br>"; echo "<img src='http://localhost/image/imagereplace.php?id=$user'><br>"; echo "$city, $mycountry $sex</a></FONT></td>"; } $query2 = "SELECT * FROM friends WHERE `username` ='$username"; $result2 = mysql_query($query2); while ($row2 = mysql_fetch_assoc($result2)){ $bld = "{$row2['friendname']}"; } $query3 = "SELECT * FROM friends WHERE `username` ='$userq"; $result3 = mysql_query($query3); while ($row3 = mysql_fetch_assoc($result3)){ $bld3 = "{$row3['friendname']}"; } if ($bld == $bld3){ echo "<td width='80%'><FONT FACE='ariel' SIZE='2' align='center'><h4>$bld</font></td>"; echo "</tr>"; } ?>
-
i'm trying to show a friend in common in a search my code so far is as follows
<?php // Connects to your Database mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); //This code runs if the form has been submitted if(isset($_POST['submit'])) { $postuser = "{$_POST['username']}"; $postcountry = "{$_POST['country']}"; $postfemale = "{$_POST['sexf']}"; $postcountry = "{$_POST['country']}"; $postage1 = "{$_POST['age1']}"; $postage2 = "{$_POST['age2']}"; $query = "SELECT * FROM users WHERE `username` ='$postuser'"; if(isset($_POST['username']) and ($_POST['country']) and ($_POST['submit'])){$query .= "and `username` = '$postuser' ";} if(isset($_POST['sexf']) and ($_POST['country']) and ($_POST['submit'])){$query .= "and `sex` = '$postfemale' ";} if(isset($_POST['sexm']) and ($_POST['country']) and ($_POST['submit'])){$query .= "and `sex` = 'male' ";} if(isset($_POST['age1']) and ($_POST['age2']) and ($_POST['country']) and ($_POST['submit'])){$query .= "and `age` BETWEEN '$postage1' and '$postage2'";} $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)){ $user = "{$row['id']}"; $userq = "{$row['username']}"; $mycountry = "{$row['country']}"; $sex = "{$row['sex']}"; $city = "{$row['city']}"; echo "<TABLE width=800 bgcolor=black border=1 align=center cellpadding=4 cellspacing=0>"; echo "<tr>"; echo "<td width='20%'><a style='text-decoration:none' href='http://localhost/profile/index.php?user=$user'><FONT FACE='ariel' SIZE='2'>$userq<br>"; echo "<img src='http://localhost/image/imagereplace.php?id=$user'><br>"; echo "$city, $mycountry $sex</a></FONT></td>"; } $query2 = "SELECT * FROM friends WHERE `username` ='$username' and friendname = '$userq'"; $result2 = mysql_query($query2); while ($row2 = mysql_fetch_assoc($result2)){ $bld = "{$row2['fid']}"; echo "<td width='80%'><FONT FACE='ariel' SIZE='2' align='center'><h4>$bld</font></td>"; echo "</tr>"; } ?> }
i'm searching for ids in common in my friends table
friends table
fid userid username friendid friendname
-
i did it the way our talking about and nothing displayed when i clicked female...
i then did this
<?php if(isset($_POST['submit']) and ($_POST['country'])) { $postuser = "{$_POST['username']}"; $postcountry = "{$_POST['country']}"; $query = "SELECT * FROM users WHERE country='$postcountry'"; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)){ $user = "{$row['id']}"; $userq = "{$row['username']}"; $mycountry = "{$row['country']}"; $sex = "{$row['sex']}"; $city = "{$row['city']}"; echo "<TABLE width=600 bgcolor=black border=1 align=center cellpadding=4 cellspacing=0>"; echo "<tr>"; echo "<td width='35%'><a style='text-decoration:none' href='http://localhost/profile/index.php?user=$user'><FONT FACE='ariel' SIZE='2'>$userq<p>"; echo "$city, $mycountry $sex</a></FONT></td>"; echo "</tr>"; } } if(isset($_POST['sexf']) and ($_POST['country']) and ($_POST['submit'])){$query .= "and `sex` = 'female' ";} ?>
it would display only the first query
i then did this
<?php if(isset($_POST['submit']) and ($_POST['country'])) { $postuser = "{$_POST['username']}"; $postcountry = "{$_POST['country']}"; $query = "SELECT * FROM users WHERE country='$postcountry'"; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)){ $user = "{$row['id']}"; $userq = "{$row['username']}"; $mycountry = "{$row['country']}"; $sex = "{$row['sex']}"; $city = "{$row['city']}"; echo "<TABLE width=600 bgcolor=black border=1 align=center cellpadding=4 cellspacing=0>"; echo "<tr>"; echo "<td width='35%'><a style='text-decoration:none' href='http://localhost/profile/index.php?user=$user'><FONT FACE='ariel' SIZE='2'>$userq<p>"; echo "$city, $mycountry $sex</a></FONT></td>"; echo "</tr>"; } } if(isset($_POST['sexf']) and ($_POST['country']) and ($_POST['submit'])) { $postuser = "{$_POST['username']}"; $postcountry = "{$_POST['country']}"; $postsexf = "{$_POST['sexf']}"; $query2 .= "SELECT * FROM users WHERE country='$postcountry' and sex='$postsexf'"; $result2 = mysql_query($query2); while ($row2 = mysql_fetch_assoc($result2)){ $user2 = "{$row2['id']}"; $userq2 = "{$row2['username']}"; $mycountry2 = "{$row2['country']}"; $sex2 = "{$row2['sex']}"; $city2 = "{$row2['city']}"; echo "<TABLE width=600 bgcolor=black border=1 align=center cellpadding=4 cellspacing=0>"; echo "<tr>"; echo "<td width='35%'><a style='text-decoration:none' href='http://localhost/profile/index.php?user=$user2'><FONT FACE='ariel' SIZE='2'>$userq2<p>"; echo "$city2, $mycountry2 $sex2</a></FONT></td>"; echo "</tr>"; }?>
at which i got the result i was looking for but it loops so i see the first result and this result
-
hi i want to make a search based on the options selected
i tried using elseif statements before and i did it this way as well...i want it so that if an option is selected that mysql will search the db based on the criteria selected...
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table border="0" height="500" bgcolor="#5f5f5f" align="center"> <tr><td align="center" bgcolor="black"><b><h3>Search Criteria</b></tr></td> <td align="center" bgcolor="#DEDAD7"><b><h4>RESULTS</b></td> <tr><td align="center" font="red"><h5>ADVERTISMENTS</tr></td> <tr><td><b>Username:</b> <input type="text" name="username" maxlength="50" value="username" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;"><p> <b>Gender:</b><p> <input type="radio" name="sexm" value="male" align="left"> Male <br> <input type="radio" name="sexf" value="female" align="right"> Female <p> <b>Age:</b> <input type="text" name="age1" maxlength="02" size="01" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;"> To <input type="text" name="age2" maxlength="02" size="01" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;"> <p> <b>Country:</b> <select name="country" type="country" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72A4D2;"> <option value="USA" selected>USA</option> <option value="UK">UK</option> <option value="Albania">Albania</option> <option value="Algeria">Algeria</option> <option value="American Samoa">American Samoa</option> <option value="Andorra">Andorra</option> <option value="Angola">Angola</option> <option value="Anguilla">Anguilla</option> <option value="Antigua">Antigua</option> <option value="Argentina">Argentina</option> <option value="Armenia">Armenia</option> <option value="Aruba">Aruba</option> <option value="Australia">Australia</option> <option value="Austria">Austria</option> <option value="Azerbaijan">Azerbaijan</option> <option value="Bahamas">Bahamas</option> <option value="Bahrain">Bahrain</option> <option value="Bangladesh">Bangladesh</option> <option value="Barbados">Barbados</option> <option value="Barbuda">Barbuda</option> <option value="Belgium">Belgium</option> <option value="Belize">Belize</option> <option value="Benin">Benin</option> <option value="Bermuda">Bermuda</option> <option value="Bhutan">Bhutan</option> <option value="Bolivia">Bolivia</option> <option value="Bonaire">Bonaire</option> <option value="Botswana">Botswana</option> <option value="Brazil">Brazil</option> <option value="Virgin islands">British Virgin isl.</option> <option value="Brunei">Brunei</option> <option value="Bulgaria">Bulgaria</option> <option value="Burundi">Burundi</option> <option value="Cambodia">Cambodia</option> <option value="Cameroon">Cameroon</option> <option value="Canada">Canada</option> <option value="Cape Verde">Cape Verde</option> <option value="Cayman isl">Cayman Islands</option> <option value="Central African Rep">Central African Rep.</option> <option value="Chad">Chad</option> <option value="Channel isl">Channel Islands</option> <option value="Chile">Chile</option> <option value="China">China</option> <option value="Colombia">Colombia</option> <option value="Congo">Congo</option> <option value="cook isl">Cook Islands</option> <option value="Costa Rica">Costa Rica</option> <option value="Croatia">Croatia</option> <option value="Curacao">Curacao</option> <option value="Cyprus">Cyprus</option> <option value=" Czech Republic">Czech Republic</option> <option value= "Denmark">Denmark</option> <option value="Djibouti">Djibouti</option> <option value="Dominica">Dominica</option> <option value="Dominican Republic">Dominican Republic</option> <option value="Ecuador">Ecuador</option> <option value="Egypt">Egypt</option> <option value="El Salvador">El Salvador</option> <option value="Equatorial Guinea">Equatorial Guinea</option> <option value="Eritrea">Eritrea</option> <option value="Estonia">Estonia</option> <option value="Ethiopia">Ethiopia</option> <option value="Faeroe isl">Faeroe Islands</option> <option value="Fiji">Fiji</option> <option value="Finland">Finland</option> <option value="France">France</option> <option value="French Guiana">French Guiana</option> <option value="French Polynesia">French Polynesia</option> <option value="Gabon">Gabon</option> <option value="Gambia">Gambia</option> <option value="Georgia">Georgia</option> <option value="Gemany">Germany</option> <option value="Ghana">Ghana</option> <option value="Gibraltar">Gibraltar</option> <option value="GB">Great Britain</option> <option value="Greece">Greece</option> <option value="Greenland">Greenland</option> <option value="Grenada">Grenada</option> <option value="Guadeloupe">Guadeloupe</option> <option value="Guam">Guam</option> <option value="Guatemala">Guatemala</option> <option value="Guinea">Guinea</option> <option value="Guinea Bissau">Guinea Bissau</option> <option value="Guyana">Guyana</option> <option value="Haiti">Haiti</option> <option value="Honduras">Honduras</option> <option value="Hong Kong">Hong Kong</option> <option value="Hungary">Hungary</option> <option value="Iceland">Iceland</option> <option value="India">India</option> <option value="Indonesia">Indonesia</option> <option value="Irak">Irak</option> <option value="Iran">Iran</option> <option value="Ireland">Ireland</option> <option value="Northern Ireland">Ireland, Northern</option> <option value="Israel">Israel</option> <option value="Italy">Italy</option> <option value="Ivory Coast">Ivory Coast</option> <option value="Jamaica">Jamaica</option> <option value="Japan">Japan</option> <option value="Jordan">Jordan</option> <option value="Kazakhstan">Kazakhstan</option> <option value="Kenya">Kenya</option> <option value="Kuwait">Kuwait</option> <option value="Kyrgyzstan">Kyrgyzstan</option> <option value="Latvia">Latvia</option> <option value="Lebanon">Lebanon</option> <option value="Liberia">Liberia</option> <option value="Liechtenstein">Liechtenstein</option> <option value="Lithuania">Lithuania</option> <option value="Luxembourg">Luxembourg</option> <option value="Macau">Macau</option> <option value="Macedonia">Macedonia</option> <option value="Madagascar">Madagascar</option> <option value="Malawi">Malawi</option> <option value="Malaysia">Malaysia</option> <option value="Maldives">Maldives</option> <option value="Mali">Mali</option> <option value="Malta">Malta</option> <option value="Marshall isl">Marshall Islands</option> <option value="Martinique">Martinique</option> <option value="Mauritania">Mauritania</option> <option value="Mauritius">Mauritius</option> <option value="Mexico">Mexico</option> <option value="Micronesia">Micronesia</option> <option value="Moldova">Moldova</option> <option value="Monaco">Monaco</option> <option value="Mongolia">Mongolia</option> <option value="Montserrat">Montserrat</option> <option value="Morocco">Morocco</option> <option value="Mozambique">Mozambique</option> <option value="Myanmar">Myanmar/Burma</option> <option value="Namibia">Namibia</option> <option value="Nepal">Nepal</option> <option value="Netherlands">Netherlands</option> <option value="Netherlands Antilles">Netherlands Antilles</option> <option value="New Caledonia">New Caledonia</option> <option value="New Zealand">New Zealand</option> <option value="Nicaragua">Nicaragua</option> <option value="Niger">Niger</option> <option value="Nigeria">Nigeria</option> <option value="Norway">Norway</option> <option value="Oman">Oman</option> <option value=""Palau>Palau</option> <option value="Panama">Panama</option> <option value="Papua New Guinea">Papua New Guinea</option> <option value="Paraguay">Paraguay</option> <option value="Peru">Peru</option> <option value="Philippines">Philippines</option> <option value="Poland">Poland</option> <option value="Portugal">Portugal</option> <option value="Puerto Rico">Puerto Rico</option> <option value="Qatar">Qatar</option> <option value="Reunion">Reunion</option> <option value="Rwanda">Rwanda</option> <option value="Saba">Saba</option> <option value="Saipan">Saipan</option> <option value="Saudi Arabia">Saudi Arabia</option> <option value="Scotland">Scotland</option> <option value="Senegal">Senegal</option> <option value="Seychelles">Seychelles</option> <option value="Sierra Leone">Sierra Leone</option> <option value="Singapore">Singapore</option> <option value="Slovac Republic">Slovak Republic</option> <option value="Slovenia">Slovenia</option> <option value="South Africa">South Africa</option> <option value="South Korea">South Korea</option> <option value="Spain">Spain</option> <option value="Sri Lanka">Sri Lanka</option> <option value="Sudan">Sudan</option> <option value="Suriname">Suriname</option> <option value="Swaziland">Swaziland</option> <option value="Sweden">Sweden</option> <option value="Switzerland">Switzerland</option> <option value="Syria">Syria</option> <option value="Taiwan">Taiwan</option> <option value="Tanzania">Tanzania</option> <option value="Thailand">Thailand</option> <option value="Togo">Togo</option> <option value="Trinidad-Tobago">Trinidad-Tobago</option> <option value="Tunesia">Tunisia</option> <option value="Turkey">Turkey</option> <option value="Turkmenistan">Turkmenistan</option> <option value="United Arab Emirates">United Arab Emirates</option> <option value="U.S. Virgin isl">U.S. Virgin Islands</option> <option value="USA">U.S.A.</option> <option value="Uganda">Uganda</option> <option value="United Kingdom">United Kingdom</option> <option value="Urugay">Uruguay</option> <option value="Uzbekistan">Uzbekistan</option> <option value="Vanuatu">Vanuatu</option> <option value="Vatican City">Vatican City</option> <option value="Venezuela">Venezuela</option> <option value="Vietnam">Vietnam</option> <option value="Wales">Wales</option> <option value="Yemen">Yemen</option> <option value="Zaire">Zaire</option> <option value="Zambia">Zambia</option> <option value="Zimbabwe">Zimbabwe</option> </select><p> <input type="submit" name="submit" value="submit"> </tr></td> <td width="600" bgcolor="#DEDAD7"><?php // Connects to your Database mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); //This code runs if the form has been submitted if (isset($_POST['submit'])) { $postuser = "{$_POST['username']}"; $postcountry = "{$_POST['country']}"; $query = "SELECT * FROM users WHERE username = '$postuser' and country ='$postcountry'"; $result = mysql_query($query); $row = mysql_fetch_assoc($result); $user = "{$row['id']}"; $userq = "{$row['username']}"; $mycountry = "{$row['country']}"; $sex = "{$row['sex']}"; $city = "{$row['city']}"; echo "<TABLE width=600 bgcolor=black border=1 align=center cellpadding=4 cellspacing=0>"; echo "<tr>"; echo "<td width='35%'><a style='text-decoration:none' href='http://localhost/profile/index.php?user=$user'><FONT FACE='ariel' SIZE='2'>$userq<p>"; echo "$city, $mycountry $sex</a></FONT></td>"; echo "</tr>"; } ?> </td> </table> </form> <? } ?>
-
using ifram i should have set transparency....duh to myself
-
ye that works the way i wanted it too...thanks both of u guys and other way workds as well
-
i tried inside the syntax and outside with div...if outside i get the image in binary data while inside the syntax
<?php $query = mysql_query('SELECT image FROM `tbl_images` WHERE `userid`= "'.$id.'"'); $row = mysql_fetch_assoc($query); $content = $row['image']; $desired_width = 40; $desired_height = 40; $im = imagecreatefromstring($content)or die("Can not select the database: ".mysql_error());; $new = imagecreatetruecolor($desired_width, $desired_height)or die("Can not select the database: ".mysql_error());; $x = imagesx($im); $y = imagesy($im); imagecopyresampled($new, $im, 0, 0, 0, 0, $desired_width, $desired_height, $x, $y)or die("Can not select the database: ".mysql_error());; imagedestroy($im); header('Content-type: ' . $row['type'] .''); echo "<div background-color:green;'>imagejpeg($new, null, 85)</div>"; } ?>
i get nothing shown
did i place the div syntax wrong
-
im trying to get a background colour for my photos
but it keeps messing up when i put an actual colour, wheter in html
<body bgcolor="black">
outside the php or within the php syntax
-
my mistake, i must have been trying to call something new...do u know if there is a way though to have a backgorund color to an image...right now my image shows from an iframe and the page color is white...if i use html to change the page color my photo turns back into binary data
-
im trying to have a background color for my image
<?php body('background-color: red' ); header('Content-type: ' . $row['type'] .''); imagejpeg($new, null, 85); ?>
a body function doesn't work
-
I have an iframe set up on one of my pages and i want to get the url a variable from the web browser that it's in...is it possible?
if(is_numeric($_GET['user'])){ $idu = $_GET['user']; }
that works if there is no i frame but can i put this in an iframe and still get the user from the url?
-
-
should i start off like that
$id = 2; if(!isset($id) || empty($id)){ die("Please select your image!"); }else{ $query = mysql_query('SELECT * FROM `tbl_images` WHERE `id`= "'.$id.'"'); $row = mysql_fetch_assoc($query); $content = $row['image']; header('Content-type: ' . $row['type'] .''); $newimage = imagecreatefromstring($content); } ?>
-
do u know if it is possible
im trying stuff but nothing works
-
hey i need to resize an image that is already inserted into mysql
my code so far is
<?php $id = 2; if(!isset($id) || empty($id)){ die("Please select your image!"); }else{ $query = mysql_query('SELECT * FROM `tbl_images` WHERE `id`= "'.$id.'"'); $row = mysql_fetch_assoc($query); $content = $row['image']; header('Content-type: ' . $row['type'] .''); print $content; } ?>
where should i start the image resize...
or am i going about wrong and i should resize the image before i inject it into mysql
-
bubbasheeko is a good programmer...
-
it seems as if this code works ... thanks
files needed settings.php,install.php,index.php,insert.php, view.index.php
settings
<?php // Create MySQL login values and // set them to your login information. $username = ""; $password = ""; $host = ""; $database = ""; // Make the connect to MySQL or die // and display an error. $link = mysql_connect($host, $username, $password); if (!$link) { die('Could not connect: ' . mysql_error()); } $connect = mysql_select_db($database) or die("Can not select the database: ".mysql_error()); ?>
install
<?php // Install table include('settings.php'); $create_table = mysql_query("CREATE TABLE `tbl_images` (id tinyint(3) unsigned NOT NULL auto_increment, image blob NOT NULL, filetype varchar(25) NOT NULL, PRIMARY KEY (id))") or die('Unable to complete table installation" ' . mysql_error()); echo "Tables installed correctly"; ?>
<?php include('settings.php'); ?> <!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> </head> <body> <form enctype="multipart/form-data" action="insert.php" method="post" name="changer"> <input name="MAX_FILE_SIZE" value="102400" type="hidden"> <input name="image" accept="image/jpeg" type="file"> <input value="Submit" type="submit"> </body> </html>
<?php include('settings.php'); // Make sure the user actually // selected and uploaded a file if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) { // Temporary file name stored on the server $tmpName = $_FILES['image']['tmp_name']; $fileType = $_FILES['image']['type']; // Read the file $fp = fopen($tmpName, 'r'); $data = fread($fp, filesize($tmpName)); $data = addslashes($data); fclose($fp); // Create the query and insert // into our database. $query = "INSERT INTO `tbl_images` (`image`, `filetype`) VALUES ('" . $data . "', '" . $fileType . "')"; $results = mysql_query($query) or die(mysql_error()); // Print results print "Thank you, your file has been uploaded."; // GET LINK $data_query = mysql_query('SELECT `id` FROM `tbl_images` WHERE `image` = "' . $data . '" LIMIT 1') or die(mysql_error()); $data = mysql_fetch_assoc($data_query); echo "<p>Click to view the image: <a href='view.php?id=" . $data['id'] . "'>Image " . $data['id'] . "</a>"; } else { print "No image selected/uploaded"; } // Close our MySQL Link mysql_close($link); ?>
view ir
<?php include('settings.php'); $id = $_GET['id']; if(!isset($id) || empty($id)){ die("Please select your image!"); }else{ $query = mysql_query('SELECT * FROM `tbl_images` WHERE `id`= "'.$id.'"'); $row = mysql_fetch_assoc($query); $content = $row['image']; header('Content-type: ' . $row['type'] .''); print $content; } ?>
-
-
btw im also checking the other script from the link on another page, for some reason i find that it uploads but i can't view it...lol...i guess bad luck i read the comments some people solved it but many people had the same problem
im not trying to confuse u but that code was
<?php // Connect to database $errmsg = ""; if (! @mysql_connect("localhost","root","")) { $errmsg = "Cannot connect to database"; } @mysql_select_db("registration"); // Insert any new image into database if ($_REQUEST[completed] == 1) { // Need to add - check for large upload. Otherwise the code // will just duplicate old file ;-) // ALSO - note that latest.img must be public write and in a // live appliaction should be in another (safe!) directory. move_uploaded_file($_FILES['imagefile']['tmp_name'],"latest.img"); $instr = fopen("latest.img","rb"); $image = addslashes(fread($instr,filesize("latest.img"))); if (strlen($instr) < 149000) { mysql_query ("insert into pix (title, imgdata) values (\"". $_REQUEST[whatsit]. "\", \"". $image. "\")"); } else { $errmsg = "Too large!"; } } // Find out about latest image $gotten = @mysql_query("select * from pix order by pid desc limit 1"); if ($row = @mysql_fetch_assoc($gotten)) { $title = htmlspecialchars($row[title]); $bytes = $row[imgdata]; } else { $errmsg = "There is no image in the database yet"; $title = "no database image available"; // Put up a picture of our training centre $instr = fopen("../wellimg/ctco.jpg","rb"); $bytes = fread($instr,filesize("../wellimg/ctco.jpg")); } // If this is the image request, send out the image if ($_REQUEST[gim] == 1) { header("Content-type: image/jpeg"); print $bytes; exit (); } ?> <html><head> <title>Upload an image to a database</title> <body bgcolor=white><h2>Here's the latest picture</h2> <font color=red><?= $errmsg ?></font> <center><img src=?gim=1 width=144><br> <b><?= $title ?></center> <hr> <h2>Please upload a new picture and title</h2> <form enctype=multipart/form-data method=post> <input type=hidden name=MAX_FILE_SIZE value=150000> <input type=hidden name=completed value=1> Please choose an image to upload: <input type=file name=imagefile><br> Please enter the title of that picture: <input name=whatsit><br> then: <input type=submit></form><br> <hr> By Graham Ellis - graham@wellho.net </body> </html>
-
for some reason still no image
<?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); $gotten = mysql_query("select * from image WHERE id = '1'"); if ($row = mysql_fetch_assoc($gotten)) { $title = htmlspecialchars($row['name']); $bytes = $row['content']; } else { $errmsg = "There is no image in the database yet"; $title = "no database image available"; } // If this is the image request, send out the image if ($_REQUEST[gim] == 1) { header("Content-type: image/gif"); print ($bytes); exit (); } ?>
-
ok i put this
<?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); $gotten = mysql_query("select * from image WHERE id = '1'"); if ($row = mysql_fetch_assoc($gotten)) { $title = htmlspecialchars($row[name]); $bytes = $row[content]; } else { $errmsg = "There is no image in the database yet"; $title = "no database image available"; } // If this is the image request, send out the image if ($_REQUEST[gim] == 1) { header("Content-type: image/gif"); print $bytes; exit (); } ?>
i didn't get any binary data but i didn't get any data at all
-
or am i in the wrong spot
-
i guess im supposed to be looking at this?
$gotten = mysqli_query($link,"select * from pix order by pid desc limit 1"); if ($row = mysqli_fetch_assoc($gotten)) { $title = htmlspecialchars($row[title]); $bytes = $row[imgdata]; } else { $errmsg = "There is no image in the database yet"; $title = "no database image available"; } // If this is the image request, send out the image if ($_REQUEST[gim] == 1) { header("Content-type: image/jpeg"); print $bytes; exit (); } ?>
which is in the comment
friends in common
in PHP Coding Help
Posted
i would have to call both tables for both users and find similarities with friends