
defeated
Members-
Posts
246 -
Joined
-
Last visited
Everything posted by defeated
-
Could it have something to do with the field being date rather than datetime? About 2 years ago somebody gave it to me as the solution. It took me a while to get my head around it being new to php and adverse to any sort of maths (even just subtraction). Wish I had just asked you!
-
WolfRage made a mistake. The echo statement is not the problem. The problem is that the while loop is causing your echo statement to execute twice. The code you end up with in your html is then... <input name="c_options[$i]" style="border-style: solid; border:0px solid; border-color: #FFFFFF" type="checkbox" border="0" value="tag_desc_id" checked></input> checked></input> check it out in your source.
-
Hey Rhodesa, What's the difference between that and SELECT * FROM tableName WHERE TO_DAYS(NOW()) - TO_DAYS(Expdate) < 0 apart from mine being more complicated that is.
-
Your while loop is returning two positive results (2 rows) Check your query. Alternatively (which is not ideal) you could get rid of your while loop to give: $row2 = mysql_fetch_array($result2); if($row2['tag_id'] == $row['tag_desc_id'] && $row2['user_id'] == $user_info[user_id]){ //global $checked; $checked = "checked='checked'"; echo " $checked> </input>"; }// end if That's really not a good way of doing it though. What is good is the way I replaced $checked='checked'; with $checked="checked='checked'"; That makes it valid xhtml 1.0
-
Once you get it to run as a php file then you can use mod rewrite as follows: RewritRule ^rss.xml rss.php in your .htaccess file. That way anybody can write rss.xml and it will open your xml.php file but look like it is opening rss.xml(which won't actually exist). Do get it running as rss.php first though.
-
Like the subject says. I have started to build over 30 sites. All the information is in one db. I didn't see any point in duplicating the db for each site. That would be a pain in the *rs* for inputting data. There are some network issues happening to my isp at the moment and I just got a Too many connections error. I only have 4 sites open. Have I just made a major mistake in my design or is it likely that the network issues are having a bearing on this? I am losing connections to sites on and off at the moment. It's not even my ISP's fault. The national fiber network is under pressure apparently. Grrrr. My heart is in my mouth on this one. I've spent over 6 months on this idea so far.
-
I noticed that one of my pages is incorrectly indexed by google.... presumably I added a link badly somewhere. The problem page request mypage.php?page= As you can see there is no value for the page variable. It should read mypage.php?page=contact If I try to redirect like so... RewriteRule ^mypage.php?page= mypage.php?page=contact It ends up in a loop. That makes sense but I can't figure out how to do it. Any resident geniuses able to help me out here? Unfortunately the incorrect version is the one that google has indexed which has resulted in the page title showing up as the default " Uh oh, somethings wrong around here ". Shame because it's at number one in google for a specific search term. I have blocked in in my robots.txt and added it for removal but it would be nicer to have a redirect.
-
[SOLVED] can't get data containing single quotes out of db
defeated replied to defeated's topic in MySQL Help
htmlentities() .... always wondered what they were for! Learn something new every day. Thank you. -
[SOLVED] can't get data containing single quotes out of db
defeated replied to defeated's topic in MySQL Help
echo "<td><input name='myname' value='".$myname."' /></td>"; where $myname = "What's my name" ; I got it to work by doing the following: echo "<td>" ; ?> <input name="myname" value="<?php echo $myname ; ?>" /> <?php echo "</td>"; It's far from elegant though. So I'm not marking as solved yet until I see if someone has a better idea. -
Hi, I used mysql_real_escape_string() on my input. That worked fine. "What's my name?" turned into "What\'s my name?" and it inserted fine. When I look at the field in php my_admin though it is back to "What's my name?" When I try and output the field I get "What" I tried addslashes(), stripslashes() and even mysql_real_escape_string() again. Nothing worked. What am I doing wrong? I noticed the same thing happens on image captions in wordpress. There must be a simple solution?
-
[SOLVED] Form help required... apply within.
defeated replied to defeated's topic in PHP Coding Help
Aha! value= I didn't know you could assign a value to a checkbox. Thank you all. I'm on to multiple actions for my form now... -
[SOLVED] Form help required... apply within.
defeated replied to defeated's topic in PHP Coding Help
ok, but how do I assign the row id value to the checkbox? echo "<tr><td>".$id."</td><td>".$name."</td><td>".$subject."</td>"; echo "<td><input type='checkbox' name='whatever' /></td></tr>"; echo "<input type='hidden' name='row' value='".$id."' /> how do I associate the checkbox with that particular row? -
I want to do something and I have no idea how to go about it. I am displaying the contents of my db out into a table. Each line of the table is a result row from mysql with its own id. I have added a column of checkboxes to the side of the table. I want to be able to select x number of rows via the check boxes and then click a button that sends information to a page to delete all those rows with checked check boxes. Logic has escaped me. I guess I want to turn the table into a form and return an array of all the row id's that are checked... that way I can do a foreach on the array to delete each one. ??? Am I barking up the wrong tree? How would you do it?
-
Sweet! Have to go the .htaccess route. I'll google for what to put in. Cheers, that's great help! I love this forum.
-
Pardon my ignorance.... but where? how? How do I prevent a folder having http access?
-
$query=mysql_query("SELECT * FROM yourtable WHERE areafield='$areaselected' AND pricefield>'$lowerlimit' AND pricefield<'$upperlimit' AND propertytypefield='$propertytype' ORDER BY pricefield") or die("Uh oh, Something went wrong with the query: ".mysql_error()); That should do the trick. $areafield is the name of your select for area $lowerlimit is the name of your select for lower price limit $upperlimit is the name of your select for upper price limit $propertytype is the name of your select for waterfront etc. ORDER By will order results by the price
-
A speedy response! Thank you. I just did a quick google on MD5 hash and that looks like a good idea. Cheers!
-
Hi, I'm working on sending xml documents to other websites. I am writing the xml to a file and then reading it and sending it. Every time I send new info the file is overwritten with new data. It works perfectly. Then it occurred to me that this is not even slightly secure. All someone has to do to get the passwords that are sent in the xml is crawl my site and look at one of the xml files which contain the info. So I have an idea. If I create a random_filename.xml each time I send and then delete it as soon as it is sent it should be ok? I really don't know how secure that would be. It seems fine to me but what do I know. Anybody got any suggestions. I am going to be going into competition with some really big players and I can expect to come under serious attack given the history of the sector in this country so I need everything to be as secure as is reasonably possible. I'd appreciate any advice from any security experts. Thank you.
-
oops. I had left an include at the beginning of my code before I had declared my strings when I was trying to use the include method. The file name was the same so I thought it just wasn't working. oops again!
-
that sounds like you're on the right track!
-
firstly the order. That can be fixed by ORDER BY whateverthecolumnis DESC in your mySql. That will change the order to the opposite of the default. Next: logic. Pagination is not as easy as it looks. Try this: http://php.about.com/od/phpwithmysql/ss/php_pagination.htm
-
I read your post and it sounded like "Please let me give someone my money" to me. Being in a charitable mood today however... You need to read everything Here. Then you need to find a way of creating lots of backlinks from relevant sites containing words you want to rank for (see my signature). This will only really be of benefit if the site is related to yours. Start a blog or two. You can link from these easily because they are yours! There you go..... you're now an SEO pro yourself. At the very least you need to be informed enough not to get ripped off or have somebody damage your site by using suspect techniques.
-
No. I'm using Simple_xml which is working fine. There is nothing wrong with the code for posting to remote sites. It works perfectly if I write it where it is supposed to go. The problems are coming from trying to have the code elsewhere and call it to where it is supposed to go. The object is to make the page lighter. I want to only call the code if the if statements are met rather than have them all on every time the page loads. That would be 40 segments of code where I may not need any (if no action on checkboxes). I have 10 sites I am sending to now but that is set to triple soon (120 code segments if I don't get this problem sorted). I will also have multiple users posting. The overhead is too high and I need to find ways of keeping it down.
-
Hi, I am having some problems with includes /functions The code is complicated and long so I'll just explain it and give you some simplified code. What the code does: It takes a form entry. It collects all the variables using $_REQUEST. It does some checks and then puts the form data into a db on the site. Here is where it gets more complicated... There are check boxes on the form that relate to other websites. The code asks if each checkbox is checked. It also checks the previous state of each checkbox (in case it has changed). For each checkbox that is ticked it sends the form data via xml to the other site referred to by the checkbox. There are four possibilities for each checkbox:- checked was checked before - Means it's a data update on other site checked wasn't checked before - Means it's a fresh post to that site but not to source site not checked was checked before - Means it's a data delete on other site not checked wasn't checked before. - No action for each of those possibilities the code for sending is slightly different There are 10 checkboxes. Rather than write out nearly the same code 40 times I wanted to pull it into my code from an external page. That way I end up with //lots of variables from form go here // //update if($checkboxA=="on" && $checkboxAprevious =="on"){ $remote_website = "www.siteA.com" ; //include code for updating here }//end update //fresh post if($checkboxA=="on" && $checkboxAprevious !="on"){ $remote_website = "www.siteA.com" ; //include code for posting here }//freshpost //Delete if($checkboxA !="on" && $checkboxAprevious =="on"){ $remote_website = "www.siteA.com" ; //include code for deleting here }//delete //do nothing if($checkboxA !="on" && $checkboxAprevious !="on"){ }//do nothing That snippet has to be repeated 10 times (once for each checkbox). I can live with that The code to be included is long. It grabs all the form variables and writes them to an xml file (xml file is different depending on action to be taken (eg post/delete/update)). It then opens a port to the remote site and sends the xml and prints a response if all has gone well. Finally I get to the problem: If I make "code for posting" a function() and call it then the form $variables and the $remote_website will not pass into the function. If I make "code for posting" an include() then the form $variables and the $remote_website will not pass into the included code either. All I want is to be able to write the code once and call it to a place in my code where it should run like it was part of the code to start with and not called in. Where am I going wrong? ??? P.s sorry for such a long post. Hope it makes sense to you. :-\
-
Try this... have not tested it so it may be rubbish... but I think it's good. echo "<h1 class='style5'>News Archives<br />" ; echo "<span class='newsubheading'>Keeping you up to date with Laser Dynamics</span></h1>" ; do { echo "<div class='newsrelay'> <h3>".ucwords($row_rs_newsfeed['headline'])."</h3> <p>".substr($row_rs_newsfeed['abstract'], 0,150)."... <a href='news.php?article=".$row_rs_newsfeed['id']."'>Read More</a></p> </div> <div class='addinfo'>Total News Articles To Date: ".$totalRows_rs_newsfeed."</div>"; } while($row_rs_newsfeed = mysql_fetch_assoc($rs_newsfeed)); .... and what Ken said