Jump to content

spiderwell

Members
  • Posts

    1,008
  • Joined

  • Last visited

Everything posted by spiderwell

  1. i have made a site, intending it to be an online resource for copy and pasting lists in various formats. a list is pulled from the database and then returned as either a csv, unordered list, xml etc I am using ajax to update the textarea with the formating for the list, but i am losing, in this instance, french letters. Here is an example: its a list of months in french http://ethickink.co.uk/lists/pages/listdetail.php?id=36 when the list first displays it has the accents on letters etc all showing fine, but if you click from the options to list as say an <ul> the foreign letters get broken. if i take the link and open it in a seperate page it displays them fine (http://ethickink.co.uk/lists/pages/returngenlist.php?id=36&action=ul), but i have added a class to the links to allow ajax/jquery to operate instead. my ajax looks like this: $(function() { $('.generatorlink').click( function() { $.get( $(this).attr('href'), function(msg) { $("#listdisplay").text(msg); }); return false; // don't follow the link! }); }); #listdisplay is the text area where the ouput is placed in the main area
  2. Ah so my hunch was right
  3. just wrap the echoed output in a span tag with a css class attached or inline style defination
  4. you have hard coded $username to be test in both pages, so it will never fail.
  5. abracadabra
  6. have you checked that the column in the database isnt limited to 40 characters? try echoing out the title without any formating?
  7. just use a form with a method of get instead of post edit: what he said lol
  8. just google php file upload, theres 100's of examples
  9. its mising the ; off the end of it? "
  10. how is this unique page created? would it not be possible to add an $owner variable to it and then compare that against the session id of the user who is on it. $owner = 'john'; if ($_SESSION['user1'] != $owner) { //redirect }
  11. $query = "INSERT INTO temperature VALUES ('',$device_id,$temp,$unixtime)"; doesnt list the columns but should still work but to be sure its going into the right ones it might be worth putting them into the sql $query = "INSERT INTO temperature (`id`,`deviceid`,`temperature`,`unixtime`) VALUES ('',$device_id,$temp,$unixtime)"; what data types are the columns and do they match the data you are trying to insert ? integer into integer, date into date etc
  12. put the full names in the join section, SELECT * FROM <Table1>, <Table2> WHERE (Table1.column = Table2.column)
  13. use a header redirect and use a query string? which will leave it visible in the url bar, not sure if thats an issue for you or not.
  14. then you need to add a further error trap of checking if the user who logs in is the right user for that page. i.e. if peter logs in on johns page, kick him out because its peter not john, rather than just checking peters username against password.
  15. good stuff in futures its worth noting that SQL has reserved names like COUNT so you will need to refer to them with backticks because COUNT is actually a function in mysql interesting reading
  16. it looks like you are only checking for existence of the $_SESSION['user1'] variable, and not what its value is, so as long as you are logged in with a session variable called $_SESSION['user1'] it doesnt matter what its value is if there is a unique path which will contain the username or whatever, perhaps do a check that matches the value stored in $_SESSION['user1'] i would store the username whatever the unique identifier is in $_SESSION['user1'] for example lets say the value is 'peter' then when forwarded to ../peter/index.php, that file should check if the path matches the session, so perhaps explode the path into an array to extract the peter from it and compare that to the session user1 value. if they are the same , let user stay otherwise redirect away. does that make any sense ?
  17. function getWordCount($word) { $query = "SELECT `count` FROM uniqueWords WHERE word='$word'"; $result = mysql_query($query ); while($row=mysql_fetch_array($result)) { $return $row['count']; } return "nothing found"; } }
  18. same principle really only make an hlink to the pdf instead of an image tag when you want it to be downloaded
  19. haha no i meant [ / code] not count sorry but use BACKTICKS ```````````` NOT single quote '''''''''''''''' means very different things in SQL are you trying to count rows in a database or select a column named count ?
  20. file uploading is pretty straight forward, and theres plenty of scripts out there to use. it could be saved directly into the database as a blob (binary object) or just saved to the server, which is the method i use. i would suggest the database table has an ID, event name, and image column, then when the form is submitd the file is uploaded (hopefully) successfully, then enter the event name and image filename into the database. to later pull that image, use SQL to grabthe row from the database and echo the imagename inside an html img tag bit like below. dont forget paths to where the image is stored too echo "<img src=\"" . $row['image'] . "\">";
  21. is count a column name?, if so perhaps put it in backticks SELECT `count` from uniqueWords WHERE word='$word'; [/count]
  22. its all good learning though
  23. yeah i am pretty sure an include in an echo statement wont work. try creating a string with the options in, rather than echoing them directly, and then include that string into the echo statement instead of the include so something like <?php $options = ''; $sid = $member_details_array['id']; $event = mysql_query("SELECT * FROM events WHERE events.id = '$sid' ORDER BY cal_id ASC"); while($row=mysql_fetch_array($event)){ echo " $options .= <OPTION VALUE=".$row['event'].">".$row['event']."</OPTION>"; } ?> then echo out that $options string along with the rest of the form.
  24. the examplke given is doing exactly what you need to be able to write a new file, you can make it write whatever you want. including php variables etc.
  25. in sites i have made in the past, i have an auto edit form that pre populates the users info, and depending on if that user is an admin or just a normal user, the user group option is hidden or in a drop down. i.e. an ordinary user will not get the option to change group from user to admin, but the same form viewed by admin will have an extra field with these options. in fact the same form also works for adding new users via the cms backend or as a register form on the front end.
×
×
  • 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.