Jump to content

Darnel

Members
  • Posts

    17
  • Joined

  • Last visited

Posts posted by Darnel

  1. That's one reason I always use compound words for column names, i.e. "ShowCount". It is much more unlikely to be a reserved word (and unlikely to become a reserved word in a future release). And never, never let any tool put backticks in your CREATE TABLE statements (I still build mine by hand), if the CREATE had failed you would have solved this problem hours ago.

     

    Thanks for the advice, ill know in the future

  2. Thanks, Iv'e changed the name and removed quotes. But still getting error.

     

    $sql3= " UPDATE ".PROJECT_TO
      ." SET to_user ="
      ."CONCAT_WS(',','".$post['name']."', to_user),"
      ." show = show +1 "
      ." WHERE project_to_id = ".$project_id." ";
    

     

    This line causes the error (...syntax to use near 'show = show +1 WHERE project_to_id = 2' at line 1))

    ." show = show +1 "
    

     

    What am I missing?

  3. Database error: Invalid SQL: UPDATE project_to_user SET to_user =CONCAT_WS(',','demo1', to_user), count = 'count +1' WHERE project_to_id = '1 ' MySQL Error: 1064 (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 'count = 'count +1' WHERE project_to_id = '1 '' at line 1) Session halted.

  4. Hi, I've been trying to find the syntax error with no luck. Keep getting error 1064. I'm not used to this format so not sure what goes where. Its driving me crazy :'( can any one point me in the right direction?

     

    $sql3= " UPDATE ".PROJECT_TO
      ." SET to_user ="
      ."CONCAT_WS(',','".$post['name']."', to_user),"
      ." count   =   'count +1' "
      ." WHERE project_to_id = '".$project_id." '";
    

     

    Thanks :-\

  5. Hi, I have this code but would like to modify it to be able to insert a new data in the next field if the current one is not empty.

     

    global $db;
     $sql= " UPDATE ".Project
      ." SET "
      ." name_1   =   '".$user_id."' "
      ." WHERE project_id = '".$project_id." '";
    
     $db->query($sql);
    

     

    So for example if field "name_1" is occupied I would like to add the same $user_id to "name_2".

     

    I've been trying to use

    CASE WHEN name_1 = '0'

    but can't seem to get the syntax right and keep getting Mysql errors.

     

    Any help appreciated, thanks

  6. Hi, really need some advice on Paypal API. I'm not sure which API to use. All I need is for Paypal to take payments from a users owed money wallet (a field in a Mysql table) preferably every month or so. Also the user would need to sign a agreement for this?

    Any help is appreciated. Thanks

  7. Hi, I have a page that uses jquery to load content (different content appears after clicking link). It was working fine but now after clicking the link it loads for about 30-40 seconds, but still loads every time. I've been using Firebug on Firefox but it shows (200 OK 32.95s) and no errors.

     

    Has anyone ever had something like this happen? any ideas what it might be or how I can test it? All other pages load normal its just this one.

     

    Thanks

  8. Hi, I have a weather script from google but I'm having some trouble figuring out how to set the language to display special characters such as ū,ė and so

    on.

    This code sets the language to my desired one.

    function __construct() {
    	$this->lang = lt; // sets the language

     

    I also have this code

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    So the rest of the website displays normal.

     

    Is there some PHP code I can use in the script? to set it to utf-8? or something?

     

    Thanks

  9. Not really. Since you used a Hash there is no way to take the hashed string and return it to its original string, so unless you know all the passwords to all the accounts, and can go through each 1 by 1, comparing the hashed password to the hash you have in the table, I don't really see a way of rectifying the situation, short of clearing the database and starting over. Is your website in production? Or are you just testing it? If its in production, and the usernames and passwords are from actual users, I guess you learned the lesson to always fully test your features before you unveil them to the public

     

    Yes the website is live I bought it from someone else...

     

    I updated everything so all new users will be alright. As for the old users they will not be able to log in until they reset their password using the forgot password  link. I guess I got F*****  :shrug: .

    Lesson learned and experience gained in the process. Thanks for your help clearing this mess I really appreciate it.

  10. Ah I found the problem since for some reason I have two registration forms and in one the $salt was missing so now I have a database with some salted and some not salted passwords. Is there a way to update all my password fields in mysql?

  11. If I understand right all the passwords are salt'ed in my database. The problem is when a user resets their password they can no longer log if there is no $salt. And if I do have $salt then the normal users can't log in.  :shrug:

     

    sorry i'm new at this

  12. Hi, I'm having some problems with this code. I have a password reset utility code which works and encrypts the password with md5 by using the password recovery page.

    But in order for a user with a reset password to login I have to use this code in my page.

     $username = addslashes($_POST['username']);
       $salt = 'random_stuff_15545';
           $password = md5($_POST['password'].$salt);

     

    But when I have this code above the users that have NOT reset their passwords can NOT log in.

     

    So for these users who have not reset their password i use this code[but with this code the users that reset their pass cannot log in]:

     $username = addslashes($_POST['username']);
           $password = md5($_POST['password']);

     

    How can I allow both types of users to log in? Cheers

     

  13. Yes, I now have a form that send a message when i specify

    $to = "withsome@email.com";

     

    Form

    <form id="formail" action="" method ="post">
    <label>Name : </label>
    <input type="text" name="name" id="name" />
    <label>Your mail :</label>
    <input type="text" name="mail" id="mail" />
    <label>Subject : </label>
    <input type="text" name="subject" id="subject" />
    <label>Text :</label>
    <textarea name="text" id="text" cols="40″ rows="10″></textarea>
    <input type="submit" value="send mail" id="sendmail" name="sendmail" />
    </form>

     

    Php code

    <?php
    $mail = $_POST['mail'];
    $name = $_POST['name'];
    $subject = $_POST['subject'];
    $text = $_POST['text'];
    $to = "withsome@email.com";
    $message =" You received  a mail from ".$mail;
    $message .=" Text of the message : ".$text;
    if(mail($to, $subject,$message)){
    echo "mail successfully sent";
    }
    else{
    echo "Error mail not sent";
    }
    
    ?>

     

    Now all i'm trying to do is to set

    $to = "withsome@email.com";

    to something like

    $to = $myrow['email'];

    So that the recipient would be a specified email address from the database.

     

    I know i'm making this harder than it is  ::)

     

    Cheers!

     

  14. you need to create a form that collects the minimum following feilds

    username

    useremail

    usermessage

     

    then you process the form with php and generate the email to be sent

     

    look here for basics on sending email with php

     

    http://php.net/manual/en/function.mail.php

     

    when you have this working the way you want be sure to implement some sort of security on your form, something like captcha, so that rogue bots cannot spam you with multitudes of unwanted messages

     

    http://www.phpcaptcha.org/

     

    Thanks I will have a look here.

     

    Depends who your client is. where does this ($myrow['email'])  come from? Is it out of a database table or a user has entered it. You can't hide the email address in a mail to. You can have a contact us that takes tou to a form to fill in. This would not reveil the sending email address.

     

    It is coming from a Mysql database that a user has entered

  15. Hi, Im sort of new to PHP.

     

    I currently have this code

    if(!empty($myrow['email'])){
    echo "<a href=\"mailto: ".$myrow['email']."\">".$myrow['email'];
    echo "</a><br>";}

    Which just displays a email from the database and when clicked opens Outlook or some other email program.

     

    What i'm trying to do is hide the email and in its place put a link like "Contact" or a simple form that would send a email from my website to that email address.

     

    Does any one know any links to tutorials or at least a name for a script that would allow me to do this?

     

    Cheers!

×
×
  • 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.