Jump to content

shadowcaster

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Everything posted by shadowcaster

  1. Hi. I have a table with the structure: CREATE TABLE otherpayments ( `advert_id` INT(11) NOT NULL AUTO_INCREMENT, `cheque` INT(1) NOT NULL, `postalorder` INT(1) NOT NULL, `paypal` INT(1) NOT NULL, `other` INT(1) NOT NULL, PRIMARY KEY(`advertentie_id`) ); Is it possible to remove the AUTO_INCREMENT from the advert_id field and how would I go about doing that? Thanks in advance.
  2. Hello guys. I have a simple form on a page and I want to copy some field's data from one set to another, from the address field (a1) to another address field (pa1). Here is the JavaScript I'm using: <script language="JavaScript1.2" type="text/JavaScript"> function copyOver(){ document.form.pa1.value = document.form.a1.value; document.form.pa2.value = document.form.a2.value; document.form.pa3.value = document.form.a3.value; }</script> and the html: <form name="form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <tr><td width="260" valign="top">Current Address <font color="#FF0000">*</font> </td> <td width="340"><input type="text" name="a1" style="width: 200;" class="contact" maxlength="50"><br> <input type="text" name="a2" style="width: 200;" class="contact" maxlength="40"><br> <input type="text" name="a3" style="width: 200;" class="contact" maxlength="30"></td> <td> </td></tr> <tr><td width="260" valign="top">Permanent Address <font color="#FF0000">*</font> </td> <td width="340"><input type="text" name="pa1" style="width: 200;" class="contact" maxlength="50"><br> <input type="text" name="pa2" style="width: 200;" class="contact" maxlength="40"><br> <input type="text" name="pa3" style="width: 200;" class="contact" maxlength="30"></td> <td width="100" valign="top"><input name="copyOver" type="button" onClick="copyOver();" value="Same As Current"></td></tr> When I click the button it doesn't do anything
  3. That worked brilliantly! Thank you so much!!  :D
  4. Hi everyone. I have a search engine on my website that I wish to know what the most popular searches are. I would like to know if the mysql code below is the correct way of doing a 'most-popular-searches' query. Here is the code including using PHP: [code] //Find every unique search $queryA = mysql_query("SELECT DISTINCT(searches) FROM search_table"); //create temporary table to hold search and number of times searched $queryB = mysql_query("CREATE TEMPORARY TABLE searches_count (searches VARCHAR(255), count INT);"); //loop through the distinct searches while ($row = mysql_fetch_array($queryA)){         //count how many times each search is in table $queryC = mysql_query("SELECT COUNT(searches) FROM search_table WHERE searches='".$row[0]."'");         //insert results into temporary table (extracts count from queryC) while($row2 = mysql_fetch_array($queryC)){ mysql_query("INSERT INTO searches_count VALUES('$row[0]','[$row2[0]');"); } } //sort and output the most popular searches $results = mysql_query("SELECT * FROM searches_count ORDER BY count"); while($row = mysql_fetch_array($results)){ print $row[0]. " " .$row[1]. "<br>\n"; } [/code] Am I doing this correctly or is there an easier way?
  5. That isn't the problem. Ahhh, I quit! I'll just settle with a standalone page.
  6. Are you trying to change a framed page? or open it in a new window?
  7. Thanks mate. Lol. That was simple.
  8. Hello. I have a simple form and want it to open in a new window to the location with the uri "http://www.google.com/search?hl=en&q=" + search I've get javascript errors with the current code. And when I click submit it opens the same file but appends the 'search' uri to be like this example.html?search=Search&clicked=Search... [code] <html> <head>         <link type="text/css" rel="stylesheet" href="rounded.css" media="screen" />         <!--[if IE]>         <style type="text/css">         body {margin:0px 0px 0px 0px; padding:0px;}         .container {width:250px; background;transparent;}         .textbox   {padding-left:15px; padding-top:0px;}         .submit       {padding-left:25px; padding-top:4px;} div.rounded h4 {display: block; align:center; color:black; } div.rounded h4:first-letter {padding: .3em 0 0 24px;background: transparent url(tlc_24_ddffff_60b0bf.gif) no-repeat top left} div.rounded p {background-image:url('bga.gif');}</style>         <![endif]-->         <script language="javascript" type="text/javascript">         do(){             var search = document.form1.search.value();             window.open("http://www.google.com/search?hl=en&q=" + search);         }         </script> </head> <body> <table border="0" width="255"> <tr><td> <div class="container">     <div class="rounded">     <h4>Google.com</h4>     <p>     <form method="get" name="form1" onsubmit="do();">     <input type="text" width="50" style="background:white; border:1px solid black; padding:3px;" name="search" value="Search..." onclick="document.form1.search.value('')" /><br />     <input style="background:black; color:white; margin-left:35px; padding-top:3px; margin-top:4px; margin-bottom:4px; font-weight:bold;" type="submit" value="Search..." name="clicked" /><br />     </p>     </div> </div> </td></tr> </table> </body> </html> [/code] Please help. I want it to work in firefox as well as IE. Thanks.
  9. Cheers guys but I found out what was wrong... I had to use $_POST[del] for each time I used the array in a process. If I assigned it to a local array like so: $del = $_POST[del]; then it would NOT make $del into the array with all the data within and it wouldn't work. I'm not sure why this happens but I learnt something new.
  10. Hi. I have a few HTML checkboxes that have the value of the id column of a table in the database - [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] <input type="checkbox" name="del[]" value="1" checked> //value 1 is to represent row 1 in the table <input type="checkbox" name="del[]" value="2" checked> <input type="checkbox" name="del[]" value="3" checked> <input type="checkbox" name="del[]" value="4" checked> another one of the checkboxes is: <input type="checkbox" name="seen[]" value="1"> //as with del, the value represents the row id in the table <input type="checkbox" name="seen[]" value="2"> <input type="checkbox" name="seen[]" value="3"> [/quote] But when I try to proccess these and get the array of values passed in the 'del' and 'seen' name it doesn't pass the array. Here is the PHP: [code] if (isset($_POST['submit'])){     $delete = addslashes($_POST[del]);     print_r($delete); //outputs 'Array' only     $notseen= addslashes($_POST[seen]);     print_r($notseen); //outputs nothing at all[/code] Where am I going wrong? Please help.
  11. Hello. I'm not sure if this is a newbie question but imagine I have two strings: [code] $string1 = "The quick brown brown fox jumps over the lazy dog."; $string2 = "The quick brown albino fox jumps over the groovy dog."; [/code] How would I compare the strings and then highlight the differences compared to $string1 so that the words albino and groovy stand out?
  12. Can you please give me an example. Do you mean like this?: [code] if (mysql_query("INSERT INTO searches VALUES('NULL, '$search','$date')")){   //do stuff }[/code] I haven't done that no.
  13. Thanks guys. I really appreciate you guys helping me, where would we database newbies be without you?! Just one last question about another issue, is there any point in putting A-Z (in capitals) since mysql seems to select enteries when they don't exactly have the same case as in the database; If I was searching for a word and forgot to use strtolower() to make a name like Elvis to lowercase and compared it to the database that stores all the names in lowercase, then it would still return the Elvis record. In the database it would be 'elvis' but I just searched for 'Elvis' and it still returned with that record. What do you think? is there any point to using A-Z in the regexp? (is there a speed issue involved?)
  14. Thanks guys... So I ended up using this: SELECT name FROM singers WHERE name REGEXP '[^a-zA-Z]' ORDER BY name; //selects non-alphabetic singer's names and it worked but not how I wanted. It selected the songs that started with brackets () and numbers but it also selected a few song-names that begin with A too! However, only a few A songs were selected from all the A songs. I think I can stick with it but I would prefer it if there was a work-around/fix.
  15. unfortunatly no, I've checked numerous times and I have made use of php's require_once() function and even placed it with other insert SQL commands and it still does the same thing. Every other insert works fine but this doesn't want to work. I have resorted to using the DISTINCT keyword in my queries to stop the doubling from displaying when I read from the database.
  16. Hello. I've been searching all over the internet for an answer to this problem but I'm still stuck. I have a table in my DB that was made with this code: CREATE TABLE searches (id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY, search VARCHAR(255) NOT NULL, datum DATE NOT NULL) and I am using PHP to insert searches into it like so: [code]<?php $date = date('Y-m-d'); $queryW = "INSERT DELAYED INTO searches VALUES (NULL, '$search','$date')"; mysql_query($queryW) or print('Problem adding to Db: '.mysql_error()); ?>[/code] But it inserts the same record twice and I have no idea why it does that. As far as I can see my php is sound and other inserts work fine. Please help.
  17. Not so much about design... but I think you should include the phone numbers of the hotels incase someone really does want to book. You might also consider making an internet-based room booking service but I bet that is not easy.
  18. Hello again. Sorry I wasn't clear before. I am trying to write a php script that searches the names of singers and categorizes them by the first letter of the name. E.g. when I click [a] (hyperlink) I want the page to show me all the singers whose name begins with a. But there are also people who don't have an alphabetic character for the first letter in their name (or their songs). How do I search for them? So far I have this: [code] SELECT name FROM singers WHERE name REGEXP '[^a-zA-Z]' ORDER BY name; //selects non-alphabetic singer's names //& SELECT name FROM singers WHERE name REGEXP '^$letter' ORDER BY name; //$letter could be any alphabetic character.[/code] Should I just use SELECT name FROM singers WHERE name LIKE '$letter%' ORDER BY name; instead for the second one? Am I doing this right?
  19. How do I select non-alphabetic characters from a field in my table? I don't want any characters that are a to z, just other symbols and numbers. If this is not possible, can I just select numbers? Thanks.
×
×
  • 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.