Jump to content

luciform

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Everything posted by luciform

  1. I'm getting the following error: I'm sure this error has been posted before, but I've searched and can't find a solution. I'm running XAMPP 1.7.3 with the Mercury/32 mail server v.4.72, which IS set to permit SMTP relaying of non-local mail. Is there anything I can change in php.ini, or anywhere else for that matter, to solve this? I'm tearing my hair out with this... If I can just get it to send out this email, my project is finished, but I've been wrestling with this mail() function for about 3 hours. Any help would be appreciated.
  2. Thanks for your advice. I've changed some code and managed to use the auto-increment for everything I need. I also renamed the 'index' field to 'row_number' to solve the conflict with the reserved word.
  3. Hi, I've discovered I can use the query below to give the row number of each record of a database table: SELECT @row := @row + 1 as row, t.* FROM tbl_name t, (SELECT @row := 0) r In phpmyadmin, this query creates a new field on the table called 'row', and assigns a value of '1' to the first record, '2' to the second record, and so on. The problem I have is that this new field is temporary, i.e. if I execute another statement, it will disappear. In my table I have a field called 'index'. What I want to be able to do is to set this 'index' field of all records to be equal to that record's row number. I'm guessing what I need is a subquery of some kind, something like: UPDATE tbl_name SET index = ??rownumber?? WHERE (____) I need something like that to change a specified record, as I can then use a PHP loop to do that for each row in turn. What I don't know is what should go in the ____ section. I'm guessing it uses some of the syntax from the statement I printed at the top? I've played around with it in phpmyadmin's SQL console but get various errors. The ??rownumber?? can be a variable in PHP that starts at 1 and increments each time the loop iterates. I realise if I set this 'index' field to auto-increment it would have the same effect, but elsewhere in my PHP script I am deleting records from the table and adding new ones, and that plays havoc with the auto-increment, so I want to be able to reassign the index to each record using that UPDATE statement. Any ideas? I hope that makes sense. 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.