Gem
-
Posts
129 -
Joined
-
Last visited
Posts posted by Gem
-
-
The class ($this) does not have the function isPost() ...
-
Can my name be changed to Gem please, or GemGale if Gem is already taken? Im always on IRC as Gem
Thank you
-
Alternatively someone post all the logs where Alexi is rude and condescending to almost everyone who she talks to, people who are usually trying to help her.
Frost is a very helpful and friendly member of the community, and a very good op in IRC, and to see him being "reported" is just not cool.
-
-
where have you defined $title?
-
var_dump($_POST['title']);
you might want to add method="post" to your form tag though ...
-
<?php $cnn = mysql_connect("localhost","root",""); mysql_select_db("hms",$cnn); $month=$_GET['q']; $html = "<strong>$month</strong> Month Report"; //$string="2004-12-28"; $result=mysql_query("SELECT monthname(date) As newd FROM stock_entries WHERE monthname(date)='".$month."' "); if(!$result) die(mysql_error()); $html .= "<table border='1'>"; while($row = mysql_fetch_array($result)) { $html.= "<tr>"; // echo "<td>" . date("m",strtotime($row['date'])) . "</td>"; $html .= "<td>" . $row['newd'] . "</td>"; //echo "<td>" . $row[''] . "</td>"; //echo "<td>" . $row[''] . "</td>"; //echo "<td>" . $row[''] . "</td>"; $html .= "</tr>"; } $html .= "</table>"; echo $html; ?>
-
I forgot to say, I'm struggling because I need to paginate the comments. I need to page only at a parent, i.e not splitting child comments over seperate pages (planning to use js to show/hide the replies) so I'm wanting like say 5 parent comments, plus all their children per page. This is why I'm looking for a query to put them in the right order ...
-
Hi guys,
Was wondering if someone could help me with a query. Here is my table structure:
commID int(11)
postID int(4)
replyto int(6)
depth int(2)
timestamp int(11)
name varchar(100)
email varchar(100)
comment text
So what I'm trying to get is the comments in order. The order I need is:
comment 1 - parent
comment 2 - parent
comment 5 - reply to comment 2
comment 6 - another reply to comment 2
comment 7 - reply to comment 6 which is a reply to comment 2
comment 3 - parent
comment 4 - reply to comment 3
and so on. There is no limit to how many levels of children there can be per parent.
I'm hoping this makes sense :S
Can you help?
Many thanks
Gem
-
Thank you, I read it, and tried to implement it, but now the whole thing doesnt work ... all I got is a blank page? I've obviously done it wrong ... can someone please look at this code and if poss. debug it? I've spent an hour looking at it and I cant find the problem
(i've commented it to make it easier to read)
<?php // database stuff ini_set("memory_limit","120M"); include ("dbconnect"); include ("check admin"); // check user is an admin, if not return to log in screen if ($admin != 1) { header("location:./login.php"); } // if user is an admin, do this ... else { // define a maximum sizes for the uploaded images define ("MAX_SIZE","5000"); define ("WIDTH","150"); define ("HEIGHT","100"); // Get extention function function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // *********************************************************************** Create the thumnail ******************************************************** function make_thumb($img_name,$filename,$new_w,$new_h) { // get extension $ext=getExtension($img_name); if(!strcmp("jpg",$ext) || !strcmp("jpeg",$ext)) $src_img=imagecreatefromjpeg($img_name); if(!strcmp("png",$ext)) $src_img=imagecreatefrompng($img_name); // gets the dimmensions of the image $old_x=imageSX($src_img); $old_y=imageSY($src_img); // Calculate new dimentions $ratio1=$old_x/$new_w; $ratio2=$old_y/$new_h; if($ratio1>$ratio2) { $thumb_w=$new_w; $thumb_h=$old_y/$ratio1; } else { $thumb_h=$new_h; $thumb_w=$old_x/$ratio2; } // create a new image with the new dimmensions $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); // resize the original image to the new created one imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); // output the created image to the file. Now we will have the thumbnail into the file named by $filename if(!strcmp("png",$ext)) imagepng($dst_img,$filename); else imagejpeg($dst_img,$filename); //destroys source and destination images. imagedestroy($dst_img); imagedestroy($src_img); } //****************************************************************END create thumbnail ********************************************************* // Error Check! $errors=0; if(isset($_POST['submit1']) && !$errors) { $sqlalbum="INSERT INTO album (album_name) VALUES ('$_POST[newalbumname]')"; mysql_query($sqlalbum) or die ('Error, album_query failed : ' . mysql_error()); } foreach ($_FILES['image']['name']{// ----------------------check the form has been submitted------------------------ if(isset($_POST['Submit'])) { // .................................................................... foreach() ?????? LOOOOOOOOPPPPP START ??? //read the name of the file submitted $image=$_FILES['image']['name']; //...............................array here????? // if it is not empty if ($image) { // get the original name $filename = stripslashes($_FILES['image']['name']); // get the extension of the file in a lower case format $extension = getExtension($filename); $extension = strtolower($extension); // if it is not a jpg, jpeg or png show error and dont upload if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { echo '<h1>Unknown extension! You can only upload jpg, jpeg and png files</h1>'; $errors=1; } // if its ok .... else { // get the size of the image in bytes $size=getimagesize($_FILES['image']['tmp_name']); $sizekb=filesize($_FILES['image']['tmp_name']); //compare the size with the maximum size we defined and print error if bigger if ($sizekb > MAX_SIZE*1024) { echo '<h1>You have exceeded the size limit!</h1>'; $errors=1; } //give the image a unique name $image_name=time().'.'.$extension; //the new name will be containing the full path where will be stored (images folder) $newname="uploads/".$image_name; $copied = copy($_FILES['image']['tmp_name'], $newname); //we verify if the image has been uploaded, and print error instead if (!$copied) { echo '<h1>Copy unsuccessfull!</h1>'; $errors=1; } else { // the new thumbnail image will be placed in images/thumbs/ folder $thumb_name='uploads/thumbs/thumb_'.$image_name; // call the function that will create the thumbnail. The function will get as parameters //the image name, the thumbnail name and the width and height desired for the thumbnail $thumb=make_thumb($newname,$thumb_name,WIDTH,HEIGHT); }} }} //If no errors registred, print the success message and show the thumbnail image created if(isset($_POST['Submit']) && !$errors) { $album = $_POST['album']; $query = "INSERT INTO upload (name, path, album_id, thumbpath ) ". "VALUES ('$image_name', '$newname' , '$album', '$thumb_name')"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); echo "<h1>Thumbnail created Successfully!</h1>"; echo '<img src="'.$thumb_name.'">'; } // END LOOOPPPPPP ???? } ?> <!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"><!-- InstanceBegin template="/Templates/templ8t.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="css/layout.css" rel="stylesheet" type="text/css" /> <link href="css/text.css" rel="stylesheet" type="text/css" /> <!-- InstanceBeginEditable name="doctitle" --> <title>Bradley Stoke Judo Club</title> <!-- InstanceEndEditable --> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> <style type="text/css"> <!-- .style1 {color: #FFFFFF} .H2 { font-size: x-large; font-family: Arial, Helvetica, sans-serif; background-color: #FFFF00; } .link {color: #FFFF33} --> </style> </head> <body> <?php echo $errors; ?> <div class="wrapper"> <div class="header"> </div> <div class="body"> <!-- InstanceBeginEditable name="bodytext" --> <center> <span class="pagetitle">Upload New Images</span><br /> <h1> Step 1 </h1> Check that the album you wish to add a image to exists in the list below ( -Albums- ).<br /> If not - add a new album name here... <form name="newalbum" method="post" action=""> <input name="newalbumname" type="text" size="30" maxlength="30" value="<?php echo $newalbumname; ?>" /> <input type="submit" name="submit1" value="Create Album" /> </form> <h1> Step 2 </h1> If the album exists (or you just created one) select it from the list below. Click browse - find the image you want - press upload.<br /> You should see a thumbnail of the image above if it worked. Add another image if necessary <br /> <form name="newad" method="post" enctype="multipart/form-data" action=""> <table> <tr><td><select name="album"> <option value="select" selected="selected" >-Albums-</option> <?php $asql="select * from album order by album_id DESC"; $aresult=mysql_query($asql) or die(mysql_error());; while($arow=mysql_fetch_array($aresult)) { $album_id=$arow['album_id']; $album_name=$arow['album_name']; ?> <option value="<?php echo $album_id; ?>"><?php echo $album_name; ?></option> <?php } ?> </select> <tr><td><input type="file" name="image[]" ></td></tr> <tr><td><input type="file" name="image[]" ></td></tr> <!-- <tr><td><input type="file" name="image[]" ></td></tr> <tr><td><input type="file" name="image[]" ></td></tr> <tr><td><input type="file" name="image[]" ></td></tr> <tr><td><input type="file" name="image[]" ></td></tr> <tr><td><input type="file" name="image[]" ></td></tr> <tr><td><input type="file" name="image[]" ></td></tr> <tr><td><input type="file" name="image[]" ></td></tr> <tr><td><input type="file" name="image[]" ></td></tr> --> <tr><td><input name="Submit" type="submit" value="Upload image"></td></tr> </table> </form> <!-- InstanceEndEditable --> </div> <div class="sidebar"> <!-- MENU --> <BR><?php include "includes/menujs.js"; include "includes/menucss.css"; include "includes/menu.html"; ?> </p> <p> <!-- InstanceBeginEditable name="sidebar2" --> <div class="sidebartitle" align="center"> Quick Links</div> <div class="sidebartext" align="center"> <br /><a href="index.php"><h2>Home</h2></a><br /> <?php if ($user != "y") { $login_text = "Login"; } else { $login_text = "Logout"; } ?> <a href="login.php"><h2><?php echo $login_text; ?></h2></a><br /> <?php if ($user == "y"){ ?> <a href="profile.php?username=<?php echo $username; ?>"><h2>Back to Profile</h2></a><br /> <?php } ?> </div> <div class="sidebartitle" align="center"> Sponser </div> <div class="sidebartext" align="center"> <img src="images/proemblogo.jpg" alt="professionalembroidery" /></div> <!-- InstanceEndEditable --> </p> </div> </div> <div class="clear"></div> <div class="copyright"> <div align="center" class="style1">©Copyright 2010 Bradley Stoke Judo Club || Site Designed by Gem Gale || Site Hosted by <a href="http://www.wotwebsystems.com" class="link">WOT Web Systems</a></div> </div> <?php if ($con) { mysql_close($con);} ?> </body> <!-- InstanceEnd --></html> <?php } ?>
-
Hi everybody
I am new to arrays, and loops pretty much, so please dont be mean!
I am trying to turn a single upload form into a multiple upload form. My logic is I need to use arrays and loop the code for uploading the data from the form to the database (for each of these files, create a thumbnail, resize and rename original, move to folder, create path, and insert all that information into the db)
But I have no idea how
I've got this in the form (now) ....
<pick an album to put the files into>
<input type="file" name="image[]" >
<input type="file" name="image[]" >
and this is the code for the whole upload. It worked for single uploads ... but I'm now at a loss ...
The code is abit messy, sorry. I'm fairly sure I need a foreach loop, but I dont know where to put it
Really Really hoping you can help. Many thanks in advance
<?php ini_set("memory_limit","120M"); include ("DBCONNECT"); include ("CHECK ADMIN"); if ($admin != 1) { header("location:./login.php"); } else { define ("MAX_SIZE","5000"); define ("WIDTH","150"); define ("HEIGHT","100"); function make_thumb($img_name,$filename,$new_w,$new_h) { $ext=getExtension($img_name); if(!strcmp("jpg",$ext) || !strcmp("jpeg",$ext)) $src_img=imagecreatefromjpeg($img_name); if(!strcmp("png",$ext)) $src_img=imagecreatefrompng($img_name); $old_x=imageSX($src_img); $old_y=imageSY($src_img); $ratio1=$old_x/$new_w; $ratio2=$old_y/$new_h; if($ratio1>$ratio2) { $thumb_w=$new_w; $thumb_h=$old_y/$ratio1; } else { $thumb_h=$new_h; $thumb_w=$old_x/$ratio2; } $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); Imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); if(!strcmp("png",$ext)) imagepng($dst_img,$filename); else imagejpeg($dst_img,$filename); imagedestroy($dst_img); imagedestroy($src_img); } function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $errors=0; if(isset($_POST['submit1']) && !$errors) { $sqlalbum="INSERT INTO album (album_name) VALUES ('$_POST[newalbumname]')"; mysql_query($sqlalbum) or die ('Error, album_query failed : ' . mysql_error()); } If(isset($_POST['Submit'])) { $image=$_FILES['image']['name']; // if it is not empty if ($image) { $filename = stripslashes($_FILES['image']['name']); $extension = getExtension($filename); $extension = strtolower($extension); if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { echo '<h1>Unknown extension! You can only upload jpg, jpeg and png files</h1>'; $errors=1; } else { $size=getimagesize($_FILES['image']['tmp_name']); $sizekb=filesize($_FILES['image']['tmp_name']); //compare the size with the maxim size we defined and print error if bigger if ($sizekb > MAX_SIZE*1024) { echo '<h1>You have exceeded the size limit!</h1>'; $errors=1; } $image_name=time().'.'.$extension; $newname="uploads/".$image_name; $copied = copy($_FILES['image']['tmp_name'], $newname); if (!$copied) { echo '<h1>Copy unsuccessfull!</h1>'; $errors=1; } else { $thumb_name='uploads/thumbs/thumb_'.$image_name; $thumb=make_thumb($newname,$thumb_name,WIDTH,HEIGHT); }} }} If(isset($_POST['Submit']) && !$errors) { $album = $_POST['album']; $query = "INSERT INTO upload (name, path, album_id, thumbpath ) ". "VALUES ('$image_name', '$newname' , '$album', '$thumb_name')"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); echo "<h1>Thumbnail created Successfully!</h1>"; echo '<img src="'.$thumb_name.'">'; } ?>
-
Wow - That looks pretty complicated! Anyway, I uploaded the code, fixed a couple of syntex errors but I get a HTTP500
You know where you wrote //generate where clause ... amI supposed to write something there??
Am such a noob, sorry!!
x
-
im not very good at explaining things ... did u take a look at the page?
ummm ...
when you select something in the dropdown boxes, itwill query the database and then display the results underneath.
when you select a competition, and leave the others SHOWALL, it displays all the results from that competition i.e. Gem - World Masters - 2010 - Gold
Pete - World Masters - 2010 - Gold
Nick - World Masters - 2008 - Silver
When you select a competition and year (i.e.world masters and 2010) - you see the 2 results
BUT
If you only select Pete, nothing shows. And if you select only 2010, nothing shows ....
Does that help?? xx
-
when you submit the form, whats in the address bar?
-
Hi everyone - this code is doing my head in!
You might want to take a look at the page as it will help me explain it better (www.bradleystokejudoclub.co.uk/inttest.php
Basically what I have is a database with the results from international competitions, and I am trying to build a kind of search for it.
I have 3 drop down boxes, one with player names, one with competiton and one with year.
The only one that works is the competiton. I can do competition + year, but not year by itself, and player doesnt work at all ....
this is the relevant code:
(before head)
<?php include("includes/dbconnect120-gem.php"); include("includes/db_auth_bits.php"); include("includes/db_stp.php"); if($_POST) { if($name == 'select') { $sql1 = ""; } else { if(($award == 'select') && ($year == 'select')) { $sql1 = "r.pname_id = '$pname'"; } else { $sql1 = "r.pname_id = '$pname' AND "; } } if($award == 'select') { $sql2 = ""; } else { if($year == 'select') { $sql2 = "r.comp_id = '$comp'"; } else { $sql2 = "r.comp_id = '$comp' AND "; } } if($year == 'select') { $sql3 = ""; } else { $sql3 = "r.year_id = '$year'"; } if(($sql1 == "") && ($sql2 == "") && ($sql3 == "")) { $where = ""; } else { $where = " WHERE "; } $sql = "select p.pname, i.comp, m.place_name, yr.year_full from intcomp_result r left join playername p on r.pname_id=p.name_id left join intcomp i on i.comp_id = r.comp_id left join place m on m.place_id = r.place_id left join yearname yr on r.year_id = yr.year_id $where $sql1 $sql2 $sql3 order by r.year_id desc, r.comp_id, r.place_id"; $search_result = mysql_query($sql); } ?>
(body)
<form method="post" action="<?php echo $PHP_SELF;?>"> Name:<select name="name"> <option value="select" selected="selected" >-SHOW ALL-</option> <?php $sql="select distinct r.pname_id, p.pname from intcomp_result r left join playername p on r.pname_id=p.name_id order by p.pname"; $result=mysql_query($sql); while($row=mysql_fetch_array($result)) { $nameid=$row['pname_id']; $pname=$row['pname']; ?> <option value="<?php echo $nameid; ?>"><?php echo $pname;?></option> <?php } ?> </select><br /> Competition:<select name="comp"> <option value="select" selected="selected" >-SHOW ALL-</option> <?php $sql="select * from intcomp order by comp_id asc"; $result=mysql_query($sql); while($row=mysql_fetch_array($result)) { $compid=$row['comp_id']; $comp=$row['comp']; ?> <option value="<?php echo $compid; ?>"><?php echo $comp;?></option> <?php } ?> </select><br /> Year:<select name="year"> <option value="select" selected="selected" >-SHOW ALL-</option> <?php $sql="select distinct r.year_id, y.year_full from intcomp_result r left join yearname y on r.year_id=y.year_id order by y.year_id"; $result=mysql_query($sql); while($row=mysql_fetch_array($result)) { $yearid=$row['year_id']; $year=$row['year_full']; ?> <option value="<?php echo $yearid; ?>"><?php echo $year;?></option> <?php } ?> </select><br /> <input name="Submit" type="submit" class="button" tabindex="14" value="Submit" /> </form> <?php if(isset($search_result)) { while($row = mysql_fetch_array($search_result)) { echo $row['pname'].' - '.$row['comp'].' - '.$row['year_full'].' - '.$row['place_name'].'<br />'; } } ?>
Hope you can help! :-\
Thanks
Gem
-
look up joins mate - I'm not very good at it, but thats what you are after
-
Sorry, I think I misread what you wanted to do.
I thought you wanted an output like "3 green, 2 yellow" <- You cant do that with one query I dont think
-
Why from one query mate?
-
How are peoplesending you the data?
Are they filling in a form online?
-
COUNT(*) fruits WHERE color="green"
COUNT(*) fruits WHERE color="yellow"
-
Hey guys.
I'm using this script to handle file (picture) uploads at the moment, and it works fine. Problem is though, I need to changeit to a multiple upload form (with 10 uploads per submit) and I dont know how to do it.
I think ...
I need to change this "<input type="file" name="image" >" to an array ... and put a "for each" loop or something somewhere ... but I really don't know what I am doing.
Can someone please help?
Thanks
Gem
<?php include ("includes/dbconnect120-gem.php"); //define a maxim size for the uploaded images define ("MAX_SIZE","500"); // define the width and height for the thumbnail // note that theese dimmensions are considered the maximum dimmension and are not fixed, // because we have to keep the image ratio intact or it will be deformed define ("WIDTH","150"); define ("HEIGHT","100"); // this is the function that will create the thumbnail image from the uploaded image // the resize will be done considering the width and height defined, but without deforming the image function make_thumb($img_name,$filename,$new_w,$new_h) { //get image extension. $ext=getExtension($img_name); //creates the new image using the appropriate function from gd library if(!strcmp("jpg",$ext) || !strcmp("jpeg",$ext)) $src_img=imagecreatefromjpeg($img_name); if(!strcmp("png",$ext)) $src_img=imagecreatefrompng($img_name); //gets the dimmensions of the image $old_x=imageSX($src_img); $old_y=imageSY($src_img); // next we will calculate the new dimmensions for the thumbnail image // the next steps will be taken: // 1. calculate the ratio by dividing the old dimmensions with the new ones // 2. if the ratio for the width is higher, the width will remain the one define in WIDTH variable // and the height will be calculated so the image ratio will not change // 3. otherwise we will use the height ratio for the image // as a result, only one of the dimmensions will be from the fixed ones $ratio1=$old_x/$new_w; $ratio2=$old_y/$new_h; if($ratio1>$ratio2) { $thumb_w=$new_w; $thumb_h=$old_y/$ratio1; } else { $thumb_h=$new_h; $thumb_w=$old_x/$ratio2; } // we create a new image with the new dimmensions $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); // resize the big image to the new created one imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); // output the created image to the file. Now we will have the thumbnail into the file named by $filename if(!strcmp("png",$ext)) imagepng($dst_img,$filename); else imagejpeg($dst_img,$filename); //destroys source and destination images. imagedestroy($dst_img); imagedestroy($src_img); } // This function reads the extension of the file. // It is used to determine if the file is an image by checking the extension. function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // This variable is used as a flag. The value is initialized with 0 (meaning no error found) //and it will be changed to 1 if an errro occures. If the error occures the file will not be uploaded. $errors=0; if(isset($_POST['submit1']) && !$errors) { $sqlalbum="INSERT INTO album (album_name) VALUES ('$_POST[newalbumname]')"; mysql_query($sqlalbum) or die ('Error, album_query failed : ' . mysql_error()); } // checks if the form has been submitted if(isset($_POST['Submit'])) { //reads the name of the file the user submitted for uploading $image=$_FILES['image']['name']; // if it is not empty if ($image) { // get the original name of the file from the clients machine $filename = stripslashes($_FILES['image']['name']); // get the extension of the file in a lower case format $extension = getExtension($filename); $extension = strtolower($extension); // if it is not a known extension, we will suppose it is an error, print an error message //and will not upload the file, otherwise we continue if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { echo '<h1>Unknown extension!</h1>'; $errors=1; } else { // get the size of the image in bytes // $_FILES[\'image\'][\'tmp_name\'] is the temporary filename of the file in which the uploaded file was stored on the server $size=getimagesize($_FILES['image']['tmp_name']); $sizekb=filesize($_FILES['image']['tmp_name']); //compare the size with the maxim size we defined and print error if bigger if ($sizekb > MAX_SIZE*1024) { echo '<h1>You have exceeded the size limit!</h1>'; $errors=1; } //we will give an unique name, for example the time in unix time format $image_name=time().'.'.$extension; //the new name will be containing the full path where will be stored (images folder) $newname="uploads/".$image_name; $copied = copy($_FILES['image']['tmp_name'], $newname); //we verify if the image has been uploaded, and print error instead if (!$copied) { echo '<h1>Copy unsuccessfull!</h1>'; $errors=1; } else { // the new thumbnail image will be placed in images/thumbs/ folder $thumb_name='uploads/thumbs/thumb_'.$image_name; // call the function that will create the thumbnail. The function will get as parameters //the image name, the thumbnail name and the width and height desired for the thumbnail $thumb=make_thumb($newname,$thumb_name,WIDTH,HEIGHT); }} }} //If no errors registred, print the success message and show the thumbnail image created if(isset($_POST['Submit']) && !$errors) { $album = $_POST['album']; $query = "INSERT INTO upload (name, path, album_id, thumbpath ) ". "VALUES ('$image_name', '$newname' , '$album', '$thumb_name')"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); echo "<h1>Thumbnail created Successfully!</h1>"; echo '<img src="'.$thumb_name.'">'; } ?> <!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 name="newalbum" method="post" action=""> <input name="newalbumname" type="text" size="30" maxlength="30" value="<?php echo $newalbumname; ?>" /> <input type="submit" name="submit1" value="Create Album" /> </form> <br /> <form name="newad" method="post" enctype="multipart/form-data" action=""> <table> <tr><td><select name="album"> <option value="select" selected="selected" >-Albums-</option> <?php $asql="select * from album order by album_id DESC"; $aresult=mysql_query($asql) or die(mysql_error());; while($arow=mysql_fetch_array($aresult)) { $album_id=$arow['album_id']; $album_name=$arow['album_name']; ?> <option value="<?php echo $album_id; ?>"><?php echo $album_name; ?></option> <?php } ?> </select> <tr><td><input type="file" name="image" ></td></tr> <tr><td><input name="Submit" type="submit" value="Upload image"></td></tr> </table> </form> </body> </html>
-
hey up peeps! I'm building a photo gallery. Ive done the upload bit, but im struggling with displaying the albums, Basically I want the album thumbnail to display in a table. I can do that, but what i cant do is 2 columns ... ie. a table with 2 columns, multiple rows depending on how many albums there are...
Heres the code I have so far so you know what im on about ...
<?php include ("includes/dbconnect120-gem.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> <table> <tr><th>Album Name</th><th>Album Cover</th></tr> <?php //Get album + Thumbnail $sql="select a.album_id, a.album_name, u.thumbpath from album a left join upload u on u.album_id=a.album_id GROUP BY a.album_id"; $result=mysql_query($sql) or die(mysql_error()); while($row=mysql_fetch_array($result)) { $aid=$row['album_id']; $aname=$row['album_name']; $thumb=$row['thumbpath']; //table echo "<tr><td>"; echo $aname; echo "</td><td>"; echo '<img src="'.$thumb.'" />'; echo "</td></tr>"; } echo "</table>"; //table 1 ?> </body> </html>
And heres what I want ...
===============================
| Album name | Album name |
| --------------- | ------------------ |
| | | | | | |
| | | | | | |
| | | | | | |
| --------------- | ------------------ |
|==============================
| Album name | Album name |
| --------------- | ------------------ |
| | | | | | |
| | | | | | |
| | | | | | |
| --------------- | ------------------ |
==============================
| Album name | Album name |
| --------------- | ------------------ |
| | | | | | |
| | | | | | |
| | | | | | |
| --------------- | ------------------ |
===============================
etc etc
-
hey up peeps! I'm building a photo gallery. Ive done the upload bit, but im struggling with displaying the albums, Basically I want the album thumbnail to display in a table. I can do that, but what i cant do is 2 columns ... ie. a table with 2 columns, multiple rows depending on how many albums there are...
Heres the code I have so far so you know what im on about ...
<?php include ("includes/dbconnect120-gem.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> <table> <tr><th>Album Name</th><th>Album Cover</th></tr> <?php //Get album + Thumbnail $sql="select a.album_id, a.album_name, u.thumbpath from album a left join upload u on u.album_id=a.album_id GROUP BY a.album_id"; $result=mysql_query($sql) or die(mysql_error()); while($row=mysql_fetch_array($result)) { $aid=$row['album_id']; $aname=$row['album_name']; $thumb=$row['thumbpath']; //table echo "<tr><td>"; echo $aname; echo "</td><td>"; echo '<img src="'.$thumb.'" />'; echo "</td></tr>"; } echo "</table>"; //table 1 ?> </body> </html>
And heres what I want ...
===============================
| Album name | Album name |
| --------------- | ------------------ |
| | | | | | |
| | | | | | |
| | | | | | |
| --------------- | ------------------ |
|==============================
| Album name | Album name |
| --------------- | ------------------ |
| | | | | | |
| | | | | | |
| | | | | | |
| --------------- | ------------------ |
==============================
| Album name | Album name |
| --------------- | ------------------ |
| | | | | | |
| | | | | | |
| | | | | | |
| --------------- | ------------------ |
===============================
etc etc
-
Oh - im an idiot.
$sqlalbum="INSERT INTO album (album_name) VALUES ('$_POST[newalbumname]')";
Fixed it - thats anyway :S
Hello All!
in Introductions
Posted
Welcome to the freaks Lewis