Jump to content
Killersites Forums

Vasilis

Member
  • Posts

    6
  • Joined

  • Last visited

Everything posted by Vasilis

  1. Hi again, I have been trying to do something for the past 2 days with no luck. I would appreciate it if someone could help. Let's say I have "id" "first name", "last name", "amount" as columns. I have created a page (similar to view.php) where I have all the records of a specific first and last name. For example 'first name':John and 'last name':Smith with different 'amount' for each row. I want the "add new record" link to lead to a page where the first and last name are by default John and smith and you only have to insert the new amount. I tried to do it in the same way as the edit.php, getting the first and last name from the URL (new.php?firstname=John&lastname=Smith) but it didn't really work. Any ideas? thanks
  2. Thanks a lot Ben, it works! It turns out that both 'from' and 'to' are reserved words in MySQL.
  3. hmmm, this makes more sense I will try to change it
  4. I tried that, but it shows me the same generic error. Does it matter that I am not mentioning the id? (it has an AUTO_INCREMENT attribute) Or maybe there is an error with my php? Cheers
  5. Hi Ben, Thanks for the fast reply. I get this: 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 'from='George', to='Paul', amount='3.5', reason='something', date=NOW()' at line 1 Would it help if I paste all the code from new.php? Thanks
  6. Hi, I am a new member and also new in php/mysql. Thanks a lot for the tutorial, it is a great help for people who just started learning php. I am trying to do something very similar with the tutorial but keep getting an sql error when I try to add a new record. The only difference is that I have some extra fields : "from" "to" "reason" are varchar, "amount" is a decimal and "date" is a timestamp. I am using a form just like the tutorial to add new data: <form action="" method="post"> <div> <strong>From: *</strong> <input type="text" name="from" value="<?php echo $fromm; ?>" /><br/> <strong>To: *</strong> <input type="text" name="to" value="<?php echo $too; ?>" /><br/> <strong>Amount: *</strong> <input type="text" name="amount" value="<?php echo $amountt; ?>" /><br/> <strong>Reason: *</strong> <input type="text" name="reason" value="<?php echo $reasonn; ?>" /><br/> <p>* required</p> <input type="submit" name="submit" value="Submit"> </div> </form> but get an error for this part: // save the data to the database mysql_query("INSERT connections SET from='$from', to='$to', amount='$amount', reason='$reason', date=NOW()") or die(mysql_error()); I would appreciate if someone could help Thanks!
×
×
  • Create New...