Jump to content

digitalgod

Members
  • Posts

    374
  • Joined

  • Last visited

    Never

Everything posted by digitalgod

  1. here you go mysql_query("INSERT INTO " . $prefix . "news (headline,content,thumb,website1,website2,website3,desc1,desc2,desc3,`date`, when, `where`, `type`) VALUES('$headline','$content','$names[0]','$web1','$web2','$web3','$desc1','$desc2','$desc3','$today','$when','$where','$type')") or die(mysql_error());
  2. it's still giving me the exact same error...
  3. hey guys, I keep getting a mysql error but I can't seem to find what it is... here's my query mysql_query("INSERT INTO " . $prefix . "news (headline,content,thumb,website1,website2,website3,desc1,desc2,desc3,date,when,where,type) VALUES('$headline','$content','$names[0]','$web1','$web2','$web3','$desc1','$desc2','$desc3','$today','$when','$where','$type')") or die(mysql_error()); and here's the error I'm getting when inserting values You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'when,where,type) VALUES('just testing','this is just a test','cercle.jpg','','' at line 1
  4. hey guys, I have a list of events that's listed by date, I'm also trying to sort it by "featured" so if an event is featured it will be displayed before any other event. Here's the query I have so far mysql_query("SELECT * FROM events WHERE CURDATE() <= date ORDER BY featured DESC,date") or die(mysql_error()); but that's still sorting them by date and whether an event is featured or not it doesn't seem to be changing anything. the values for "featured" are either "yes" or "no" I'm going to try a few different queries in phpmyadmin but if someone has a solution it would be much appreciated *edit* nevermind it worked, was just changing it at the wrong place  ::)
  5. no it's ok I just added the name field but I was just wondering how come the id alone isnt enough
  6. so the id alone isnt good enough?
  7. simply by using html, make sure your mail headers have this at least $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
  8. hey guys, I have a form that has multiple checkboxes, I want to be able to retrieve the value of the ones that are checked but for some reason this isn't working and I can't seem to find out why [code=php:0] $aBottles = array(); $aQty = array(); //$_SESSION['reserve_qBottlesCount'] returns 1 like it's supposed to for ($i=1; $i <= $_SESSION['reserve_qBottlesCount']; $i++) {   array_push($aBottles,$_POST['chk'.$i]);   array_push($aQty,$_POST['sel'.$i]); } [/code] and this is part of the form [code] <tr> <td> <input type="checkbox" id="chk'.$c.'"  value="'.$bottles_row2['name'].'" style="height:17px; font-family:tahoma; font-size:10px; color:#9A400C "/> </td> <td> <strong>'.$bottles_row2['name'].'</strong> </td> <td> Price: $<span id="txtPrice'.$c.'">'.$bottles_row['price'].'</span> </td> <td> Qty: <select id="sel'.$c.'"  style="width:40px; height:17px; font-family:tahoma; font-size:10px; color:#9A400C "> <option value="val0">0</option> <option value="val1">1</option> <option value="val2">2</option> <option value="val3">3</option> </select> </td> </tr> [/code] everything is displayed the way it's supposed to and if I look at the source of the page I can see that the id of the checkbox is chk1 like it's supposed to be.. any clues why it's not working? *edit* when I echo $_POST['chk'.$i] it doesn't output anything, even though there is a value and the checkbox was checked
  9. thanks guys, both of the scripts worked perfectly. Barand can you please explain to me how does that query work? does it just order by the lowest difference between tbl_guests and $seats?
  10. hey guys, well I posted in the PHP Help section and I was told to try my luck here as well. I made a script for table reservations where a user enters how many they are and the script has to assign him a table. So for instance a user enters 5 and if in the database I have a table that seats 4 persons and another table that seats 8, the script has to assign him the table for 4 people, because it's a closer number. Now if I have a table for 4 and a table for 6, it has to assign him a table for 6 and so on. When the script assigns a table it also has to let the user what's the minimum amount of money the user has to spend to be able to reserve the table. Here's a db example: id  club_id  night_id  tbl_guests  tbl_x  min_price  full  1        16          17              4      2        120  false 2        16          17              8      2        240  false so tbl_guests is the table type (table that seats 4 people, 8 people, etc), tbl_x is the number of tables and min_price is the minimum amount they have to spend. Is there a way to do this directly with a query?
  11. well it's a table reservation script, so a user enters how many they'll be. In the database I have a list of tables like so id  club_id  night_id  tbl_guests  tbl_x  min_price  full  1        16          17              4      2        120  false 2        16          17              8      2        240  false so tbl_guests is the number of people that can be seated on that table and tbl_x is the number of tables. As for min_price, it's the minimum amount they have to spend to be on that table. so if a user says they'll be 5 then the script needs to know that they have to be seated on a table of 4 and tell him that he has to spend at least 120$. But if I had a table for 6 in there, the script has to reserve that table instead and charge the appropriate amount. I hope you understand what I mean
  12. Hey guys, I was wondering how can I match a user's input with something in the DB, meaning if a user types 5, I want it to match it's input with the closest number so if in the db the're a row that has the value 4 and another one the value 8 it will assign it to 4 but if the values are 4 and 6 then it will match it to 6. If that can't be done how can I just assign it to the closest highest number?
  13. Which one should I use? I have a query that inserts some info into a table named nights, when that query is done I have another one that inserts info into a table named rTables, in rTables I also have to insert the id  of the last inserted row. If i I use mysql_insert_id() it might give me the id of another table if someone else is doing something on the site. I was wondering if LAST_INSERT_ID() does the same thing.. and what would be the best way of getting the id of the last row added in a table
  14. thanks craygo but it's only 1 page I used a switch statement to determine what step the user is at switch($_SESSION['form_step']) { case "1" //prints 1st step //etc
  15. I will do all that but I'd really like finding a fix for this.
  16. I already thought about that and it works but as you know most users will hit back on their browsers first.
  17. hey guys was just wondering what would be the best way to creating a form that has multiple steps. right now I'm using sessions so when a user clicks next it simply adds the step number to that session, so if a user is on step 1 and clicks next (After filling up everything) $_SESSION['form_step'] will be equal to 2. Only problem with that is if a user clicks on back in his browser it won't take him back to step 1... any suggestions on what I can do?
  18. that I know already, I guess I wasn't clear before :P What I meant to say is that I have a dropdown, the value of the dropdown is a date in this format Y-m-d and what's displayed in the dropdown is something like date("l (M jS)") now when a user selects a date it calls a javascript function which extracts the day like so var text = main_select.options[main_select.selectedIndex].text.split(" "); var day = text[0].toLowerCase(); now I know that by using a switch statement I can change that string to a numerical value but I was wondering if there was a more efficient way of doing it.
  19. Hey guys, how can I convert a day into a numerical value? like monday --> 1  tuesday --> 2 etc
  20. sorry if it took so much time to reply, getting busy with midterms.. Anyways it works perfectly 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.