Jump to content

grissom

Members
  • Posts

    166
  • Joined

  • Last visited

Everything posted by grissom

  1. Hi all I've been putting together some code for automatically writing an Excel spreadsheet in PHP A quick trawl around Google has led me to functions for opening and closing an Excel file, and writing numbers and text strings into cells. All Working Well - So Far so Good. The bit I'm missing is a PHP function to set the width of an excel column. Can anybody please help ? Many thanks and all the best.
  2. Don't feel alone, I've done that too. It's a real pi**er.
  3. Try putting a debugging statement (a simple echo 'We are in here'; ) statement inside the second elseif to see if (1) you are actually getting into that bit of the code OR (2) whether you are getting in there but the mysql statements arent functioning properly
  4. Man, I hate GD I always get brain ache. As a first step, try "commenting out" (ie by using the old // marks) the four lines which do the imagefilledellipse bit on the corners. Do you get a cross shape or still a rectangle ?
  5. Dunno if this will work, but off the top of my head, try putting some single quotes in your retrieval around the $pid so it looks like this : $sql = "SELECT category_id FROM product_category WHERE product_id = '$pid' ";
  6. Change the data type for the image field to VARCHAR(128) Then store in that field the value : cooltechonline/images/webluetooth/imagename.png When you come to display : 1. Dig that value out of the database, call it something, eg $foo 2. Your HTML should go something like (I've not tested this !!) <?php echo "<IMG SRC = '$foo'>"; ?>
  7. I'd also add a bit more code in tracks.php to check that the session variable is SET AND is equal to 'yes'.
  8. Oh and while I think on, cookies aren't that reliable either.
  9. As has been pointed out PHP runs on the server, so the device does not normally matter - BUT !!! - There is one thing that YOU MUST BE CAREFUL OF when programming PHP for mobile devices and it is in the use of SESSION variables. I have had issues with the use of session variables for mobile devices as the session on a mobile device sometimes "floats" so I make a point not to use them. If I have any values to pass on from one page to another, I generally use a form and "POST" the data along !
  10. Try this for an idea : Presumably you've got a database somewhere with the details of all the users on it. Add a field to the database, call it something like "filter". The value in this field can be a boolean (true = filter on) or you can set it to a SMALLINT to have differing levels (0 -9 for example) of filtering. Then in your PHP code, when the user logs in, dig out their credentials from the database. You may (if you so desire) save the value of "filter" in a SESSION variable so you can quickly grab hold of it at any time without having to mess about with the database each time. Now, write a PHP function called something like filtertext(text_input) which strips out any naughty words and returns a text string minus those words Then, all you do is when the user inputs something, test to see if they are filtered or not, and if they are, invoke the function to clean up the text. To turn the filter off, just amend the value in the database table. That's probably not the only way, but its the best I can think of at this hour of night in the UK, hehe : ) Good luck !!
  11. Hi iwpg Nothing immediately strikes me as wrong but in situations like this I try throwing in a few more brackets into the expression just to make it more explicit $q = mysql_query("select * from db where (item1 like '%$keyword%') or (item2 like '%$keyword%') or (item3 like '%$keyword%') "); The brackets may be surplus to requirements but I'd always rather have some surplus ones than not enough.
  12. So far I've got round it by concatenating a string made up of the bits like $query = "INSERT INTO audit_header (user, zone) VALUES ('" . $localheader_line[$kk]['user']. "', '" . $localheader_line[$kk] . "', )" .. // etc etc and then running $success = mysql_query($query); If anyone else has any better ideas, please let me know, thanks.
  13. Hi all I'm putting together a little synchronisation routine to transfer some stuff from one table (on localhost) up to a table on the server. First job I did is to pull the info off the table on localhost like this : $localheader_stuff = mysql_query("SELECT * FROM audit_header"); $ii = 0; while($localheader_row = mysql_fetch_array($localheader_stuff)) $localheader_line[$ii++] = $localheader_row; This has now pulled the data out of the local table and stored it in a series of arrays which I can access (and I have tested using 'echo') by specifying 2 dimensions eg echo $localheader_line[0]['user']; // to get the user field from the first record. So far so good ! Now to INSERT it into the server table. I connect up and go through each line of data at a time like this : for ($kk =0; $kk < $ii; $kk++) { // $ii is the number of lines plus one (see bit of code above) $success = mysql_query("INSERT INTO audit_header (user, zone) VALUES ('$localheader_line[$kk][user]', '$localheader_line[$kk][zone]')"); } But it's not working !! Somewhere I think I've got myself in a twist with some inverted commas or brackets but cannot work out how. help please ! many thanks !!
  14. Hello again Think I fixed it. My Norton virus/firewall program "updated" itself automatically, and now seems to have installed some new algorithm for a thing it calls the "smart firewall" When I turned all the firewall settings off, then ftp_get() started to work again. Phew.
  15. Hi all I have a little PHP program to automatically FTP some files from off my server to my C drive (I am running the PHP off my C drive in XAMPP), using the ftp_get() function. Today the ftp_get() function stopped working, timed out and then came back with this error message : 'Could not open data connection to port 53515' Any suggestions as to why it stopped working ? And how can I get it going again ? Many thanks for your help
  16. The easist way would be to put the various elements into a <TABLE> Or, you could use <DIV> elements to position each element on the screen to the exact pixel, but it is a bit fiddly. Personally, I'd go for the <TABLE> option.
  17. If you have an <INPUT TYPE = "BUTTON" etc... have you enclosed it within some <FORM></FORM> tags, if not, that might cause some browsers to not interpret it right.
  18. You can update more than one field at once, you just have a brain-stretching (for me anyway) job of getting the quotes and the brackets all right. Instead of mysql_query(" UPDATE moving SET `firstname` = '{$_POST['firstname']}', `lastname` = '{$_POST['lastname']}', `email` = '{$_POST['email']}', try this : mysql_query(" UPDATE moving SET firstname = '$_POST[firstname]', lastname = '$_POST[lastname]', email = '$_POST[email]', .. etc ... "); I've removed the single quote marks from off the field names everywhere and also taken out the curly brackets. No guarantees! But type it exactly like that and see if it works !
  19. I'm not sure exactly what you are looking to achieve, but to write HTML using PHP you could use the ECHO command. Something like (BTW this was written up on the quick, not tested !) function create_p('$class','$id','$name') { echo "<P NAME = '$name' ID = '$id' CLASS = '$class'>"; } Or something like that ! A more experienced programmer might spot a syntax error in the above, like I say I haven't tested it.
  20. The frames idea suggested above is the only one I can think of.
  21. Thanks thorpe and Dj Kat. All your base ... that takes me back !! (nostalgic smile spreads across face ...) Take Off Every Zig For Great Justice. Anyway, thanks guys, that's excellent.
  22. Hi Dee I think what revraz meant was to enclose your code in tags like this Your code goes here
  23. Just a quick thought, try substituting these two lines travellingbuttons('Y','coords','1',50,50,'1'); $GetArray = travellingbuttons(); with this one line : $GetArray = travellingbuttons('Y','coords','1',50,50,'1') One other thing - why are you passing so many arguments to the function - it doesn't appear to use all of them ??
×
×
  • 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.