
fraser5002
Members-
Posts
33 -
Joined
-
Last visited
Never
Everything posted by fraser5002
-
Hi i have the following query for my database. $query = "SELECT * FROM entries WHERE id = '$u'"; Is there anyway i can alter this to use all but the last 3 characters from "id" for the query ( will need to obviously determine the length of id for this entry in the database first ) i.e similar to the operation of the php statement substr() Any Ideas? Thanks
-
Hi this is probably a easy question but i have been rattling my mind to it for about half an hour now . Im using an onclick event of a button to open a new webpage passing a PHP variable through the url at the moment im trying to use the following code. onclick="window.open('otherwebpage.php?itemtopassinurl=<? echo "$title[$i]"; ?>','popuppage','width=300,toolbar=1,resizable=0,scrollbars=yes,height=700,top=100,left=100')" ?>' I know i cant use the " " in the php bit of the code but i dont know what to use instead . I assume i cant use the ' character either??? How can i do this? Cheers
-
hi thanks the the reply it nearly works for me but i run into a problem when the <a is not separated by a space from the characters before it i.e sometext<a href="blabla.php"> link1</a> it does not seem to be able to pick up that first <a> tag and im assuming its because there is no space between the text and the start of the <a is this right? Thanks Fraser
-
Hi i have a string which contains some text and 2 links for example. How could i extract all the string minus one of the links eg $textstring = "some text before <a href="testpage.php"> <img src="image1.jpg" /></a> <a href="testpage2.php"> <img src="image2.jpg" /></a> some text after " i would like to make a create a new string which contains all this text minus the first link $newstring = "some text before <a href="testpage2.php"> <img src="image2.jpg" /></a> some text after " any ideas?
-
Hi All, Bit of a strange one but i would like to be able to supply a URL to a page. This page will always contain an image and the copyright that goes with it for example http://www.geograph.org.uk/photo/693325 The copyright lies undearneath I would like to get some php code that would automatically grab the image and copy this to a directory on mt site and also take the creative commons copyright notice as a string ( which i will then display along side the image when i add it to my site) How can i do this through php I know that the word "copyright" only ever appears once on the page ( as part of the bit im trying to grab) so can i use this somehow to grab the whole string? Basically im being lazy and would like to automate the process of grabbing the image and copywrite without having to download it to my computer first and reload to my server ( as i will be doing this quite a lot) Any ideas much appreciated Thanks
-
Hi all, I have a value in my MY SQl database that has carfriage returns in it such as "line 1 bla bla bla line2 bla bla bla line 3 bla bla bla " Im doing a query statement to return the value stored in this field and display it back in a textbox using javascript Problem is though when i try query this field it messes up my results and displays "object HTMLInputElement" in my textbox where it is supposed to go . If i take out the carriage retursn so the field looks like "line 1 bla bla blaline2 bla bla bla line 3 bla bla bla " then everything works fine. Why is the carriage returns messing up my code? Cheers
-
Hi, How would i strip out both the " and ' characters from a php string? Thanks Fraser
-
Hi i am using the following to try and add a string to a mysql database var ajax_connection = createRequest(); ajax_connection.open('get', "addtodb.php?text=" + textstring); ajax_connection.send(null); My problem lies when the string gets large >2000 characters as IE can no longer use URLs this long. How else can i achieve passing such a large string ? My idea was to use a cookie or a session but it seems a bit overkill in my opinion. Is there anything simpler?
-
Hi , I have a login page that i acces via www.mydomain.com/logib.php?last_visited_page.php however the passed in variable last_visited_page.com is not always set . once the login script has run , when the variable it is not set i would want jump to myaccount.php otherwise jump to last_visited_page.php How do i check for no variable beinf present and therefore jump to myaccount.php Many Thanks Fraser
-
Hi Im trying to keep a session open once a user logs in for a large amount of time ( months) I have set the following in a .htaccess file php_value session.cookie_lifetime 99999999 php_value session.gc_maxlifetime 99999999 But i still lose the session and get logged out after 10 minutes or so i have created a phpinfo page and see that for these values the following is set session.cookie_lifetime 99999999( local) 0 (global) session.gc_maxlifetime 99999999 ( local) 1440 (global) What is the difference between the local and global? Any other ides why might session keeps timing out after 10 mins or so of inactivity?
-
Hi Indeed that is what i am asking, i want the soundex for each word within the string which i will then cat together to form one new string of soundex values. What i dont understand is how to split up the string to its component words and take the soundex of each.
-
Hi i i need to be able to get the 4 lettter soundex value for each for in a string and combine them rather than having one 4 letter soundex code for the entire string . How would i do this?
-
Hi i am tryign to get to grips with FULLTEXT in MySQL to improve the search facilities on my site. $searchterm = 'Tomate' $query= SELECT * FROM testtable WHERE MATCH(vegetable) AGAINST($searchterm); I have the above code to to mess about to try understand . My table has a field called vegetable full of vegetables funnily enough, I have set this field to fulltext index My query is not returning any results for " Tomate" only if i use the proper word "Tomato" I thought the point with FULLTEXT is it would return "similar" results. DO i have the wrong end of the stick here? How do i use FULLTEXT to return searches of misspelt words?
-
Hi i have a php string in the form of an html tag i.e my php string $string = "<img title="http://www.mydomain.com/pic.jpg" src="http://www.mydomain.com/pic.jpg" alt="http://www.mydomain.com/pic.jpg" width="400" height="300" /> how do i extract out the src part of the tag so that i am just left with $src = "http://www.mydomain.com/pic.jpg" Many thanks
-
Im not sure how to debug it as the upload script is seperate and i just call it from my main page, so i'm not sure how to use echo?
-
Yeh that was my first thought too but it is definetley CHMOD 777
-
Hi i am using a script to upload an image and resize it twice first to create the large image and then again to create a thumbnail. The large image is being created fine and is uploading ok. I'm using the following code to then make the thumbnail but it does not appear to be working ( well nothing is in the thumbnail image folder i expect it to be anyways) can anyone see anything obvious that i am doing wrong ? Many Thanks /////////////////////////// Create a Thumbnail of the Image //////////////////////////////////// list($width, $height) = getimagesize($upload_image); // this is the large image which has apready been uploaded $ratio = $height/$width; if($ratio >= '1') // portret { $ht_tmb = 150; $br_tmb = 150/$ratio; } else { // landscape $ht_tmb = 150*$ratio; $br_tmb = 150; } // create thumb $source = imagecreatefromjpeg($upload_image); // The large image already uploaded //--- resize uploaded file $resize = imagecreatetruecolor($br_tmb, $ht_tmb); imagecopyresized($resize, $source, 0, 0, 0, 0, $br_tmb, $ht_tmb, $width, $height); imagejpeg($resize, "gallery_images/small/" .$filenamefd); $image = imagecreatefromjpeg("gallery_images/small/" .$filenamefd); imagejpeg($image, "gallery_images/small/" . $filenamefd); // end of making thumb /////////////////////////////////////////////////////////////////////////////////////////////////
-
Small bit of help Hi i have 300 text boxes on the screen and i press update this will update my database All my text boxes are call "T1" T2" "T3" etc etc im using this code to collect all the text boxes values together after the update button has been presses $i = 0; while ($i < 300) { $temp[$i] = $_POST["T"+$i]; $i++; } As i expected this code does not work it i just call all the text boxes 1,2,3,4,5 etc etc and use the following code it does work however $i = 0; while ($i < 300) { $temp[$i] = $_POST[$i]; $i++; } So how do i get it to work when the text box name has a letter prefix as shown before? probably something really simple ! thanks
-
hi i have a group of check boxes each of thier names are the number they appear i.e the first checkbox has name "1" etc etc when the submit button is pressed i am trying to use php to detect which ones have been pressed using this code $i = 0; while ($i < 283) { $climbed[$i] = $_POST[' "$i" ']; echo $climbed[$i]; $i++; } It does not seem to work however as my echo comes back blank even though the check boxes have been selected. and i know its due to the $_POST[' "$i" ']; part does anyone see anything wrong with what i have written?
-
Hi i have 2 radio buttons ( yes/no) in a group i would like to have a submit butotn that when pressed will update a field in my mysql database with either a 1 or a 0 dependant on which radio button is selected . How would i do this via PHP (or otherwise) Thanks
-
Hi my question involves a bit of php and a bit of HTMl so i thought i would ask it anyway. I have an array stored in my MQSQL database as a serialized string, i have unserealized the string after the query which works fine so the data is now stored as a php variable as an array The array is 300 elements long and each element is either a 1 or a 0 What i would like to do is know a fast way of displaying this information on the page I have an html table of 300 rows each with 2 radio buttons. I would like each row in the table to refer to the corresponding position in the array and select either radio button 1 if the value is yes or radio button 2 if the answer is 0. How would i code this in PHP? Hope i have explained it enough . If not just let me know Many Thanks Fraser
-
Hmm neither are workign im afraid nothing is displayed on the page
-
Hi can anyone tell me what is wrong with this php statement . Im trying to use php to put a text link on the page The link will call a javascript function when it is pressed passing the variable $i to it ( which is an integer) // // <a href="java_func(<? echo "$i" ?>)" > <? echo "$businessname" ?></a> // // Thanks
-
Hi i was wanting to know how i can sort my query based on the latitude value for each record minus a base latitude location and perform a secondry sort doing the same thing on the longitude value which should in theory produce the the array sorted by closest records first to the base lat long i have this code below so farbut as i expected i get errors . I dont know enough about mysql yet too work out how to do what i want // // $query_accommodation="SELECT * FROM `accomodation` WHERE `lat` > ($hill_lat - 0.2) AND `lat` < ($hill_lat +0.2)AND `long` > ($hill_lon- 0.2) AND `long` < ($hill_lon + 0.2)"ORDER BY (`lat`-$hill_lat) ASC,(`long`-$hill_longitude) ASC ; // // where $hill_longitude and $hill_lat are my base lat and long i will be comparing each record in the database too p.s ( if i take out the order by bit this query works fine al be it not sorted) Please help Thanks
-
Hi i need advice on how to do something. I have an sql query that returns 3 things ( lat , long and a name) this works fine Would i would liek to do is store these results as a 2d array and for each of these results work out the distance between the lat , longs and a base lat long ( the distance calculation i can do fine) and then sort this new array ( 4 cols now) based on this calculated distance for each entry in the array. Im new to SQL so i would realy appreciate some help on how i go about doing these array operations Cheers