Jump to content

string concatenation


lc21

Recommended Posts

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'";

Link to comment
Share on other sites

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"]."";

Link to comment
Share on other sites

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:)

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.