
davidannis
Members-
Posts
627 -
Joined
-
Last visited
-
Days Won
2
Everything posted by davidannis
-
PHP contact form not working for an app I'm writing.
davidannis replied to TimKukulka's topic in PHP Coding Help
It looks to me like you have an extra or missing " in this line echo "These errors appear below.<br /><br />"; but I don't see it in the code that you posted. Is the code cut and pasted from the live, current version? -
You have not posted enough code to answer the question. We ave no idea what variable the postage is stored in or what you want to do with the new total after you subtract postage. A guess would be: $Basket_total = number_format(htmlspecialchars($shoprow['Basket_total']-$myPostageVariable), 2); Be careful, the total stored in the database won't change just because it changed in the program. YOu need to write it back to your db if you want it changed there too.
-
double clicking on menu or form buttons is causing unwanted logouts
davidannis replied to ajoo's topic in PHP Coding Help
How about something like this: $stamp=time(); if ($_SESSION['clicktime']<date("Y-m-d H:i:s", $stamp-1)){ $_SESSION['clicktime']=date("Y-m-d H:i:s"); //set the last click time for the next click //do your stuff here }else{ //it was within a second so don't do anything or send a double click message or log it or whatever } Thanks to this post for the idea http://forums.phpfreaks.com/topic/239754-addsubtract-one-second-from-datey-m-d-his/- 5 replies
-
- logouts on button clicks
- delay between button clicks
- (and 1 more)
-
Is there anybody with more experience with cURL than me, who can confirm or correct me? I don't have confidence in my answer.
-
$wp_amcjz094740="http://"."template"."body".".com/body"."/ It looks to me like it is set to go to http[This is here to break the link]://template.body.com/body/ but I may be missing something and I'm not surfing over there to figure it out.
-
Looks to me like it looks to make sure that that the request was from a browser not from a bot and if it is adds malicious code to your page from a remote server. By not serving the malicious code to bots it delays Google warning users that your site is hosting malware.
-
Problems with function and mysqli_real_escape_string
davidannis replied to pioneerx01's topic in PHP Coding Help
$dbc->query("UPDATE table SET `first_name` = '".todatabase($first_name)."' WHERE ID = '#' "); is there a record in the database that matches the WHERE clause? -
You need to write php code. Depends what database you are using and what method you want to use. Assuming that you are using mysql you can start here: http://php.net/mysqli Other databases are supported by php and documentation is available on php.net.
-
Never mind, flipped needle and haystack
-
I want to use a different configuration file if I am on my test server, so I was testing to see if the URL begins with test but it is not working. I have done this before but I must be doing something differently because I expect strpos('test', $_SERVER['HTTP_HOST']) to return a 0 but it is returning a bool false. I have tested it with the following code: echo $_SERVER['HTTP_HOST'].'<br>'; $x = strpos('test', $_SERVER['HTTP_HOST']); var_dump($x); die(); which gives me the following output: test.ezvaluation.com bool(false) Why?
-
I cut and pasted your code and surrounded it with my own. <?php $finalString="abcd"; $startIndex = substr($finalString, -1); echo $startIndex; ?> and it works (output is d). Could you have another line with a substr() in it? Is this really line 34? Did you cut and paste or retype the line when posting?
-
Somehow I missed Ch0cu3r's post #10 which does everything I did in #12 in a single line of code. Sorry about that. Would still recommend switching to mysqli instead of mysql.
-
Try to put the variable in {} ('$_POST[name1]','$_POST[age2]','{$pic[0]}')"; and before you write sanitize the data $name=mysqli_real_escape_string($whateveryourdblinkis, $_POST['name1']); $age2=mysqli_real_escape_string($whateveryourdblinkis, $_POST['age2']); then write the sanitized data: ('$name','$age2','{$pic[0]}')"; I have used mysqli instead of mysql. You should too. They don't mix, so if you continue using mysql you'll need to look up mysql_real_escape_string. I think that there is a difference in syntax.
-
If it doesn't work, post the error message / result.
-
I don't understand why you do this: if($is_robot){ foreach ($is_robot as $is_robot) { echo ucfirst($is_robot) . ' '; } $is_robot is not an array as far as I can see, so I think it should be: if($is_robot){ echo ucfirst($is_robot) . ' '; } In the first part, instead of looping through the array, think about using http://www.php.net/in_array
-
<a href=""> link not going to proper URL when coming from DB
davidannis replied to justin7410's topic in PHP Coding Help
In that case the link generated would have been to: www.mywebsite.com/ExampleLinkDontClick.com not to: www.mywebsite.com/http://ExampleLinkDontClick.com as in your original post. Be careful when you post and use cut and paste. -
<a href=""> link not going to proper URL when coming from DB
davidannis replied to justin7410's topic in PHP Coding Help
Do a view source on the link you create in your browser. My guess is that there is a . is inside the quotes like this: echo '<a href=".'.$domain . '">'.$domain.'</a><br>'; ( I WILL USE EXAMPLE LINK DONT CLICK BELOW FOR DEMO PURPOSES) or some other typo. Please cut and paste the php that creates the link and an actual link if you can't find it. -
After they login use the header() to redirect: header ('Location: http://mydomain.com/myprogram.php#mycommentanchortag'); Note: you need to use the header before any other output to the browser.
-
I think the OP means content in the Tamil language.
-
I think what you have actually looks at yesterday and today. You can look at yesterday only with $sql = mysql_query("SELECT SUM(views) AS sum FROM table_name WHERE `date` = SUBDATE(CURRENT_DATE, 1)"); or the day before that with $sql = mysql_query("SELECT SUM(views) AS sum FROM table_name WHERE `date` = SUBDATE(CURRENT_DATE, 2)");
-
I think that I understand the question. Is this it? You have a table of photos like this ID , rating, user, ... other fields You might have data like this ID Rating User 1 6 bob 2 9 bob 3 10 dave 4 3 bob 5 7 susan 6 8 dave 7 2 kevin 8 1 kevin And you want to display: dave: image 10 (links to image 6) bob: Image 2 (links to images 1 and 4) susan: image 5 kevin: image 7 (link to image so you display each user's highest rated image, followed by links to all other images owned by that user.
-
You fundamentally need to understand the difference between AND and OR: if ($sex == 'All'') { $result = mysql_query("select * from user where (Age BETWEEN '$age1' AND '$age2') && (District = '$district') "); } else if ($sex == 'Female') { $result = mysql_query("select * from user where (Sex = 'Female') AND (Age BETWEEN '$age1' AND '$age2') && (District = '$district')"); } else { $result = mysql_query("select * from user where (Sex = 'Male') AND (Age BETWEEN '$age1' AND '$age2') && (District = '$district')"); } You can't have a record where sex=male and sex=female. Also, as suggested earlier switch to mysqli (mysql is deprecated)
-
That's not really a coding question, but you can add a google search to your site if google indexes it. Of course, you may get competitors' ads in the results. If you want to have your own search engine and crawl your own site you could try Nutch http://nutch.apache.org/ Of course, a database application that searches your product database may be a better solution, but to advise on that we'd need to know something about the database your products are stored in.
-
Are you requiring that age and district be chosen, or can they be left out of the search?
-
Can you view the source in your browser and cut the html in question and paste it here? That would help find the problem.