Jump to content

coolphpdude

Members
  • Posts

    214
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

coolphpdude's Achievements

Member

Member (2/5)

0

Reputation

  1. hey people could somebody tell me what is the best way to query multiple tables. For example I am doing a website based on an estate agents for my course. A Property will have numerous features. I'll have a table in the following format ID - feature_id - feature 1 - f1 - Double garage 2 - f2 - double glazing 3 - f3 - front garden 4 - f4 - back garden something along those lines anyway! well basically what i want to do is add a property to a table then add features of that particular property. so maybe a link table between the 2, i.e: (property 1 has double glazing) property - feature p1 - f2 I'll have a couple of different tables that are relevant to things that the property includes. what i want to know is the best way to query that database so that i can out from all tables anything that is relevant to property 1. hope this makes sense cos ive actually confused myself tryin to explain this!! Cheers
  2. hi, I was told to use $_request instead of $_post or $_get. can somebody explain in plain english what $-request does and is it better/more efficient, etc... than the others. Thanks Pete
  3. your a genius and i love you!!! cheers, i knew i was missing something. Thanks for your help, works a treat!!
  4. please visit http://www.quatresaisonsvilla.com/gallery.php to see my problem! its driving me nuts!!!
  5. yeah i know, i just put that in to see if it would have any effect... but it didnt. Ive also just tried removing the valign as it was setting the image to appear at the top but that also didnt change anything.
  6. i've got the cell padding which you see within <table> tag. Im a little confused with this because i am sure the html should produce spacing with the settings i have above. I may have put this loop together wrong which is creating the problem but i cant seem to spot where i am going wrong!
  7. Hi guys, I am outputting pictures into a gallery page using a while loop. // thumbnail table echo "<table width='100%' border='0' cellspacing='0' cellpadding='10'>"; //set number of columns and initial column number $numcols = 3; // how many columns to display $numcolsprinted = 0; // no of columns so far // get the results to be displayed $query = "SELECT * FROM pics WHERE pic_id='$id'"; $mysql_result = mysql_query($query) or die (mysql_error()); // get each row while($myrow = mysql_fetch_array($mysql_result)) { //get data $pic = $myrow[0]; if ($numcolsprinted == $numcols) { print "</tr>\n<tr height ='500'>\n"; $numcolsprinted = 0; } $pic_name = $myrow["vp_thumb"]; $pic_id = $myrow["vp_id"]; // output row from database echo "<td width='300' height='500' align='center' valign='top'><img src='$pic_name' border='0'></td>\n"; // bump up row counter $numcolsprinted++; } // end while loop $colstobalance = $numcols - $numcolsprinted; for ($i=1; $i<=$colstobalance; $i++) { } print "<TD height ='500'></TD>"; echo"</table>"; The while loop works great. it outputs all of my thumbnails into a 3 column table. the problem i am having is when it outputs the next row of pictures. The next row is actually directly under the first row (i.e not a single pixel between the picture in the first row and the second row. Any idea's why it is doing this?? as you can see i've tried adding height='500' to both the <td> tags and the <tr> tag>. Cheers
  8. right, i get you now!! I was messing about trying different things for hours yesterday! do you know where php.ini will be located on my hosting??
  9. so does that mean theres a max file size set in the php.ini file thats effecting this even though i have set different perameters in the code??
  10. POST:Array ( [max_file_size] => 100000000 ) FILES:Array ( [uploadedfile] => Array ( [name] => DSCN0026.JPG [type] => [tmp_name] => [error] => 1 => 0 ) )
  11. Hi people! I've got this image upload script which im having a few problems with (please find the code below) Form: echo "<form enctype='multipart/form-data' method='post' action=uploadpicture.php'>"; echo "<input type='hidden' name='max_file_size' value='10000000' />"; echo "<input name='uploadedfile' type='file'>"; echo "<br>"; echo "<br>"; echo "<input type='submit' value='Upload Picture' >"; echo "</form>"; Now this should mean that the max file size of the picture that is to be uploaded should be no larger than 10mb. Code: $uploadedfile=$_POST["uploadedfile"]; function resampleimage($maxsize, $sourcefile, $destination, $imgcomp=0){ // SET THE IMAGE COMPRESSION $g_imgcomp=100-$imgcomp; // CHECK TO SEE IF THE IMAGE EXISTS FIRST if(file_exists($sourcefile)){ // FIRST WE GET THE CURRENT IMAGE SIZE $g_is=getimagesize($sourcefile); /********* CALCULATE THE WIDTH AND THE HEIGHT ***************/ // CHECK TO SEE IF THE WIDTH AND HEIGHT ARE ALREADY SMALLER THAN THE MAX SIZE if($g_is[0] <= $maxsize && $g_is[1] <= $maxsize){ // LEAVE WIDTH AND HEIGHT ALONE IF IMAGE IS SMALLER THAN MAXSIZE $new_width=$g_is[0]; $new_height=$g_is[1]; } else { // GET VALUE TO CALCULATE WIDTH AND HEIGHT $w_adjust = ($maxsize / $g_is[0]); $h_adjust = ($maxsize / $g_is[1]); // CHECK TO WHICH DIMENSION REQUIRES THE SMALLER ADJUSTMENT if($w_adjust <= $h_adjust){ // CALCULATE WIDTH AND HEIGHT IF THE WIDTH VALUE IS SMALLER $new_width=($g_is[0]*$w_adjust); $new_height=($g_is[1]*$w_adjust); } else { // CALCULATE WIDTH AND HEIGHT IF THE HEIGHT VALUE IS SMALLER $new_width=($g_is[0]*$h_adjust); $new_height=($g_is[1]*$h_adjust); } } //SEARCHES IMAGE NAME STRING TO SELECT EXTENSION (EVERYTHING AFTER THE LAST "." ) $image_type = strrchr($sourcefile, "."); //changes the file extension from uppercase to lowercase $lower = strtolower($image_type); //SWITCHES THE IMAGE CREATE FUNCTION BASED ON FILE EXTENSION switch($lower) { case '.jpg': $img_src = imagecreatefromjpeg($sourcefile); break; case '.jpeg': $img_src = imagecreatefromjpeg($sourcefile); break; case '.png': $img_src = imagecreatefrompng($sourcefile); break; case '.gif': $img_src = imagecreatefromgif($sourcefile); break; default: echo("Error Invalid Image Type"); die; break; } // CREATE THE TRUE COLOR IMAGE WITH NE WIDTH AND HEIGHT $img_dst=imagecreatetruecolor($new_width,$new_height); // RESAMPLE THE IMAGE TO NEW WIDTH AND HEIGHT imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0, $new_width, $new_height, $g_is[0], $g_is[1]); // OUTPUT THE IMAGE AS A JPEG. // THIS CAN BE CHANGED IF YOU WANT TRANSPARENCY OR PREFER ANOTHER FORMAT. MAKE SURE YOU CHANGE HEADER ABOVE. imagejpeg($img_dst, $destination, 100); // DESTROY THE NEW IMAGE imagedestroy($img_dst); return true; } else { return false; } } // INSERT PICTURE CODE - START if ((($_FILES["uploadedfile"]["type"] == "image/pjpeg") || ($_FILES["uploadedfile"]["type"] == "image/jpeg") || ($_FILES["uploadedfile"]["type"] == "image/JPEG") || ($_FILES["uploadedfile"]["type"] == "image/png") || ($_FILES["uploadedfile"]["type"] == "image/bmp")) && ($_FILES["uploadedfile"]["size"] < 10000000)) { echo "file uploaded"; } else { echo "file not uploaded"; } to me this all looks fine and i should be able to upload any picture with most image file types but they must be under 10Mb!! well for some reason im tryin to upload a .jpg thats 2.5mb and it won't work. Any ideas??? Cheers
  12. ahh my bad i typed that in by accident. Right im gonna give up for the night but i'll check out the server config tomorrow and post again! cheers for your help lads!
  13. sounds like what i'm after. So does an include statement just pull in code that i've written on a seperate page and then execute that before continueing through the rest of the code on my page??? I tried to google in but only came back with 2 results which wern't relative Cheers for replying
  14. Hi people, im tryin to remind myself how to do php so i've knocked together a basic page as follows... <?php echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>"; echo "<html xmlns='http://www.w3.org/1999/xhtml'>"; echo "<head>"; echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />"; echo "</head>"; // *** Connection - START *** // connect to database $db = @mysql_connect("localhost","xxxxxx","xxxxxx"); if (!$db) { do_error("Could not connect to the server"); } // Check connection - if it does not exist then go to the error function @mysql_select_db("xxxxx",$db)or do_error("Could not connect to the database"); // *** Connection - END *** echo "<html>"; // *********************** No Results ************************** function do_error($error) { echo "User not found. Please enter your login details on the right."; } echo "</html>"; ?> and it brings up the following message when i try to load that page... Error in my_thread_global_end(): 1 threads didn't exit Failed loading C:\WINDOWS\system32\inetsrv\ioncube\ioncube_loader_win_5.2.dll Is there something I have forgot to do??? Also one last thing, is there any way to write a section of code for example a query checking your username and password that you are going to use accross multiple pages and then call that. rather than having to type out that same query on each and every php page that uses it? Thanks
×
×
  • 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.