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.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Trouble with MYsql in php.

    Code:
    $sql2 = "SELECT DISTINCT `IP`, `Edition` FROM `Downloads` WHERE `Edition` = \'".$issue."\'";
    	$result2 = mysql_query($sql2);
    	while ($row2 = mysql_fetch_array($result2))
    	{
    		echo '<a href="Admin.php?Issue=' . $issue . '&IP=' . $row2['IP'] . '">' . $row2['IP'] . '</a></br>';
    	}

    This is what i am having trouble with. When i execute the above SQL statement directly in MySQL it will execute properly (obviously removing the $issue for the value it could be. ) but i get nothing when i run in PHP. No errors no code nothing.

    I have checked to ensure the $sql2 statement is generated correctly and it is for when it goes in to the mysql_query.

    any idea what im doing wrong? Thanks.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Remove the \ from the \'. Those are literal and not escapes since the entire string is double quoted.
    Use $result2 = mysql_query($sql2) or die(mysql_error()); to show the error.

  • Users who have thanked Fou-Lu for this post:

    TheMcG (04-17-2012)

  • #3
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    thank you very much!


  •  

    Posting Permissions

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