lc21 Posted July 13, 2007 Share Posted July 13, 2007 This syntax throws an error, I am not sure how to concatenate the string. Is there a method of fixing this? Thank you $dbs = "SELECT roll, acNumber FROM excelDS WHERE rollAmount ='". $_SESSION ["rollAmount"]."'"AND $_SESSION["roll"] = '10000'"; Quote Link to comment https://forums.phpfreaks.com/topic/59750-string-concatenation/ Share on other sites More sharing options...
teng84 Posted July 13, 2007 Share Posted July 13, 2007 try $dbs = "SELECT roll, acNumber FROM excelDS WHERE rollAmount ='". $_SESSION ["rollAmount"]."' AND ".$_SESSION["roll"]." = '10000'"; Quote Link to comment https://forums.phpfreaks.com/topic/59750-string-concatenation/#findComment-296982 Share on other sites More sharing options...
lc21 Posted July 13, 2007 Author Share Posted July 13, 2007 That code then produces this, 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 '= 10000' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/59750-string-concatenation/#findComment-296988 Share on other sites More sharing options...
lc21 Posted July 13, 2007 Author Share Posted July 13, 2007 hmmmm that one could have been logic, how would this one be fixed? $excel = "SELECT rollN, tyU FROM excel WHERE roll ='". $_SESSION ["roll"]."' AND " rollExcel =".$_SESSION["rollExcel"]."; Quote Link to comment https://forums.phpfreaks.com/topic/59750-string-concatenation/#findComment-296996 Share on other sites More sharing options...
pocobueno1388 Posted July 13, 2007 Share Posted July 13, 2007 hmmmm that one could have been logic, how would this one be fixed? $excel = "SELECT rollN, tyU FROM excel WHERE roll ='". $_SESSION ["roll"]."' AND " rollExcel =".$_SESSION["rollExcel"]."; $excel = "SELECT rollN, tyU FROM excel WHERE roll ='". $_SESSION ["roll"]."' AND rollExcel = ".$_SESSION["rollExcel"].""; Quote Link to comment https://forums.phpfreaks.com/topic/59750-string-concatenation/#findComment-296998 Share on other sites More sharing options...
lc21 Posted July 13, 2007 Author Share Posted July 13, 2007 Still get the same error...bad times. It seems to be a problem with the $rollExcel as it has been set to = 1. Should that cause a problem? Quote Link to comment https://forums.phpfreaks.com/topic/59750-string-concatenation/#findComment-297001 Share on other sites More sharing options...
mihail Posted July 13, 2007 Share Posted July 13, 2007 $roll = $_SESSION ['roll"']; $rollExcel = $_SESSION['rollExcel']; $excel = "SELECT rollN, tyU FROM excel WHERE roll = '$roll' AND rollExcel = '$rollExcel'"; Quote Link to comment https://forums.phpfreaks.com/topic/59750-string-concatenation/#findComment-297091 Share on other sites More sharing options...
marcus Posted July 13, 2007 Share Posted July 13, 2007 $excel = "SELECT `rollN`,`tyU` FROM `excel` WHERE `roll`='$_SESSION[roll]' AND `rollExcel` ='$_SESSION[rollExcel]'"; Quote Link to comment https://forums.phpfreaks.com/topic/59750-string-concatenation/#findComment-297154 Share on other sites More sharing options...
MadTechie Posted July 13, 2007 Share Posted July 13, 2007 my 2cents <?php $dbs = "SELECT roll, acNumber FROM excelDS WHERE rollAmount ='{$_SESSION['rollAmount']}' AND {$_SESSION['roll']} = '10000'"; ?> or to concatenation <?php $dbs = "SELECT roll, acNumber FROM excelDS WHERE rollAmount ='".$_SESSION['rollAmount']."' AND ".$_SESSION['roll']." = '10000'"; ?> Try them.. and let us know:) Quote Link to comment https://forums.phpfreaks.com/topic/59750-string-concatenation/#findComment-297157 Share on other sites More sharing options...
MadTechie Posted July 13, 2007 Share Posted July 13, 2007 also Still get the same error...bad times. It seems to be a problem with the $rollExcel as it has been set to = 1. Should that cause a problem? $rollExcel should be a field name!! BUT it should be $roll = $_SESSION ["roll"]; NOT $roll = $_SESSION ['roll"']; fix that problem... Quote Link to comment https://forums.phpfreaks.com/topic/59750-string-concatenation/#findComment-297158 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.