ballhogjoni Posted April 7, 2007 Share Posted April 7, 2007 if (($_SESSION['IPAddress']) == ($ip)) { $result = mysql_query("SELECT * FROM address WHERE IPAddress=$_SESSION['IPAddress']"); if( mysql_num_rows($result) == 1 ) { $sql = "SELECT FIRSTNAME, LASTNAME, STREET1, STREET2, CITYNAME, STATEORPROVINCE, POSTALCODE, COUNTRY, PHONE, PAYER, IPAddress FROM address WHERE IPAddress='$_SESSION['IPAddress']'"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); Link to comment https://forums.phpfreaks.com/topic/45967-solved-can-some-one-help-debug-this/ Share on other sites More sharing options...
kenrbnsn Posted April 7, 2007 Share Posted April 7, 2007 And the problem is? Ken Link to comment https://forums.phpfreaks.com/topic/45967-solved-can-some-one-help-debug-this/#findComment-223318 Share on other sites More sharing options...
ballhogjoni Posted April 7, 2007 Author Share Posted April 7, 2007 sorry bout that. Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/realfina/public_html/ec/checkout/functions.php on line 323 Link to comment https://forums.phpfreaks.com/topic/45967-solved-can-some-one-help-debug-this/#findComment-223319 Share on other sites More sharing options...
MadTechie Posted April 7, 2007 Share Posted April 7, 2007 $sql = "SELECT FIRSTNAME, LASTNAME, STREET1, STREET2, CITYNAME, STATEORPROVINCE, POSTALCODE, COUNTRY, PHONE, PAYER, IPAddress FROM address WHERE IPAddress='{$_SESSION['IPAddress']}'"; && "SELECT * FROM address WHERE IPAddress={$_SESSION['IPAddress']}" Link to comment https://forums.phpfreaks.com/topic/45967-solved-can-some-one-help-debug-this/#findComment-223320 Share on other sites More sharing options...
kenrbnsn Posted April 7, 2007 Share Posted April 7, 2007 You need to put "{ }" around the array references in the query strings: <?php if (($_SESSION['IPAddress']) == ($ip)) { $result = mysql_query("SELECT * FROM address WHERE IPAddress='{$_SESSION['IPAddress']}'"); if( mysql_num_rows($result) == 1 ) { $sql = "SELECT FIRSTNAME, LASTNAME, STREET1, STREET2, CITYNAME, STATEORPROVINCE, POSTALCODE, COUNTRY, PHONE, PAYER, IPAddress FROM address WHERE IPAddress='{$_SESSION['IPAddress']}'"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); ?> or use concatenation: <?php if (($_SESSION['IPAddress']) == ($ip)) { $result = mysql_query("SELECT * FROM address WHERE IPAddress='" . $_SESSION['IPAddress'] ."'"); if( mysql_num_rows($result) == 1 ) { $sql = "SELECT FIRSTNAME, LASTNAME, STREET1, STREET2, CITYNAME, STATEORPROVINCE, POSTALCODE, COUNTRY, PHONE, PAYER, IPAddress FROM address WHERE IPAddress='" . $_SESSION['IPAddress'] . "'"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); ?> Ken Link to comment https://forums.phpfreaks.com/topic/45967-solved-can-some-one-help-debug-this/#findComment-223321 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.