Results 1 to 5 of 5

Thread: PHP Help

  1. #1
    Join Date
    Nov 2007
    Location
    London
    Posts
    1,577
    Tokens
    36

    Latest Awards:

    Default PHP Help

    Hello,

    Code:
    $get_spy_info = mysql_query("SELECT 'Radio_IP1', 'Radio_Port1', 'Radio_IP2', 'Radio_Port2', 'Radio_IP3', 'Radio_Port3', 'Radio_IP4', 'Radio_Port4', 'Radio_IP5', 'Radio_Port5' FROM radio_spy FROM 'radio_spy' WHERE id='1'") or die(mysql_error());
    Could anyone tell me what's wrong with this sytax?

    Error: 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 'radio_spy' WHERE id='1'' at line 1

    I'm attempting to make a script, for experience with PHP as well as use.

    Fastest, best solution will get +rep. Thanks.
    Kind Regards,

    Guy
    __________________

    Since 2007. Unbelievable Uptime. Web hosting, resellers, master resellers, linux VPS, windows VPS, shoutcasts, at the lowest prices on the net.
    Tech-Hosts.co.uk.


  2. #2
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Because you specify FROM radio_spy twice..

    PHP Code:
    <?php
    $get_spy_info 
    mysql_query"SELECT 'Radio_IP1', 'Radio_Port1', 'Radio_IP2', 'Radio_Port2', 'Radio_IP3', 'Radio_Port3', 'Radio_IP4', 'Radio_Port4', 'Radio_IP5', 'Radio_Port5' FROM radio_spy WHERE id='1'" ) or die( mysql_error() );
    ?>
    If you are going to use that much, just use a wildcard * and then you can just pull it out of the array, without having to specify those, you are probably not working on a highly used application, so specifying what you are selecting isn't needed.
    Last edited by Dentafrice; 05-07-2008 at 02:04 PM.

  3. #3
    Join Date
    Nov 2007
    Location
    London
    Posts
    1,577
    Tokens
    36

    Latest Awards:

    Default

    Removed that, silly me, still same error

    Edit: Ok done as you've said but still same error.
    Last edited by iUnknown; 05-07-2008 at 02:06 PM.
    Kind Regards,

    Guy
    __________________

    Since 2007. Unbelievable Uptime. Web hosting, resellers, master resellers, linux VPS, windows VPS, shoutcasts, at the lowest prices on the net.
    Tech-Hosts.co.uk.


  4. #4
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Whoops.

    PHP Code:
    <?php
    $get_spy_info 
    mysql_query("SELECT * FROM radio_spy WHERE id='1'") or die(mysql_error());
    ?>

  5. #5
    Join Date
    Nov 2007
    Location
    London
    Posts
    1,577
    Tokens
    36

    Latest Awards:

    Default

    Quote Originally Posted by Dentafrice View Post
    Whoops.

    PHP Code:
    <?php
    $get_spy_info 
    mysql_query("SELECT * FROM radio_spy WHERE id='1'") or die(mysql_error());
    ?>
    Ah that works now. Thanks +rep
    Kind Regards,

    Guy
    __________________

    Since 2007. Unbelievable Uptime. Web hosting, resellers, master resellers, linux VPS, windows VPS, shoutcasts, at the lowest prices on the net.
    Tech-Hosts.co.uk.


Posting Permissions

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