Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 4 of 4 FirstFirst ... 234
Results 46 to 54 of 54

Thread: PHP mysql error

  1. #46
    Regular Coder
    Join Date
    Jul 2011
    Posts
    141
    Thanks
    8
    Thanked 0 Times in 0 Posts
    My code as per your code fix: Still stuck at send.php


    Code:

    PHP Code:
    <?php
    $con 
    mysql_connect("localhost","friendko_admin","Macbookpro17#");
     if (!
    $con)
       {
       die(
    'Could not connect: ' mysql_error());
       }
     
    mysql_select_db("friendko_text"$con);
     
    $to $row['cell'];
    $carrier $row['carrier'];
    $message stripslashes($_POST['message']);
    $keycode $_POST['keycode'];
     
    $query "SELECT id, email, keycode, carrier, cell FROM users WHERE keycode = '{$_POST['keycode']}'";
    $result mysql_query($query) or die(mysql_error().'<br>'.$query);  
    while(
    $row mysql_fetch_array($resultMYSQL_ASSOC))  

    $carrierto = array();
    $carrierto['ATT'] = '@txt.att.net';
    $carrierto['DT']  = '@tomomail.net';
    $carrierto['S']   = '@messaging.sprintpcs.com';
    $carrierto['VM']  = '@vmobl.com';
    $cc $row['carrier']
    if ( isset(
    $carrierto[$cc]) )
    {
       
    $formatted_number $to $carrierto[$cc];
       
    mail("$formatted_number""SMS""$message");
       
    header ("Location: sms_success.php");
    }
    else
       die(
    "Oh crap... I don't know who that is!<br>\n");  
     
    ?>
    Quote Originally Posted by vroom View Post
    Alright, before my head explodes... how about creating either a carrierto array or some other way of avoiding the big redirect list... I've taken the liberty of using stock symbols for the phone carriers:

    PHP Code:
    $carrierto = array();
    $carrierto['ATT'] = '@txt.att.net';
    $carrierto['DT']  = '@tomomail.net';
    $carrierto['S']   = '@messaging.sprintpcs.com';
    $carrierto['VM']  = '@vmobl.com';
     
    $cc $row['carrier']
    if ( isset(
    $carrierto[$cc]) )
    {
       
    $formatted_number $to $carrierto[$cc];
       
    mail("$formatted_number""SMS""$message");
       
    header ("Location: sms_success.php");
    }
    else
       die(
    "Oh crap... I don't know who that is!<br>\n"); 
    P.S. Is this just a learning experience project?

  2. #47
    Regular Coder
    Join Date
    Jul 2011
    Posts
    141
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Its part of several PHP projects im doing to be able to better understanding PHP

  3. #48
    Regular Coder
    Join Date
    Jul 2011
    Posts
    141
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Any help is greatly appreciated.

  4. #49
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Do you get an error or just no send on the mail?

  5. Users who have thanked Fou-Lu for this post:

    amcf1992 (09-12-2012)

  6. #50
    Regular Coder
    Join Date
    Jul 2011
    Posts
    141
    Thanks
    8
    Thanked 0 Times in 0 Posts
    It stays stuckk on send.php, It may be something with array or the select statement.
    Thanks

  7. #51
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    I don't understand what you mean by stuck.
    Syntactically there is no infinite loop here to jam it. It is logically incorrect since you are missing braces which means you'll only ever have the last $row record to work with.

    The end result should either be an error message by the die calls, or a redirect to sms_success.php assuming that this page is not sms_success.php. If it is, it will attempt to redirect cyclically, but most modern browsers will detect this and issue a stop.

  8. #52
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    I'm not sure if you caught my previous post: who is the email From?
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  9. #53
    Regular Coder
    Join Date
    Jul 2011
    Posts
    141
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by AndrewGSW View Post
    I'm not sure if you caught my previous post: who is the email From?
    The server will send a text anonymously. There is to from, just a $to variable

  10. #54
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Quote Originally Posted by amcf1992 View Post
    The server will send a text anonymously. There is to from, just a $to variable
    From is a required field to send email. If its not configured on the server end, you must provide a from header in the email.


 
Page 4 of 4 FirstFirst ... 234

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •