-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
Unable to Add 1 Year to Date Stored in an Array
Adam replied to surajkandukuri's topic in PHP Coding Help
"l dS \o\f F Y" is not in the format "YYYY-MM-DD"; which is what the database is expecting. -
Unable to Add 1 Year to Date Stored in an Array
Adam replied to surajkandukuri's topic in PHP Coding Help
That's because... you're passing an array. Should be: date('l dS \o\f F Y', $firstreviewdate[$i]) -
Ah. Ha being at work though I weren't ready to go looking into the problem...
-
Okay, break down the problem... If you remove the PHP at the top, does the error still occur? If you remove the meta content tag, does the error still occur? When the page loads blank, what is in the source? As mrMarcus just asked, do you have error_reporting disabled?
-
[SOLVED] What happens when you've used both ' and " in an echo
Adam replied to jimmyt1988's topic in PHP Coding Help
You'd be better adding escaped quotes around the strings used in "this.src=...", for example: onmouseover="this.src=\'' . $homeButtonO . '\'" -
Doesn't appear so. Why not invest a bit of time though and learn exceptions?
-
Okay, I'm at work, clicked your link, and got taken to redtube.com ???
-
xml based CMS with php.....plz suggests, its urgent!!!
Adam replied to mr_hacker's topic in PHP Coding Help
It's part of the DOM XML extension: http://www.php.net/manual/en/intro.domxml.php Try using the DOM extension: http://www.php.net/manual/en/book.dom.php -
I agree that, x amount of years experience doesn't prove anything for ability. I also think there's a massive difference between "experience" and "professional experience" - in that working within a professional team you learn a lot faster and to a higher quality (I'm not saying those who learnt the ropes another way can't be of high quality of course). It generally shows though that you can work within a professional environment, meeting dead lines and such.
-
If you want it that bad, you could use JavaScript equivalent for number_format() .. But I think some simple formatting would be the better option.
-
Works for me. Do you have a specific URL to test this on?
-
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta content="text/html; charset=utf-8" http-equiv="content-type"> <title>My Site</title> </head> <body> <?php echo "test page!"; ?> </body> </html>
-
Well then you'll need 3 different forms, or to use JavaScript. JS however, as mentioned before, is un-reliable. Going with a similar idea to mine though; you could link to the other page, decide on the action you need to take, and then redirect as appropriate. Look into header for that.
-
<meta content="text/html; charset=utf-8" http-equiv="content-type"><title>My Site</title> These must be placed within the <head> tag. "test page!" should be echo'd into the <body>!
-
You need to link the form to your PHP file, and then check to see which submit button was pressed using a pretty simple series of IF statements... for example: HTML: <form action="yourpage.php" action="post"> <input name="ins" type="submit" value="INSERT"> <input name="upt" type="submit" value="UPDATE"> <input name="del" type="submit" value="DELETE"> </form> "yourpage.php": if (isset($_POST['ins'])) { echo 'INSERT...'; } elseif (isset($_POST['upt'])) { echo 'UPDATE...'; } elseif (isset($_POST['del'])) { echo 'DELETE...'; }
-
Save the Chinese character as a HTML entity, you can use a tool like this to find the correct value: http://web.forret.com/tools/html.asp
-
PHP isn't event triggered. You'd have to use several forms or JavaScript.
-
Sorted
-
Think logically about that, add the commas then remove them in the same statement?
-
Firstly " " is not an integer. Secondly str_replace will replace the matched string with whatever is in the second parameter. If you're using JS to add commas to the input, then replacing the commas in the DEFAULT value of the input isn't what you need to do. You need to apply it before it's inserted into the database. All you are doing in your examples is applying the str_replace / preg_replace functions to the data you have just taken from the database, then modifying it again and trying to insert a string into an integer field.
-
As cags has said, the problem is with how you enter the data. You're either using intval() and / or trying to enter the string into an integer field. The str_replace() method will work, but only for commas. White space, dots and any other characters that are in there on the other hand would still give you the same problem. The reg exp method I showed you before would prevent any of these messing up the data. Thinking about it though, why are you storing prices in an integer field? Prices surely must contain a "." to separate units?
-
I assume you're using intval? You can use regex to better remove any non-numeric digits like this: $price = preg_replace('/[^0-9]/', '', $price); Read up more on intval() to understand why it was parsing the integer like it was.
-
Thanks for that, although still having problems. Within vim I've manually set the encoding to UTF-8 using :set encoding=utf-8 .. I've ensured "+multi_byte" was compiled, and I've also changed the 'translation' settings for PuTTY. However still when I try to paste Chinese text into vim, the characters are just appearing broken. Any ideas what could be wrong? Thanks again.
-
Hey everyone. I've never had to use Chinese characters before so this is fairly new ground and I'm a little clueless. Basically at work we're extending multi-lingual support to traditional Chinese, and the content's stored within in a mix of files and databases. Simply pasting the characters into vim doesn't work, and I didn't really expect it to. Could any point me in the right direction as to how you'd work with Chinese characters? Thanks Adam
-
Information overload I think. Could you post again with just the most relevant information / code to the problem? Don't think many people will want to read through all that!