-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
Try: '/\[adapter(?:=")?(.*?)"?\]/i' Edit Or if you want to enable single or double quotes, but make sure they match: preg_match('/\[adapter(?:=(["\']))?(.*?)\\1\]/i', $str, $matches, PREG_OFFSET_CAPTURE)
-
Okay, could you paste the actual SQL you're trying then?
-
$res = explode('x', $resolution_value); You'll then have an array containing the values.
-
Your problem is not with the where clause, but SELECT * FROM 'x'. You cannot have quotes around a table name, you need to use grave accents ``.
-
asXML() simply returns the element in it's XML form. Try: echo "category name" . $category->category;
-
How do you access the variables once assigned?
-
Try looking through the Apache access logs for anything suspect. Did you take note of last mod time of the file (would make things easier for yourself)?
-
Perfect, cheers!
-
Hi guys. Hoping somebody with a little more expertise with CSS this can shed some light on this problem for me. Basically I'm designing a website with a nice fancy little footer. My only problem is that on some pages there isn't much content, but I'd still like to have the footer touching the bottom of the window (so there's no white-space underneath it). Although I don't want it fixed to the bottom of the window so it's always there, just whenever the content doesn't take it all the way. I knew how to do this once upon a time but it's been a while since I did any serious CSS'in. Can anybody help? Thanks
-
Gotchya! Okay, you need a regex then that is able to match valid URLs. I'm not going to write one because there's so many examples available on the net, and they can get complicated. Using a random one I came across: $info = 'http://google.co.uk'; $data = preg_replace('/((http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?)/', '[url=http://$1]$1[/url]', $info); echo $data; Again need to remove the "http://" in the second parameter, the forum's adding it in for some reason.
-
I think you have the wrong idea about downloading files. All you need to do is place the files outside of the publicly accessible directory (e.g. outside of htdocs / public_html / or whatever your web server names it) and then use PHP to read the file and force download. Actually .htaccess files are for configuration of Apache, not PHP (although you can modify certain PHP config options though them).
-
I see, sorry I misread your OP. I thought you were wanting to convert BBCode URL tags to a link. So you want to look for valid URLs and convert to url here? Of course converting the URLs to BBCode tags won't make the link clickable, you'd need to convert the URL to a hyper-link for that. Can you just confirm which output you're after?
-
After you define $info, can you just add in var_dump($info); and post the output? I did a quick test with the code below and it worked. $info = '[url=http://google.co.uk]http://google.co.uk[/url]'; $data = preg_replace('/\[url\](.+?)\[\/url\]/', '<a href="$1">$1</a>', $info); echo $data;
-
Just need to modify the regex a little: $str = preg_replace('/\[url\](.+?)\[\/url\]/', '<a href="$1">$1</a>', $str);
-
This should be pretty simple to do. I'm not sure of the file structure though so I can only suggest how to obtain the files; scandir will allow you scan through all files in a directory, and glob would allow you to match specific files (i.e. all "*.txt" files) and loop through them. Once you're looping through your file list, open each file with the file function which will return the contents as an array (split by line). You can then loop through each line, storing the value (plus "\n" for a new line) to the correct text file.
-
That depends. Are you using the traditional title syntax? If so, you could use preg_replace with a regex like: $str = preg_replace('/\[url=http://(.+?)\](.+?)\[/url\]/', '<a href="$1">$2</a>', $str); Edit: remove "http://" from the regex, for some reason the forum's adding it in.
-
You're missing a closing curly brace for the while loop. If you indent the code properly it's easier to spot (second to last line): } else { // NO HTTP ERROR // TODO: Verify that HTTPS response is 200 fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { // TODO: // Check the payment_status is Completed // Check that txn_id has not been previously processed // Check that receiver_email is your Primary PayPal email // Check that payment_amount/payment_currency are correct // Process payment // If 'VERIFIED', send an email of IPN variables and values to the // specified email address foreach ($_POST as $key => $value){ $emailtext .= $key . " = " .$value ."\n\n"; } mail($email, "Live-VERIFIED IPN", $emailtext . "\n\n" . $req); } elseif (strcmp ($res, "INVALID") == 0) { // If 'INVALID', send an email. TODO: Log for manual investigation. foreach ($_POST as $key => $value){ $emailtext .= $key . " = " .$value ."\n\n"; } mail($email, "Live-INVALID IPN", $emailtext . "\n\n" . $req); } } // was missing }
-
Would have been helpful to quote this error earlier. $results 'is not a valid MySQL result resource'. Try amending to the end of your mysql_query() call: or trigger_error('MySQL error: ' . mysql_error()); Make sure you don't have a semi-colon before 'or'.. i.e. "; or trigger(...)"
-
AJAX isn't a "mod", nor is it installed into Apache (or other web server) in anyway. AJAX is basically just submitting HTTP requests via JavaScript. It is easy to disable at the client end, but not not so simple for the hosting provider. What are you trying to do in the request? Try observing the HTTP headers sent to spot the problem*. I imagine the URL is malformed or something like that, that is causing the server to return this error code. * If you're using Firefox, there's a good plug-in called "Live HTTP headers" you can use.
-
Your code is syntactically correct provided that $results is a valid MySQL result resource. Without seeing more of the code we can't really say why it's not working.
-
Guess that depends upon the size/complexity of the code. How large is your project?
-
Unfortunately you're not going to get this always flush to the edge of the image, because you're resizing based on the aspect ratio. That means whenever the screen is wider than the height, the div will be stretched wider than the image. You would need to use JS to work out the gap on the right and set a right margin on the arrows.
-
To be honest mate I'd go back to basics; learn the fundamentals of PHP before attempting to query databases.
-
Sorry to dreg up an old post, but yeah this went no where. I received an email from them today, in short it says: http://www.hmg.gov.uk/epetition-responses/petition-view.aspx?epref=ie6upgrade I love how two faced the Government can be: "at significant potential cost to the taxpayer" ..really? Everyone suddenly forgotten about the recent expense claims scandals? ID cards? etc. MPs would rather build a mote around their house than upgrade technology.
-
I'm sorry? Your question: My answer: You asked if it would work, and theoretically it would. Those functions were written to be a similar as possible across different database platforms. However as I said take note of the differences within the SQL syntax as that's where you're most likely to run into problems. You want a better response, ask a better question. Oh and yeah, you're function does need some work since you're creating a new connection every time you perform a query.