Jump to content

Perad

Members
  • Posts

    287
  • Joined

  • Last visited

    Never

Everything posted by Perad

  1. I am redeveloping a site and the client wants to keep the link structure. The link structure is bad and I am strugling to rewrite it. If someone could help me with this first one I should be able to rewrite the rest of them. This is the URL. http://localhost/iraqidinars/iraqidinars/newiraqidinars.html I need the server to redirect requests for this file to... http://localhost/iraqidinars/index.php?page/1 I tried adding this line RewriteRule ^iraqidinars/newiraqidinars\.html$ iraqidinars/index.php?site/show/1 However this generates an error. Does anyone have any ideas on how to solve this?
  2. Hi, What is a maximum amount a float column can sustain? I set up a float column and gave it the following attribute. '5,2'. I thought this meant 5 integers and 2 decimals. Before I go hacking into the database, I need a field which will allow up to 99999.99. Can float do this? Any help would be much appreciated.
  3. Perad

    SQL, tranfer?

    What is the most efficient way to transfer a record to an identical table? I need to create an archive which stores processed items. Is there some mysql function that allows me to transfer and delete all records from one table and move them to another?
  4. Thanks for the reply. I would need to do this over a thousand times. Seems very time consuming. Is there a way to strip out all html elements barring the following. <form></form> and anything in between <img> If there was a way to do this I may have a better chance of making this work.
  5. Please... someone... there has got to be a quick way to do this. I just spent 20 minutes doing this and made absolutely NO progress what-so-ever. Programming solution is therefore required. I have attached the html page. Look at this. <td colspan="1" rowspan="1" width="50%" align="" valign="top"><br><b><font size="4">Angola 1972 100 Escudos UNC Bank Note Money<br><br>Price= US$9.79</font></b><br> </td><td colspan="1" rowspan="2" width="50%" align="center" valign="top"><table summary="image table" cellpadding="0" cellspacing="0" border="0" width="174" style=""><tr> <td align="center" valign="top"> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr> <td align="center"><img width="149" src="images/149_Angola_4.jpg" alt="" style="" border="0" height="140"></td> </tr> <tr> <td align="center"></td> </tr> </table> </td> </tr></table></td> </tr> <tr align="" valign=""> <td colspan="1" rowspan="1" width="50%" align="" valign="top"><FORM action=https://www.paypal.com/cgi-bin/webscr method=post target=paypal><INPUT type=image alt="Make payments with PayPal - it's fast, free and secure!" src="https://www.paypal.com//en_US/i/btn/sc-but-01.gif" border=0 name=submit> <IMG height=1 alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width=1 border=0> <INPUT type=hidden value=1 name=add> <INPUT type=hidden value=_cart name=cmd> <INPUT type=hidden value=as1251285@sapo.pt name=business> <INPUT type=hidden value="Angola 1972 100 Escudos UNC Bank Note Money" name=item_name P55c? UNC 0?> <INPUT type=hidden value=9.79 name=amount> <INPUT type=hidden value=2 name=no_shipping> <INPUT type=hidden value=1 name=no_note> <INPUT type=hidden value=USD name=currency_code> <INPUT type=hidden value=PP-ShopCartBF name=bn> </FORM><br> </td> I need to extract the following data. As the code varies some what it will be tricky to find this all. Ideally I would like the following to happen. 1) Use reg/ex or some programming voodoo to hack out the above 4 bits of data. 2) Place it in an array. 3) If all 4 cannot be found, add whatever can be found to a fail array for manual insertion. Honestly, I do not think this is as hard is it looks. The hardest bit seems to be price especially later on when there is more than one dollar sign. In which case I think the number would have to be added to the fail array for checking. I would greatly appreciate it if someone could show me how to go about doing this. I have to do this to several sites looking for different criteria. I was roped into doing this for a friend of a friend. I am not even being paid [attachment deleted by admin]
  6. Yes, if I randomly cut a string and it is half way through a link, a span tag, an image tag, a paragraph etc there will be knock on problems down the page. Thanks Andy, having a rotten day, explode didn't occur to me. I was thinking about finding a string pattern with an expression then using substr.. i don't know what I was thinking.
  7. hi, I have a long string consisting of paragraphs and other elements. I want to cut the string after the first </p>. This will stop my page from breaking. String is $content. Does anyone have any idea how to quickly and efficiently do this?
  8. Can't find the button but solved. Managed to hack something together and I went for an alert instead of an inline error message.
  9. If I have a an array which as - $key => $value. - where key is a persons name and value is their age. What is the most efficient way to organise the array alphabetically by the key?
  10. Just wanted to add, I have recently had a load of users posting one word replies in the comment box. Theory is.. if they have to add up 19+24 they won't bother posting. Meanwhile if someone has something to say, doing the sum isn't a problem as the post contains enough value for it to be worth the effort. How effective it will be I will have to wait and see. I know I could put a minimum length on posts but this stops people writing what they want. I just want this
  11. Hi, I am really struggling on this. All I am looking to do is have a simple question which visitors answer. I know this will not stop bots, its not supposed to. I am just looking for something which will stop the average user from posting without thinking. This is what I have so far... <script type="text/javascript"> num1 = Math.floor(Math.random()*25); num2 = Math.floor(Math.random()*25); function checkForm(submitted) { if (num1 + num2 != submitted) { // Make element return error; return false; } } </script> <label for="anti-spam" id="anti-spam" style="float:left; padding-top:6px; margin-right:10px;"> <strong style="font-size:1.5em;"> <script type="text/javascript"> document.write(num1 + ' + ' + num2 + ' ='); </script> <noscript>1 + 1</noscript> </strong> </label> <input type="text" name="anti-spam" id="anti-spam" class="text" style="width:60px;" /> <span id="error"></span> A couple of questions really. 1) Is there a way I can hide this form from people without Javascript? 2) How do make the error show up in the span tag with the id of error. 3) Where do I put this? Do I add the function to onSubmit="" at the top of the form. Help is much appreciated. Thanks.
  12. Is it possible to send POST data with PHP? i.e. instead of header('location: page.php?age=10'); just sending the user to the location and the age information separately?
  13. Why don't you just contact your webhost and ask them what is going on?
  14. Could someone briefly explain what primary keys are? I use them all the time. Are they just a unique identifier for the record or do they have a deeper meaning? Futhermore I have recently heard the word 'foriegn key' bounded around. Anyone know what this is? Regarding the Query. I have 3 tables. Users Groups Tax They look something like this. Users - id - name - pass - email Groups // Stores Members/Groups relations - user_id - group_id Tax // Stores name/id relationships. In this case type=Group; name=Group Name; tax_id=group_id - tax_id - type - name What I want to do is get userdata. This includes group data. Whats the best way to query the username, get the group the user is a member of, get the name of that group?
  15. I have a datetime column in the mysql database. I am trying to get posts from the last 2 days. Do I have to convert the time into the db format? If so is there a dedicated function to do this or have I got to create it with the date function.
  16. If $_SERVER['PHP_SELF'] tells me the file name. How do I find what the server path is?
  17. $wildcardarray = array ('apple', 'orange', 'banana'); foreach ($wildcardarray as $key => $wildcard) { if ($wildcard == 'apple' || $wildcard == 'orange' || $wildcard = 'banana') { echo '<tr><td>' . $wildcard . ' <input type=checkbox blah blah />'; } }
  18. I am using unset to remove a specific array value. However this is breaking my for loops as there is a gap in the keys. What function can I use to relist keys from 0, 2, 3, 4 to 0,1,2,3?
  19. This is the problem that I am facing. I am using span to trigger a javascript function. The function creates an absolutely positioned div on the webpage. <span onMouseUp="formPopup();">Edit</span> This is the function <script type="text/javascript"> function formPopup() { // Sort out positioning. var boxWidth = 740; var pageWidth = document.documentElement.clientWidth; var yPos = 100; var halfPage = document.documentElement.clientWidth / 2; var halfBox = boxWidth / 2; var xPos = halfPage - halfBox; document.write('<div style="width:' + boxWidth + 'px;height:auto;position:absolute;top:' + yPos + 'px;left:' + xPos + 'px;" id="FormPopup">'); // Content Here var conTitle; // = document.getElementById('conTitle').value; var conDescription; // = document.getElementById('conDescription').value; var conKeywords; // = document.getElementById('conKeywords').value; document.write('<form action="" method="post">'); document.write('<h3>Edit Page Data</h3>'); document.write('<div class="form_item"><label>Page Name: </label><input type="text" name="name" value="' + conTitle + '" /></div>'); document.write('<div class="form_item"><label>Page Description: </label><input type="text" name="meta_description" value="' + conDescription + '" /></div>'); document.write('<div class="form_item"><label>Page Keywords: </label><input type="text" name="meta_keywords" value="' + conKeywords + '" /></div>'); document.write('</form>'); document.write('<\/div>'); } </script> How can I make this work so it displays the absolutely positioned div instead of reloading the page with just the div being displayed?
  20. 1) What is the function to cut an array. I am looking to slice out the first x number of array items. I cannot find the function to do this. The function I used before removed the items then reordered the array as 1,2,3 etc 2) What is the difference between -> and [] when it comes to getting data from a database?
  21. $Blurb='<table width="60" height="330" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="72" align="left" valign="center">Project Management</td> </tr> <tr> <td><img src="Images/Transparent.gif" width="60" height="14" /></td> </tr> <tr> <td height="72" align="left" valign="center">Industrial Design</td> </tr> <tr> <td align="left" valign="top"><img src="Images/Transparent.gif" width="60" height="14" /></td> </tr> <tr> <td></td> </tr> <tr> <td align="left" valign="top"><img src="Images/Transparent.gif" width="60" height="14" /></td> </tr> <tr> <td></td> </tr> <tr> <td align="left" valign="top"><img src="Images/Transparent.gif" width="60" height="14" /></td> </tr> <tr> <td align="left" valign="top"></td> </tr> </table>';
  22. <form action="" method="post"> <input name="name of field" type="text" /> <input type="submit" name="submit" /> </form>
  23. I am working on a website that has a price column and a currency column. What I need to do is convert these to a single currency. This needs to be dynamic.. i.e. the database should remain unchanged. Is there anyway to do this with MySQL? Something Like. SELECT price*1.5 FROM content WHERE currency='USD' SELECT price*40 FROM content WHERE currency ='INR' ORDER BY price ASC If this cannot be done with MySQL does anyone have any ideas on the simplest way to achieve this with PHP?
  24. If a number has periods or commas in it. What would happen if this field was converted from varchar to integer
×
×
  • 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.